Text Generation
Transformers
Safetensors
English
cma
custom_code
causal-lm
small-language-model
generalist
4k-tokenizer
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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("User01110/CMA-8M", trust_remote_code=True, device_map="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
Refresh model card
Browse files
README.md
CHANGED
|
@@ -15,79 +15,180 @@ datasets:
|
|
| 15 |
- HuggingFaceTB/finemath
|
| 16 |
---
|
| 17 |
|
|
|
|
|
|
|
| 18 |
# CMA 8M
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
```python
|
| 35 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
model = AutoModelForCausalLM.from_pretrained(
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
```
|
| 43 |
|
|
|
|
|
|
|
|
|
|
| 44 |
## Architecture
|
| 45 |
|
| 46 |
-
|
| 47 |
-
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
## Training mixture
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
FineMath-4+ supplies high-quality mathematical explanations and reasoning as
|
| 68 |
-
ordinary causal-language-model text,
|
| 69 |
-
tokenizer transformations.
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
## Zero-shot
|
| 73 |
|
| 74 |
-
The four lm-eval tasks use normalized accuracy when supplied by lm-eval
|
| 75 |
-
0.4.12, with float32 weights and softmax. ArithMark
|
| 76 |
-
|
| 77 |
|
| 78 |
| Benchmark | Accuracy |
|
| 79 |
|---|---:|
|
| 80 |
-
| HellaSwag | 28.19% |
|
| 81 |
-
| ARC-Easy | 35.35% |
|
| 82 |
-
| ARC-Challenge | 23.29% |
|
| 83 |
-
| PIQA | 58.22% |
|
| 84 |
-
| ArithMark-2 | 29.12% |
|
| 85 |
-
| ARC mean | 29.32% |
|
| 86 |
-
| Open SLM Leaderboard-style average | 36.21% |
|
| 87 |
-
|
| 88 |
-
The average is
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
- HuggingFaceTB/finemath
|
| 16 |
---
|
| 17 |
|
| 18 |
+
<div align="center">
|
| 19 |
+
|
| 20 |
# CMA 8M
|
| 21 |
|
| 22 |
+
### Channel-Mixing Attention, distilled to 7.85 million parameters.
|
| 23 |
+
|
| 24 |
+
A compact generalist language model built to study channel mixing at small scale.
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+

|
| 28 |
+

|
| 29 |
+

|
| 30 |
+
|
| 31 |
+
**Benchmark-selected at step 40,000 ? Open SLM Leaderboard-style average: 36.21%**
|
| 32 |
+
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Overview
|
| 38 |
+
|
| 39 |
+
CMA 8M is the benchmark-selected checkpoint of a **7,849,161-parameter**
|
| 40 |
+
Channel-Mixing Attention generalist causal language model. It pairs a compact
|
| 41 |
+
nine-layer architecture with the unmodified native GPT-S 4,096-token tokenizer.
|
| 42 |
+
|
| 43 |
+
The model is deliberately free of task-specific shortcuts. It uses no
|
| 44 |
+
arithmetic-specific token splitting, place embeddings, role embeddings,
|
| 45 |
+
inference-time equation detection, or tokenizer transformations. Mathematical
|
| 46 |
+
text is learned as ordinary causal-language-model text.
|
| 47 |
|
| 48 |
+
| | |
|
| 49 |
+
|---|---|
|
| 50 |
+
| **Architecture** | Channel-Mixing Attention causal LM |
|
| 51 |
+
| **Parameters** | 7,849,161, with tied input/output embeddings |
|
| 52 |
+
| **Checkpoint** | Step 40,000 |
|
| 53 |
+
| **Context length** | 1,024 tokens |
|
| 54 |
+
| **Vocabulary** | 4,096 native tokens |
|
| 55 |
+
| **Weight format** | Safetensors only |
|
| 56 |
|
| 57 |
+
## Quick start
|
| 58 |
+
|
| 59 |
+
This repository contains a custom Transformers architecture. Stock Hugging Face
|
| 60 |
+
model classes do not implement CMA or this model's exact rotary convention, so
|
| 61 |
+
`trust_remote_code=True` is required.
|
| 62 |
|
| 63 |
```python
|
| 64 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
|
| 66 |
+
repo_id = "User01110/cma-8M"
|
| 67 |
+
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 69 |
+
repo_id,
|
| 70 |
+
trust_remote_code=True,
|
| 71 |
+
)
|
| 72 |
model = AutoModelForCausalLM.from_pretrained(
|
| 73 |
+
repo_id,
|
| 74 |
+
trust_remote_code=True,
|
| 75 |
+
dtype="auto",
|
| 76 |
)
|
| 77 |
+
model.eval()
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Generate a continuation:
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
import torch
|
| 84 |
+
|
| 85 |
+
prompt = "Channel-mixing attention is"
|
| 86 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 87 |
+
|
| 88 |
+
with torch.inference_mode():
|
| 89 |
+
output = model.generate(
|
| 90 |
+
**inputs,
|
| 91 |
+
max_new_tokens=80,
|
| 92 |
+
do_sample=True,
|
| 93 |
+
temperature=0.8,
|
| 94 |
+
top_p=0.95,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
| 98 |
```
|
| 99 |
|
| 100 |
+
> `trust_remote_code=True` executes the modeling code stored in this repository.
|
| 101 |
+
> Review that code before loading the model in a sensitive environment.
|
| 102 |
+
|
| 103 |
## Architecture
|
| 104 |
|
| 105 |
+
| Component | Configuration |
|
| 106 |
+
|---|---:|
|
| 107 |
+
| Total parameters | **7,849,161** |
|
| 108 |
+
| Tied embedding parameters | 1,179,648 |
|
| 109 |
+
| Non-embedding parameters | 6,669,513 |
|
| 110 |
+
| Width / layers | 288 / 9 |
|
| 111 |
+
| Context length | 1,024 tokens |
|
| 112 |
+
| Token-attention heads | 6 query / 2 KV |
|
| 113 |
+
| CMA | chunk 24 / 3 heads / expansion 2 |
|
| 114 |
+
| Positional encoding | Contiguous-half RoPE without scaling |
|
| 115 |
+
| Tokenizer | `AxiomicLabs/GPT-S-5M` at revision `df47402` |
|
| 116 |
+
| Vocabulary | 4,096 native tokens |
|
| 117 |
+
| Runtime | PyTorch 2.5+ for native SDPA grouped-query attention |
|
| 118 |
+
| Weights | `model.safetensors` only; no PyTorch `.bin` weights |
|
| 119 |
+
|
| 120 |
+
Input and output embeddings are tied. The model contains no task-specific model
|
| 121 |
+
features or tokenizer transformations.
|
| 122 |
|
| 123 |
## Training mixture
|
| 124 |
|
| 125 |
+
All four sources are streamed natural-text corpora.
|
| 126 |
+
|
| 127 |
+
| Source | Share of trained tokens |
|
| 128 |
+
|---|---:|
|
| 129 |
+
| FineWeb-Edu 100BT shuffled | **55.00%** |
|
| 130 |
+
| Cosmopedia v2 | **25.00%** |
|
| 131 |
+
| FineWeb-HQ | **10.00%** |
|
| 132 |
+
| FineMath 4+ | **10.00%** |
|
| 133 |
|
| 134 |
FineMath-4+ supplies high-quality mathematical explanations and reasoning as
|
| 135 |
+
ordinary causal-language-model text, without task-specific model features or
|
| 136 |
+
tokenizer transformations.
|
| 137 |
+
|
| 138 |
+
## Evaluation
|
| 139 |
|
| 140 |
+
### Zero-shot results at step 40,000
|
| 141 |
|
| 142 |
+
The four lm-eval tasks use normalized accuracy when supplied by `lm-eval`
|
| 143 |
+
0.4.12, with float32 weights and softmax. ArithMark uses float32 weights and its
|
| 144 |
+
official raw continuation log-likelihood-sum rule.
|
| 145 |
|
| 146 |
| Benchmark | Accuracy |
|
| 147 |
|---|---:|
|
| 148 |
+
| HellaSwag | **28.19%** |
|
| 149 |
+
| ARC-Easy | **35.35%** |
|
| 150 |
+
| ARC-Challenge | **23.29%** |
|
| 151 |
+
| PIQA | **58.22%** |
|
| 152 |
+
| ArithMark-2 | **29.12%** |
|
| 153 |
+
| ARC mean | **29.32%** |
|
| 154 |
+
| **Open SLM Leaderboard-style average** | **36.21%** |
|
| 155 |
+
|
| 156 |
+
The selection average is:
|
| 157 |
+
|
| 158 |
+
```text
|
| 159 |
+
(HellaSwag + mean(ARC-Easy, ARC-Challenge) + PIQA + ArithMark-2) / 4
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
This matches the Open SLM Leaderboard formula. The checkpoint was selected at
|
| 163 |
+
step 40,000 for its **36.21%** average.
|
| 164 |
+
|
| 165 |
+
### WikiText-103 validation
|
| 166 |
+
|
| 167 |
+
| Metric | Value |
|
| 168 |
+
|---|---:|
|
| 169 |
+
| Loss | **2.9903** |
|
| 170 |
+
| Perplexity | **19.89** |
|
| 171 |
+
| Normalized BPB | **1.3520** |
|
| 172 |
+
| Scored tokens | 358,911 |
|
| 173 |
+
| Normalized UTF-8 bytes | 1,145,226 |
|
| 174 |
+
|
| 175 |
+
WikiText normalized BPB is reported separately and was **not** used for
|
| 176 |
+
checkpoint selection.
|
| 177 |
+
|
| 178 |
+
## Intended use and limitations
|
| 179 |
+
|
| 180 |
+
CMA 8M is intended for research into compact language models, Channel-Mixing
|
| 181 |
+
Attention, controlled evaluation, and lightweight local experiments. It is a
|
| 182 |
+
base causal language model, not an instruction-tuned chat assistant.
|
| 183 |
+
|
| 184 |
+
At 7.85M parameters, its knowledge and reasoning capacity are sharply limited
|
| 185 |
+
relative to larger models. Generated text may be incorrect, incoherent, biased,
|
| 186 |
+
or unsafe. Verify outputs before using them downstream.
|
| 187 |
+
|
| 188 |
+
---
|
| 189 |
+
|
| 190 |
+
<div align="center">
|
| 191 |
+
|
| 192 |
+
**Compact scale. Native tokens. Channel mixing.**
|
| 193 |
+
|
| 194 |
+
</div>
|