ZhenLM 140M — SFT v2e
A from-scratch Chinese–English decoder-only language model: 137,847,552 parameters, 3B-token pre-training, 250M-token SFT, trained on a single RTX 5070 Ti 16 GB GPU. This is a learning/research artifact, not a production model and not a competitor to modern open models.
Naming: ZhenLM (真) means true/honest. "140M" is the family label; the
exact parameter count is 137,847,552. This card covers the SFT v2e
variant. The repository is the pretrain-lab project.
Model details
| Item | Value |
|---|---|
| Architecture | decoder-only Transformer: RoPE + RMSNorm (pre-norm) + SwiGLU + tied embeddings |
| Parameters | 137,847,552 (d_model 768, 16 layers, 12 heads, head_dim 64) |
| FFN hidden | 2048 (8/3·d, multiple_of 64) |
| Vocabulary / context | 32,000 BPE (ByteLevel); specials `< |
| Pre-training | 3,000,000,000 tokens (FineWeb-Edu 60% + minimind pretrain_t2t 40%); val loss 2.7709 |
| SFT | sft-mix-v2e, 250,001,408 tokens, assistant-only mask, 25% pre-training mix; val 1.6065 |
| Deployment | Q8_0 GGUF (174 MB); F16 (326 MB) optional; Q4_K_M is not faithful |
| Chat template | `< |
Intended use
- Local learning demo, bilingual chit-chat, simple explanations, short code, format-following ("answer with a single number"), and a handful of translation instruction patterns.
- Not intended: factual QA, arithmetic, reasoning, production decisions, medical/legal advice, safety-critical use, or any task requiring reliable knowledge.
Training data
- English: FineWeb-Edu
sample-10BT(ODC-BY 1.0, subject to Common Crawl ToU). - Chinese: minimind_dataset
pretrain_t2t/sft_t2t_mini(Apache-2.0). - Synthetic SFT samples generated by this repository (calibration, format,
helpfulness, conciseness, translation instruction pairs). The raw corpora
are not redistributed; see
NOTICE.
Evaluation
Greedy decoding, same chat template, same tokenizer. The dev set is for iteration; the 90-question holdout is for acceptance. Manual scores are per-question binary judgments.
| Model | Dev 18 | Holdout 90 (manual) | rep-4 ↓ |
|---|---|---|---|
| base | 6/18 | 12/90 | 0.738 |
| SFT v1 | 16/18 | 47/90 | 0.248 |
| SFT v2 | 15/18 | 47/90 | 0.168 |
| SFT v2e (this model) | 17/18* | 53/90 | 0.138 |
| LoRA r12 2ep | 15/18 | 48/90 | 0.283 |
* Two known dev residues (fact-months, math-add); clean subset 15/16.
A 2026-11-22 second review of a 47-question subset did not reproduce the v2e advantage: 11 vs 11 (kappa 0.660/0.453; paired p=1.000). The +6/+7 is threshold-met under the original labels but rubric-sensitive. See the evaluation doc §6.1.
Capability blocks (14 math / 14 translation / 6 calibration):
- Math: 0–3/14 ✗ — a narrow lookup table, not arithmetic.
- Translation: 0–5/14 ✗ — sentence-pattern level; zh→en simple sentences work, en→zh mostly fails.
- Calibration: 5–6/6 under the original lenient labels; 1–3/6 under a strict second review — ⚠️ the model refuses to invent, but its premise corrections are often factually wrong (2044/2046 are event years).
v2e vs v2: audit +6/90 (53 vs 47); a 2026-11-21 per-item re-judgment is +7/90 (52 vs 45), both meeting the pre-registered threshold (≥5) under the original labels. The paired McNemar exact test is p = 0.0923, and the bootstrap 95% CI [0.000, 0.156] includes 0 → not statistically significant at 0.05.
A 2026-11-22 second review of a 47-question subset did not reproduce the advantage: v2e 11 vs v2 11 (0/47; Cohen's kappa 0.660/0.453; paired McNemar p=1.000). Even lenient re-adjudication gives at most +2. The +6/+7 is therefore rubric-sensitive and not a robust capability improvement; do not read it as "v2e is better". The earlier 30-question "no difference" was underpowered.
Limitations
- Knowledge: 3B tokens / 140M parameters ≈ GPT-2-level; it will hallucinate names, dates, and details. Do not use as a knowledge source.
- Math: memorized a few dev answers; unseen combinations are wrong
(
13×5,17+6,100−37). The dev8/42are memory + lookup, not arithmetic. - Translation: only trained instruction patterns;
Knowledge is poweroften returns in English;今天非常冷is translated as "hot" by all versions (prior override). - Repetition: v2e has the lowest rep-4 in the family (0.055 on dev), but long English answers can still repeat.
- Identity: the SFT corpus comes from minimind; the model often identifies as "minimind" even with greedy decoding. Treat its self-description as unreliable. The demo defaults to T=0.3.
- Context: 1024 tokens; longer inputs are truncated.
- Safety: no safety tuning, no RLHF, no bias evaluation.
- Label sensitivity: the holdout +6/+7 is threshold-met under the original labels but not robust to a stricter second review (v2e 11 vs v2 11; kappa 0.660/0.453). Do not quote the +7 as a settled capability win.
How to use
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
repo = "lynxpurr/ZhenLM-140M-SFT-v2e"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.float16)
model.eval()
messages = [{"role": "user", "content": "请用一句话介绍杭州。"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=80, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Evaluation checkpoint
last.pt is included in the release for the project's tools/eval.py and
scripts/reproduce_eval.sh. Most users should use the safetensors weights
above; last.pt is only needed to reproduce the evaluation tables.
Ollama / GGUF
OLLAMA_HOST=127.0.0.1:11435 ollama create zhenlm-140m-sft-v2e-q8 \
-f Modelfile-ZhenLM-140M-SFT-v2e-q8
ollama run zhenlm-140m-sft-v2e-q8
Quantization
| Format | Size | Status |
|---|---|---|
| F16 GGUF | 326 MB | faithful (5/5 spot check) |
| Q8_0 GGUF | 174 MB | deployment default; preserves new behavior |
| Q4_K_M GGUF | 103 MB | not faithful (math 42→72, translation reverts) |
Released files
| File | Size | SHA256 (prefix) |
|---|---|---|
model.safetensors (fp16, tied) |
262.9 MiB | 7d1c2f0c4657c2a2 |
ZhenLM-140M-SFT-v2e-Q8_0.gguf |
174 MB | 8b64b66898eef9f5 |
ZhenLM-140M-SFT-v2e-f16.gguf |
326 MB | eee108223b9c0278 |
last.pt (training checkpoint) |
1.6 GB | 984a25c4d59e36a4 |
The HF export omits the duplicate lm_head.weight (--tie-embeddings), so
the loaded model has exactly 137,847,552 parameters. Greedy output matches
the PyTorch checkpoint 30/30 tokens; the Q8 GGUF matches the deployed
Ollama tag verbatim. See the export report.
last.pt is the training checkpoint used by eval.py; it is not needed for
transformers or Ollama inference.
License
- Code and model weights: Apache-2.0 (see
LICENSE). - Documentation and evaluation sets: CC BY 4.0 (see docs/LICENSE-CC-BY-4.0.txt and data/LICENSE).
- Upstream data licenses apply; see
NOTICEand data/LICENSE. - The model may reproduce or paraphrase training data; outputs are the user's responsibility.
Citation
@misc{zhenlm2026,
title = {ZhenLM: a 140M bilingual language model trained from scratch on one 16GB GPU},
author = {lynxpurr},
year = {2026},
url = {https://github.com/lynxpurr/pretrain-lab},
note = {Apache-2.0; learning/research artifact}
}
Acknowledgements
Architecture/data-format ideas from minimind (Apache-2.0) and nanoGPT (MIT); GGUF layout conventions from llama.cpp (MIT); data from FineWeb-Edu and minimind_dataset.