Text Generation
Transformers
Safetensors
English
pyralm
causal-lm
custom-architecture
custom_code
slm
small-language-model
open-slm-leaderboard
Eval Results (legacy)
Run this model with HF Jobs
Run Lazyshu/PyraLM-10M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Lazyshu/PyraLM-10M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Lazyshu/PyraLM-10M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Lazyshu/PyraLM-10M. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Lazyshu/PyraLM-10M. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lazyshu/PyraLM-10M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lazyshu/PyraLM-10M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lazyshu/PyraLM-10M", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Lazyshu/PyraLM-10M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lazyshu/PyraLM-10M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lazyshu/PyraLM-10M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lazyshu/PyraLM-10M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Lazyshu/PyraLM-10M
- SGLang
How to use Lazyshu/PyraLM-10M 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 "Lazyshu/PyraLM-10M" \ --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": "Lazyshu/PyraLM-10M", "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 "Lazyshu/PyraLM-10M" \ --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": "Lazyshu/PyraLM-10M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Lazyshu/PyraLM-10M with Docker Model Runner:
docker model run hf.co/Lazyshu/PyraLM-10M
|
Download README.md from Lazyshu/PyraLM-10M: direct link, hf CLI and curl.
- Browser
- Download file 15 kB
-
https://huggingface.co/Lazyshu/PyraLM-10M/resolve/main/README.md
- Command line
-
hf download hf://Lazyshu/PyraLM-10M/README.md
-
curl -L -o README.md https://huggingface.co/Lazyshu/PyraLM-10M/resolve/main/README.md
15 kB
| language: | |
| - en | |
| license: mit | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - pyralm | |
| - text-generation | |
| - causal-lm | |
| - custom-architecture | |
| - custom_code | |
| - slm | |
| - small-language-model | |
| - open-slm-leaderboard | |
| model-index: | |
| - name: PyraLM-10M | |
| results: | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: Rowan/hellaswag | |
| name: HellaSwag | |
| split: validation | |
| metrics: | |
| - type: acc_norm | |
| value: 28.44 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: allenai/ai2_arc | |
| name: ARC-Easy | |
| config: ARC-Easy | |
| split: test | |
| metrics: | |
| - type: acc_norm | |
| value: 40.36 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: allenai/ai2_arc | |
| name: ARC-Challenge | |
| config: ARC-Challenge | |
| split: test | |
| metrics: | |
| - type: acc_norm | |
| value: 24.15 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: ybisk/piqa | |
| name: PIQA | |
| split: validation | |
| metrics: | |
| - type: acc_norm | |
| value: 58.32 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: AxiomicLabs/Arithmark-3.0 | |
| name: ArithMark-3.0 | |
| split: test | |
| metrics: | |
| - type: acc_norm | |
| value: 57.90 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| - task: | |
| type: text-generation | |
| dataset: | |
| type: ArithMark-4 | |
| name: ArithMark-4 (official held-out evaluation) | |
| metrics: | |
| - type: acc_norm | |
| value: 30.06 | |
| name: acc_norm (0-shot, officially verified) | |
| source: | |
| name: Open SLM Leaderboard (official verification, 2026-12-05) | |
| url: https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard | |
| # PyraLM-10M | |
| [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) | | |
| > **BETU leaderboard update (2026-12-04):** PyraLM-10M ranks **#1 in the `<10M` category** of the [BETU SLM Leaderboard](https://huggingface.co/spaces/BananaMind/BETU-SLM-Leaderboard), with **Overall Index 22.64** and **Quality 20.28** ([accepted submission](https://huggingface.co/spaces/BananaMind/BETU-SLM-Leaderboard/discussions/35)). BETU combines six benchmarks; its Overall Index is a separate metric from the Open SLM Intelligence Index below. | |
| > **Open SLM Leaderboard update (2026-12-05):** Officially verified and listed on the [Open SLM Leaderboard](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard) ([submission #359](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard/discussions/359)): **Official Int Index 9.59 under the ArithMark-4 formula**, ranking **#3 overall in `<10M`** as of that date, with **30.06% on ArithMark-4 (#1 in `<10M`)** and **57.90% on ArithMark-3**. | |
| **PyraLM-10M** is a **9,987,600-parameter** (`<10M`) English decoder-only language model trained **from scratch** with a pyramid-tapered 18-layer FFN architecture and a compact 5,120-vocab BPE tokenizer. | |
| This release is a **genuine single-trajectory training checkpoint** (no model merging, no model soups, no SWA/EMA), officially verified on the Open SLM Leaderboard with an **Intelligence Index of `9.59` under the current ArithMark-4 formula**. | |
|  | |
| Local comparison of the released PyraLM models. Official ArithMark-4 results are reported separately below. | |
| --- | |
| ## Model Overview | |
| | Property | Value | | |
| |---|---| | |
| | **Parameters** | `9,987,600` (tied input/output embeddings) | | |
| | **Architecture** | 18-layer pyramid-tapered decoder-only Transformer (`PyraLMForCausalLM`) | | |
| | **Hidden Size (`d_model`)** | `256` | | |
| | **Attention** | GQA (`8` query heads, `2` KV heads, `head_dim = 32`), RoPE (`theta = 10000`), per-head QK-Norm, headwise output gate, local window (`16`) on layer `0` | | |
| | **Pyramid Tapered SwiGLU FFN** | `[624ร5, 408ร5, 312ร4, 232ร4]` | | |
| | **Local Mixing & Norm** | Peri-LN (RMSNorm), causal depthwise Canon-A/C convolutions (`kernel = 4`, document-masked) | | |
| | **Context Length** | `512` tokens | | |
| | **Tokenizer** | Custom `5,120`-vocab BPE (`bos_token = null`, `pad = 0`, `eos = 1`) | | |
| | **Checkpoint Type** | Single unaveraged training checkpoint (no merging / soup / SWA / EMA) | | |
| | **Weights SHA-256** | `457f89e1606e066b70e9e0f4724a4a588c17a041acc3839da0334f2eed923fa2` | | |
| | **License** | MIT | | |
| **Architecture Attribution:** The custom attention/Peri-LN/Canon modeling code is adapted from [Ethoric-10M](https://huggingface.co/techdotus/Ethoric-10M) (MIT License). On top of that foundation, PyraLM-10M introduces an 18-layer pyramid-tapered FFN allocation (`12L uniform 721` โ `18L tapered [624..232]`), a custom `5,120`-vocab BPE tokenizer, and an independent 20B pretraining + non-benchmark post-training pipeline trained completely from scratch. | |
| --- | |
| ## Evaluation Results | |
| > **Officially verified on 2026-12-05.** Official scores: [Open SLM Leaderboard](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard) / [submission #359](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard/discussions/359). The Intelligence Index below uses the current ArithMark-4 formula only. | |
| Our original public-benchmark evaluation covered `16,428` items and was independently repeated with identical per-item predictions; its arithmetic task is ArithMark-3. ArithMark-4 is a separate held-out evaluation run by the leaderboard team, with official results reported below. | |
| | Model | Params | **Official Int Index (AM4)** | HellaSwag (`acc_norm`) | ARC-Easy (`acc_norm`) | ARC-Challenge (`acc_norm`) | PIQA (`acc_norm`) | **Official ArithMark-4** | ArithMark-3 (`acc_norm`) | | |
| |---|---:|---:|---:|---:|---:|---:|---:|---| | |
| | **PyraLM-10M (this release, seed 31)** | **9.99M** | **9.59** | **28.44** | **40.36** | **24.15** | **58.32** | **30.06%** | **57.90% official / 58.00% local** | | |
| | *PyraLM-10M (local 3-seed Stage 2 mean, s19/s23/s31; same 20B base)* | *9.99M* | โ | *28.46* | *40.43* | *24.03* | *58.63* | โ | *56.97% local* | | |
| | Ethoric-10M (upstream reference, official leaderboard) | 9.97M | 9.51 | 28.75 | 37.58 | 24.66 | 59.85 | 27.81% | 41.60% official | | |
| *Multi-seed note:* The three independent Stage 2 seeds start from the same 20B pretrained base. Their individual-benchmark means above are local results; the official AM4 score applies only to the released seed-31 checkpoint. | |
| ### 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. | |
|  | |
| | 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 & Contamination Control | |
| 1. **Stage 1 โ Pretraining from Scratch (`20.0B` tokens):** | |
| - Trained from random initialization (`15.4B` main stage + `4.6B` annealing stage) on open English web, encyclopedia, textbook, and math corpora (`FineWeb-Edu`, `Cosmopedia-v2`, `TxT360-v2`, `DCLM-Baseline`, `FineMath-4plus`, `FineWiki`, `Tiny-Strange-Textbooks`, `OpenMathInstruct-2`, `FinePhrase`, `Orca-Math`, `QA-Commonsense`). | |
| - All pretraining documents were filtered with a frozen Aho-Corasick lexical filter to **remove matches against the train, validation, and test splits of all five official leaderboard benchmarks** (`HellaSwag`, `ARC-Easy`, `ARC-Challenge`, `PIQA`, `ArithMark-3.0`). | |
| 2. **Stage 2 โ Post-Training on Non-Benchmark QA & Math (`112,644` examples, `2,081` steps):** | |
| - Single-trajectory post-training starting from the final `20.0B` checkpoint (`lr = 5e-5`, global batch `128`, no EMA/SWA/weight merging). | |
| - Composed strictly of non-leaderboard public QA/math training sets (`SocialIQA`, `CommonsenseQA`, `SciQ`, `QASC`, `GSM8K`, `Orca-Math`, `ASDiv`, `SVAMP`) plus `24,000` programmatically verified abstract symbolic & quantitative arithmetic exercises (no ArithMark names, objects, or story templates). | |
| - **None of the train, validation, or test splits of HellaSwag, ARC-Easy, ARC-Challenge, PIQA, or ArithMark-3.0 were used** (`0` hits under the frozen lexical guard). | |
| 3. **Note on Public Web Data:** | |
| - Automated lexical filtering was applied across both stages to exclude all splits of the five official benchmarks. As with any model trained on large public web corpora, text-level filtering cannot completely rule out occasional paraphrased or near-duplicate web passages. | |
| --- | |
| ## Usage | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| repo_id = "Lazyshu/PyraLM-10M" | |
| tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| repo_id, | |
| trust_remote_code=True, | |
| dtype=torch.float32, | |
| ).eval() | |
| inputs = tokenizer("78 + 27 =", return_tensors="pt") | |
| with torch.inference_mode(): | |
| out = model.generate(**inputs, max_new_tokens=16) | |
| print(tokenizer.decode(out[0], skip_special_tokens=True)) | |
| # 78 + 27 = 105 | |
| ``` | |
| - `generate()` reads `eos_token_id` (`1`) and `pad_token_id` (`0`) automatically from `generation_config.json` / `config.json`, supports greedy and `top_k` sampling, and supports batched generation with `tokenizer.padding_side = "left"`. | |
| - `forward(..., labels=...)` follows standard Hugging Face causal LM next-token shift semantics (`logits[:, :-1]` vs `labels[:, 1:]`, `ignore_index=-100`). | |
| ### Public-task reproduction (four tasks + ArithMark-3) | |
| Evaluate in FP32 with `add_bos_token=False` and context length `512`: | |
| ```bash | |
| # HellaSwag, ARC-Easy, ARC-Challenge, PIQA via lm-evaluation-harness | |
| lm_eval --model hf \ | |
| --model_args pretrained=Lazyshu/PyraLM-10M,trust_remote_code=True,dtype=float32,add_bos_token=False,max_length=512 \ | |
| --tasks hellaswag,arc_easy,arc_challenge,piqa \ | |
| --num_fewshot 0 --batch_size auto | |
| # ArithMark-3.0 via the official script from AxiomicLabs/Arithmark-3.0 | |
| # (verified against commit 6f6e59dd9b7e2c63455f7af7f838f9ecc3d0a746; remote code is trusted by default) | |
| python bencharithmark-3.py \ | |
| --model Lazyshu/PyraLM-10M \ | |
| --dtype float32 --max-context 512 --save-predictions | |
| ``` | |
| **Verified local environment:** `Python 3.12.12`, `torch 2.12.0.dev20260220+cu126`, `transformers 4.57.1`, `safetensors 0.6.2`, `tokenizers 0.22.1`, `lm-eval 0.4.13`, `AxiomicLabs/Arithmark-3.0` (`6f6e59dd9b7e2c63455f7af7f838f9ecc3d0a746`). | |
| --- | |
| ## Limitations | |
| - **Ultra-small capacity (`9.99M` parameters):** Intended as a research small language model for studying architecture efficiency, tokenization, and small-scale reasoning; not a general-purpose assistant. | |
| - **Short context (`512` tokens):** RoPE and training context are fixed at `512` tokens. | |
| - **English only & unaligned:** Trained on English data without safety/chat alignment. | |
| - **Custom `generate()` subset:** Supports greedy decoding and `do_sample` / `temperature` / `top_k` with unpadded or left-padded inputs; unsupported generation kwargs raise `ValueError` explicitly. | |
| --- | |
| ## License & Acknowledgments | |
| Released under the **MIT License**. | |
| - Special thanks to the **[PyTRIO](https://pytrio.com/home)** team for providing the compute resources for training. | |
| - We gratefully acknowledge the [Ethoric-10M](https://huggingface.co/techdotus/Ethoric-10M) authors (Tech.us Team) for releasing their clean MIT-licensed attention/Peri-LN/Canon implementation. | |
| - Thanks to [AxiomicLabs](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard) for maintaining the Open SLM Leaderboard and ArithMark-3.0. | |