LoomPythia-2.8B

LoomPythia-2.8B (2,775,190,944 parameters) is a 2.8B-parameter causal language model with loom attention, pretrained from scratch on 300B tokens of the Pile following the exact training recipe and tokenizer of EleutherAI/pythia-2.8b.

Model Summary

LoomPythia-2.8B augments a 32-layer Pythia-style Transformer ($D = 2560$, $n = 32$ heads, $d = 80$) with a per-token matrix memory stream $M_t \in \mathbb{R}^{64 \times 80}$ (d_k = 64 slots). At every token, each attention head performs vertical attention (MRead / MWrite) over earlier heads' outputs stored in $M_t$ to dynamically compose its query, key, value, and local output bypass before performing strictly causal horizontal attention over tokens (with rope_dim = 20 RoPE coordinates per head and full-head QKNorm).

Under a matched parameter count (2.78B) and only +1.95% forward FLOPs over Pythia-2.8B, LoomPythia-2.8B matches Pythia-12B in 0-shot accuracy and surpasses Pythia-12B in 5-shot accuracy across 10 standard LM Evaluation Harness benchmarks:

Model Params Pile ppl ↓ FLAN ppl ↓ LAMBADA PIQA WinoGrande ARC-E ARC-C SciQ BoolQ HellaSwag RACE-M RACE-H Avg (0-shot / 5-shot) ↑
Pythia-2.8B 2.78B 6.63 8.16 64.7 73.9 59.4 64.4 29.5 88.2 64.5 45.4 38.1 34.9 56.3 / 57.3
Pythia-6.9B 6.86B 6.29 7.85 67.3 75.2 60.9 67.3 31.3 89.7 63.7 48.0 40.6 37.0 58.1 / 59.3
mHC-Pythia-2.8B 2.78B 6.24 7.35 68.5 74.4 62.8 67.1 30.7 90.5 66.9 47.5 42.3 37.0 58.8 / 59.9
Pythia-12B 11.85B 6.01 7.26 70.5 76.0 63.9 70.2 31.8 90.2 67.4 50.3 40.6 38.3 59.9 / 60.8
LoomPythia-2.8B 2.78B 6.02 6.94 71.8 74.7 63.7 68.5 31.7 92.4 65.8 49.1 42.3 39.0 59.9 / 61.6

(Individual task columns show 0-shot accuracy; last column reports 0-shot / 5-shot 10-task average.)

Quickstart

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Caiyun-AI/LoomPythia-2.8B"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id, trust_remote_code=True, dtype=torch.bfloat16
).cuda().eval()

inputs = tokenizer("The capital of France is", return_tensors="pt").to("cuda")
with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=32, do_sample=False)
print(tokenizer.decode(out[0], skip_special_tokens=True))

For high-throughput GPU deployment using fused Triton kernels and torch.compile CUDA graphs, see pytorch/fast_inference in the GitHub repository.

Architecture Hyperparameters

Hyperparameter Value
num_hidden_layers ($L$) 32
hidden_size ($D$) 2560
num_attention_heads ($n$) 32
head_dim ($d$) 80
d_k (matrix-memory slots) 64
d_r (shared port bottleneck width) 640
rope_dim ($r$, Q/K RoPE tail) 20 (full Q/K head width 100)
intermediate_size (ffn_x, layers 0..30) 7808
last_ffn_x_dim (ffn_x, layer 31) 9984
ffn_m_dim (ffn_m, layers 0..30) 2944
max_position_embeddings 2048
vocab_size 50304 (GPT-NeoX-20B tokenizer)

Citation

@article{xiao2026loomformer,
  title={Rewirable Circuits in Transformers with Loom Attention},
  author={Xiao, Da and Meng, Qingye and Li, Shengping and Yuan, Xingyuan},
  journal={arXiv preprint arXiv:2611.30634},
  year={2026}
}
Downloads last month
10
Safetensors
Model size
3B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train Caiyun-AI/LoomPythia-2.8B

Paper for Caiyun-AI/LoomPythia-2.8B