Instructions to use User01110/cma-8M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use User01110/cma-8M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="User01110/cma-8M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("User01110/cma-8M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use User01110/cma-8M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "User01110/cma-8M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "User01110/cma-8M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/User01110/cma-8M
- SGLang
How to use User01110/cma-8M 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 "User01110/cma-8M" \ --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": "User01110/cma-8M", "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 "User01110/cma-8M" \ --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": "User01110/cma-8M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use User01110/cma-8M with Docker Model Runner:
docker model run hf.co/User01110/cma-8M
library_name: transformers
pipeline_tag: text-generation
tags:
- custom_code
- causal-lm
- cma
- small-language-model
- generalist
- 4k-tokenizer
datasets:
- HuggingFaceFW/fineweb_edu_100BT-shuffled
- HuggingFaceTB/smollm-corpus
- epfml/FineWeb-HQ
- HuggingFaceTB/finemath
CMA 8M
Channel-Mixing Attention at 7.85 million parameters.
A compact generalist language model built to study channel mixing at small scale.
7.85M parameters | 1,024-token context | 4,096-token vocabulary | Safetensors
Benchmark-selected at step 40,000 | Open SLM Leaderboard-style average: 36.21%
Overview
CMA 8M is the benchmark-selected checkpoint of a 7,849,161-parameter Channel-Mixing Attention generalist causal language model. It pairs a compact nine-layer architecture with the unmodified native GPT-S 4,096-token tokenizer.
| Detail | Value |
|---|---|
| Architecture | Channel-Mixing Attention causal LM |
| Parameters | 7,849,161, with tied input/output embeddings |
| Checkpoint | Step 40,000 |
| Training tokens | 20,971,520,000 |
| Context length | 1,024 tokens |
| Vocabulary | 4,096 native tokens |
| Weights | Safetensors |
How CMA works
In each of the nine transformer blocks, causal token attention is followed by CMA in the feed-forward position. For every token, CMA reshapes the 288-channel hidden state into 12 chunks of 24, routes between those chunks with 3 heads, applies a signed blend and SiLU gate, then projects back to 288 channels.
Quick start
This repository contains a custom Transformers architecture. Load it with
trust_remote_code=True to register CMA and the model's rotary convention.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "User01110/cma-8M"
tokenizer = AutoTokenizer.from_pretrained(
repo_id,
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
repo_id,
trust_remote_code=True,
dtype="auto",
)
model.eval()
Generate a continuation:
import torch
prompt = "Channel-mixing attention is"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=80,
do_sample=True,
temperature=0.8,
top_p=0.95,
)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Architecture
| Component | Configuration |
|---|---|
| Total parameters | 7,849,161 |
| Tied embedding parameters | 1,179,648 |
| Non-embedding parameters | 6,669,513 |
| Width / layers | 288 / 9 |
| Context length | 1,024 tokens |
| Token-attention heads | 6 query / 2 KV |
| CMA | chunk 24 / 3 heads / expansion 2 |
| Positional encoding | Contiguous-half RoPE |
| Tokenizer | AxiomicLabs/GPT-S-5M at revision df47402 |
| Vocabulary | 4,096 native tokens |
| Runtime | PyTorch 2.5+ for native SDPA grouped-query attention |
| Weights | Safetensors |
Input and output embeddings are tied.
Training mixture
All four sources are streamed natural-text corpora.
| Source | Share of trained tokens |
|---|---|
| FineWeb-Edu 100BT shuffled | 55.00% |
| Cosmopedia v2 | 25.00% |
| FineWeb-HQ | 10.00% |
| FineMath 4+ | 10.00% |
FineMath 4+ supplies high-quality mathematical explanations and reasoning as ordinary causal-language-model text.
Training trajectory
Across the logged evaluation checkpoints, normalized bits per byte (BPB) decreased from 3.7838 to 1.3520, while the Open SLM Leaderboard-style average increased from 30.66% to 36.21%.
Evaluation
Zero-shot results at step 40,000
The four lm-eval tasks use normalized accuracy when supplied by lm-eval
0.4.12, with float32 weights and softmax. ArithMark uses float32 weights and its
official raw continuation log-likelihood-sum rule.
| Benchmark | Accuracy |
|---|---|
| HellaSwag | 28.19% |
| ARC-Easy | 35.35% |
| ARC-Challenge | 23.29% |
| PIQA | 58.22% |
| ArithMark-2 | 29.12% |
| ARC mean | 29.32% |
| Open SLM Leaderboard-style average | 36.21% |
The selection average is:
(HellaSwag + mean(ARC-Easy, ARC-Challenge) + PIQA + ArithMark-2) / 4
This matches the Open SLM Leaderboard formula. The checkpoint was selected at step 40,000 for its 36.21% average.
WikiText-103 validation
| Metric | Value |
|---|---|
| Loss | 2.9903 |
| Perplexity | 19.89 |
| Normalized BPB | 1.3520 |
| Scored tokens | 358,911 |
| Normalized UTF-8 bytes | 1,145,226 |
WikiText normalized BPB is reported separately and was not used for checkpoint selection.