LoomPythia-2.8B
A Language Model with Loom Attention
1 min read
This model builds on a modified Pythia architecture, adding a matrix memory to every layer for dynamic query and key composition. With 2.78 billion parameters, it matches the quality of much larger models, outperforming Pythia-12B in 5-shot accuracy on benchmarks. Trained on 300 billion tokens from The Pile dataset, it works well for research tasks and efficient resource-saving inference.
Key features
- New architecture featuring loom attention (matrix memory stream)
- Comparable to models four times its size while using fewer resources
- Higher accuracy in 5-shot tasks compared to Pythia-12B
- Minimal FLOPs increase (only +1.95% over base Pythia-2.8B)
What you can do
- Run text generation through the standard Hugging Face Transformers interface
- Use fast inference based on Triton kernels and torch.compile for service deployment
- Test model accuracy on LM Evaluation Harness benchmarks
Example
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))
Read more
DetailsParameters: 2.78B
Architecture: 32 layers, hidden_size 2560, matrix memory d_k = 64
Tokenizer: GPT-NeoX-20B (vocab_size 50304)
Training dataset: 300B tokens of The Pile










Comments