---
title: PyraLM-10M-v2
canonical_url: "https://www.modelscope.cn/models/Lazyshu/PyraLM-10M-v2"
md_url: "https://www.modelscope.cn/models/Lazyshu/PyraLM-10M-v2.md"
repository: Lazyshu/PyraLM-10M-v2
chinese_name: PyraLM-10M-v2
last_updated: 2026-12-06
license: mit
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - pyralm_next
architectures:
  - PyraLMNextForCausalLM
parameters: 10.0M
tensor_type:
  - F32
library_name:
  - pytorch
  - transformer
  - safetensors
language:
  - en
downloads: 11
stars: 0
tags:
  - pyralm
  - text-generation
  - causal-lm
  - custom-architecture
  - custom_code
  - slm
  - small-language-model
  - open-slm-leaderboard
---

# PyraLM-10M-v2

> PyraLM-10M-v2 - Lazyshu 在 ModelScope 开源的模型。9.97M-parameter English causal LM; mirror of Lazyshu/PyraLM-10M-v2 on Hugging Face.

Lazyshu/PyraLM-10M-v2 是 ModelScope 魔搭社区上的 10.0M 参数text-generation模型，采用 mit 许可。

- **Repository**: Lazyshu/PyraLM-10M-v2
- **License**: mit
- **Tasks**: text-generation
- **Parameters**: 10.0M
- **Tags**: pyralm, text-generation, causal-lm, custom-architecture, custom_code, slm, small-language-model, open-slm-leaderboard
- **Downloads**: 11
- **Stars**: 0
- **Last updated**: 2026-12-06

Source: https://www.modelscope.cn/models/Lazyshu/PyraLM-10M-v2

---

# PyraLM-10M-v2

[English](README.md) | [简体中文](README_zh.md)

**[PyraLM family](https://huggingface.co/collections/Lazyshu/pyralm-6b1511eb1966063404be1688):**

| Model | Role | Hugging Face | ModelScope |
|---|---|---|---|
| PyraLM-10M | Original, 18-layer tapered model | [HF](https://huggingface.co/Lazyshu/PyraLM-10M) | [MS](https://modelscope.cn/models/Lazyshu/PyraLM-10M) |
| **PyraLM-10M-v2** | Latest <10M, 12 layers | [HF](https://huggingface.co/Lazyshu/PyraLM-10M-v2) | [MS](https://modelscope.cn/models/Lazyshu/PyraLM-10M-v2) |
| PyraLM-50M | Larger capacity, 20 layers | [HF](https://huggingface.co/Lazyshu/PyraLM-50M) | [MS](https://modelscope.cn/models/Lazyshu/PyraLM-50M) |

> **Leaderboard submissions (2026-12-06):** [Open SLM #369](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard/discussions/369) and [BETU #51](https://huggingface.co/spaces/BananaMind/BETU-SLM-Leaderboard/discussions/51) are under review. The unmodified official BETU runner reproduced all six task prediction hashes; its submission Overall Index is **27.22**. Official ArithMark-4 evaluation is pending.

**PyraLM-10M-v2** is a **9,974,350-parameter** (`<10M`) English decoder-only language model trained **from scratch** with the **PyraLMNext** architecture: a 12-layer dense single-pass SwiGLU Transformer featuring causal document-masked Token Smear, Partial RoPE (`0.5`), Block Attention Residuals, Layer-0 Value Residual, and a custom `5,120`-vocabulary byte-level BPE tokenizer.

This release is a **genuine single-trajectory training checkpoint** (no weight averaging, no model merging, no parameter looping). Its local zero-shot results are **29.37% HellaSwag, 44.82% ARC-Easy, 23.46% ARC-Challenge, 60.55% PIQA, and 63.10% ArithMark-3**, with **27.22 BETU Overall Index**. Independent leaderboard verification is pending.

---

![PyraLM-10M-v2 compared with the previous release and leading references](assets/benchmark-comparison.png)

The reference models are the top two entries in the [Open SLM <10M ranking](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard) as of 2026-12-06. PyraLM scores are local FP32 evaluations; reference scores are taken from the official leaderboard. `min-spark-1.7` is listed as a four-pass model.

## Model Overview

| Property | Value |
|---|---|
| **Parameters** | `9,974,350` (tied input/output embeddings) |
| **Architecture** | 12-layer dense single-pass decoder-only Transformer (`PyraLMNextForCausalLM`) |
| **Hidden Size (`d_model`)** | `288` |
| **Attention** | GQA (`9` query heads, `3` KV heads, `head_dim = 32`), Partial RoPE (`fraction = 0.5`, `theta = 10000`), per-head QK-Norm, headwise output gate; local window (`16`) on layer `0` |
| **SwiGLU FFN** | `[560×9, 544×3]` |
| **Residual Mixing** | Block Attention Residuals (`block_attnres_size = 3`) and Layer-0 Value Residual |
| **Local Mixing** | Causal, document-masked Token Smear and Canon A/C depthwise convolutions (`kernel = 4`) |
| **Context Length** | `1,024` tokens |
| **Tokenizer** | Custom byte-level BPE, `5,120` vocabulary (`bos_token = null`, `pad = 0`, `eos = 1`) |
| **Checkpoint Type** | Single unaveraged training checkpoint; dense, single-pass inference |
| **Weights SHA-256** | `cbb54dc9b2db2e3f8ab1468a0642f4eda1421390e1b625cc08c2f6be189dd505` |
| **License** | MIT |

---

## Evaluation Results

The following are **local zero-shot results**, awaiting independent leaderboard verification. The Open SLM reference evaluation uses **native FP32, TF32 off, no BOS, and a 512-token context**.

| Model | Params | HellaSwag (`acc_norm`) | ARC-Easy (`acc_norm`) | ARC-Challenge (`acc_norm`) | PIQA (`acc_norm`) | ArithMark-3 |
|---|---:|---:|---:|---:|---:|---:|
| **PyraLM-10M-v2 (this release)** | **9.97M** | **29.37** | **44.82** | **23.46** | **60.55** | **63.10** |


Official ArithMark-4 results and the current Open SLM Intelligence Index are pending independent evaluation.

For the [BETU SLM Leaderboard](https://huggingface.co/spaces/BananaMind/BETU-SLM-Leaderboard), local evaluation uses the model's native **1,024-token context**:

| BETU Task / Index | Local Result |
|---|---:|
| HellaSwag (10,042 items) | **29.37%** |
| ARC-Easy (2,376 items) | **44.82%** |
| PIQA (1,838 items) | **60.55%** |
| ArithMark-3 (1,000 items) | **63.10%** |
| Tiny Theory of Mind (2,000 items) | **35.55%** |
| BananaMind Base Bench 1.1 (350 items) | **47.71%** |
| **Quality** | **24.01** |
| **Overall Index** | **27.22** |

### Additional Local Evaluations: PyraLM Family

The table compares the three **released checkpoints** on the same fixed text and task subsets. PyraLM-10M-v1 denotes the original [PyraLM-10M release](https://huggingface.co/Lazyshu/PyraLM-10M). These are local evaluations; the table specifies the evaluated subsets.

![PyraLM family: language modeling, reading and commonsense](assets/pyralm-family-language-quality.png)

| Benchmark | Items / text size | PyraLM-10M-v1 | PyraLM-10M-v2 | PyraLM-50M |
|---|---:|---:|---:|---:|
| WikiText-2 — language modeling (byte PPL ↓) | 1,292,008 bytes | 2.9075 | 2.8282 | **2.3925** |
| LAMBADA — contextual word prediction | 5,153 | 23.56 | 25.54 | **34.74** |
| SWAG — commonsense continuation | 2,000 | 33.55 | 34.70 | **41.95** |
| RACE-Middle — reading comprehension | 1,311 | 32.88 | 33.79 | **41.27** |
| RACE-High — reading comprehension | 1,500 | 28.33 | 27.60 | **32.13** |
| BoolQ — yes/no reading comprehension | 2,195 | 46.97 | 57.86 | **60.05** |
| OpenBookQA — elementary science | 454 | 26.21 | 27.75 | **34.58** |
| SciQ — science knowledge | 993 | 51.96 | 57.40 | **72.51** |
| Quartz — qualitative reasoning with a passage | 784 | 51.40 | 52.55 | **56.63** |
| COPA — causal commonsense | 100 | 55.00 | 55.00 | **64.00** |
| WinoGrande — pronoun resolution | 1,267 | **49.96** | 49.57 | 49.72 |
| RTE — textual entailment | 272 | 48.16 | **51.84** | 51.10 |
| WiC — word sense in context | 635 | **50.24** | 45.20 | 49.61 |
| CB — textual entailment | 48 | **56.25** | 54.17 | 43.75 |

Accuracy is reported in percent. FP32, TF32 off, no BOS, context 512. SWAG, RACE, BoolQ, RTE, WiC and CB use summed continuation log-likelihood; OpenBookQA, SciQ, Quartz, COPA and WinoGrande use character-normalized scores; LAMBADA uses exact next-word completion. BoolQ includes 54 context-truncated candidates for 10M-v1 and 18 for 50M. SciQ uses a test subset; its training split is included in SFT.

WikiText-2 uses the same raw text and 256-token prediction windows. **Byte PPL = exp(total NLL / UTF-8 bytes)** is reported across different tokenizers; token-level PPL is not compared directly.

---

## Training Summary

- **Pretraining:** Trained from random initialization on **23.85B training tokens** (`19.10B` stable + `4.75B` `1-sqrt` cooldown) of English web, educational, textbook, encyclopedia, science, commonsense, and math text using Muon-based optimization (`1,024` context), followed by a **1.52B-token** high-density CoT-Math / Natural Science / WikiHow / DCLM continuation polish (**25.37B** total training tokens).
- **Post-training:** Single-trajectory SFT on **66,847 examples** (`1,400` updates, learning rate `3.5e-5`), combining non-math multiple-choice supervision (`SocialIQA`, `SciQ`, `CommonsenseQA`, `QASC`) with `6,800` generative arithmetic / word-problem examples (`GSM8K`, `ASDiv`, `SVAMP`, and exact symbolic arithmetic; **0 math multiple-choice items**), retaining pretraining next-token replay at **loss weight 0.40**.

The released weights come from one continuous training lineage, without weight averaging or model merging.

---

## Usage

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo_id = "Lazyshu/PyraLM-10M-v2"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    repo_id,
    trust_remote_code=True,
    dtype=torch.float32,
).eval()

prompt = (
    "Problem: A baker made 48 muffins and sold 19 of them. "
    "How many muffins are left?\nSolution:"
)
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
with torch.inference_mode():
    out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```

For the ModelScope mirror, download the same package and pass the local path to the Transformers calls above:

```python
from modelscope import snapshot_download
repo_id = snapshot_download("Lazyshu/PyraLM-10M-v2")
```

- `generation_config.json` supplies `eos_token_id = 1` and `pad_token_id = 0`.
- For batched generation, use `tokenizer.padding_side = "left"`.
- The generation interface supports greedy decoding and temperature/top-k sampling. For sampling, use `do_sample=True, temperature=0.7, top_k=40`.

### Public-task Reproduction

Use FP32, no BOS, zero-shot prompts, and a **512-token evaluation context** (native model context is 1,024).

```bash
# Four public tasks via lm-evaluation-harness
lm_eval --model hf \
  --model_args pretrained=Lazyshu/PyraLM-10M-v2,trust_remote_code=True,dtype=float32,add_bos_token=False,max_length=512 \
  --tasks hellaswag,arc_easy,arc_challenge,piqa \
  --num_fewshot 0 --device cpu --batch_size 8

# Official ArithMark-3 script from AxiomicLabs/Arithmark-3.0
python bencharithmark-3.py \
  --model Lazyshu/PyraLM-10M-v2 \
  --dtype float32 --device cpu --max-context 512 --save-predictions
```

---

## Limitations

- **Ultra-small parameter budget (`9.97M`):** Designed for small-language-model research and efficient edge/CPU inference; not a general-purpose chat assistant.
- **Short context:** Native context is `1,024` tokens; the Open SLM reference evaluation uses `512`.
- **English-focused:** Pretraining and post-training primarily use English text and have not undergone chat or safety alignment.

---

## License & Acknowledgments

Released under the **MIT License**. See [LICENSE](LICENSE).

- Thanks to the **[PyTRIO](https://pytrio.com/home)** team for providing training compute.
- PyraLM-10M-v2 succeeds [PyraLM-10M](https://huggingface.co/Lazyshu/PyraLM-10M) and shares the PyraLMNext architectural family with [PyraLM-50M](https://huggingface.co/Lazyshu/PyraLM-50M). We acknowledge [Ethoric-10M](https://huggingface.co/techdotus/Ethoric-10M) for the Peri-LN/Canon attention foundation.
- Thanks to [AxiomicLabs](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard) and [BananaMind](https://huggingface.co/spaces/BananaMind/BETU-SLM-Leaderboard) for maintaining the public benchmarks and leaderboards.
