Instructions to use Caiyun-AI/mHC-Pythia-2.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Caiyun-AI/mHC-Pythia-2.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Caiyun-AI/mHC-Pythia-2.8B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Caiyun-AI/mHC-Pythia-2.8B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Caiyun-AI/mHC-Pythia-2.8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Caiyun-AI/mHC-Pythia-2.8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Caiyun-AI/mHC-Pythia-2.8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Caiyun-AI/mHC-Pythia-2.8B
- SGLang
How to use Caiyun-AI/mHC-Pythia-2.8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Caiyun-AI/mHC-Pythia-2.8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Caiyun-AI/mHC-Pythia-2.8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Caiyun-AI/mHC-Pythia-2.8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Caiyun-AI/mHC-Pythia-2.8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Caiyun-AI/mHC-Pythia-2.8B with Docker Model Runner:
docker model run hf.co/Caiyun-AI/mHC-Pythia-2.8B
mHC-Pythia-2.8B
mHC-Pythia-2.8B is a 2.78B-parameter pretrained base language model with 4-stream mHC, trained on approximately 300B tokens of the Pile. It is released as a comparison model for Pythia and LoomPythia, using a matched parameter budget and the Pythia tokenizer. It uses serial attention/MLP branches with QK normalization and a 2048-token context window.
- Paper (LoomFormer; evaluates this comparison model): Rewirable Circuits in Transformers with Loom Attention
- LoomPythia model: Caiyun-AI/LoomPythia-2.8B
- LoomFormer / LoomPythia code: Caiyun-AI/LoomFormer
- Pythia baseline: EleutherAI/pythia-2.8b
Comparison
| 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 (%); the final column gives the 0-shot / 5-shot mean across the 10 tasks. Lower perplexity and higher accuracy are better. This is the same comparison reported on the LoomPythia model page.
Quickstart
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "Caiyun-AI/mHC-Pythia-2.8B"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
repo, trust_remote_code=True, dtype=torch.bfloat16
).cuda().eval()
inputs = tok("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(tok.decode(out[0], skip_special_tokens=True))
Optimized inference
The repository also includes optional PyTorch/Triton optimized prefill code in fast_inference.py and mhc_kernels.py. Standard Hugging Face loading uses the reference implementation.
This is a pretrained base model, not an instruction-tuned assistant.
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
- 19