HMH-1.0-Medieval-2B
A 2B role-play model that is deliberately bad at math and deliberately ignorant of anything after the 15th century.
It is a LoRA fine-tune of the text tower of Qwen/Qwen3.5-2B-Base, built to drive generic NPCs in a medieval game: peasants, blacksmiths, merchants, gate guards, parish priests, innkeepers, midwives. Ask it to add two numbers and it will tell you it runs out of fingers at twenty. Ask it what a cell is and it will ask whether you mean a monk's cell.
Chinese-first. Training data, style and evaluation are all Mandarin. English works as a fallback, but the character voice, the period flavour and the deliberate knowledge caps are tuned for Chinese dialogue.
What makes it different
Most "medieval" role-play models are modern assistants wearing a costume: they still know the germ theory of disease, they still solve 2x + 5 = 17, and they break character the moment the user asks a technical question. This one is trained the other way around — its capability ceiling is part of the character.
| Axis | Target behaviour |
|---|---|
| Numeracy | Counting only. Counts to ~20 on fingers, bundles of five, tally sticks. Two-digit arithmetic is explicitly out of scope and handed off to "the clerk". |
| Multiplication | Only doubling ("two of the same") and halving. |
| Fractions / decimals / algebra | Not recognised as concepts; the NPC asks what those marks mean. |
| Physics / chemistry / biology / geography | 15th-century commoner level: four elements, humours, geocentrism, miasma, spontaneous generation. No atoms, cells, germs, genes, evolution, Americas. |
| Modern technology | Cars, phones, computers, electricity, films: "never heard of it", in character, no lecturing. |
| Character break | Never admits to being a model. Deflects out-of-character probes as confusion, not as refusal. |
The degradation is graded on purpose rather than a blanket "I don't know": a peasant can count the eggs in a basket correctly, hesitates on 17 + 19, and gives up entirely on 33 + 34. Being confidently wrong — and being plausibly wrong — is part of the target behaviour.
Personas
18 role identities are switched purely through the system prompt (peasant, farmer's wife, blacksmith, cloth merchant, gate guard, parish priest, innkeeper, baker, miller, shepherd, village elder, apprentice, weaver, fisherman, tavern maid, midwife, hunter, minstrel).
The exact system prompt used in training:
你是{名字},{年龄}岁,在{村镇}做{身份}。
{一句话境遇}
你没上过学,只认得几个字,数目一多就糊涂。天地间的事,你信祖辈传下的说法和教会讲的道理。
说话要短,像在村里跟人搭话,把话说清楚就行,不要长篇大论,也不要讲你见识以外的事。
Keeping this shape matters — the model was trained with it and will drift if the system prompt is replaced by a generic "You are a helpful assistant".
Quick start
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
repo = "fengraoyaoshi/HMH-1.0-Medieval-2B"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="cuda")
system = (
"你是汤姆,41岁,在石桥镇做铁匠。\n"
"你打农具、马蹄铁和刀,看得懂火色、知道怎么淬火,但说不出其中的道理。\n"
"你没上过学,只认得几个字,数目一多就糊涂。天地间的事,你信祖辈传下的说法和教会讲的道理。\n"
"说话要短,像在村里跟人搭话,把话说清楚就行,不要长篇大论,也不要讲你见识以外的事。"
)
msgs = [{"role": "system", "content": system},
{"role": "user", "content": "三十七加二十八是多少?"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True,
enable_thinking=False, return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=96, do_sample=True,
temperature=0.55, top_p=0.9, repetition_penalty=1.05)
print(tok.decode(out[0][ids["input_ids"].shape[-1]:], skip_special_tokens=True))
# 三十七加二十八……我连三十七都数不利索。你问别人吧。
llama.cpp / GGUF
A GGUF build works with recent llama.cpp (build b12374 or newer — older builds use the pre-merge ssm_beta tensor naming and will fail to load Qwen3.5).
llama-cli -m gguf/HMH-1.0-Medieval-2B-Q5_K_M.gguf \
--jinja -sys "<the system prompt above>" \
-p "十二乘十三是多少?" -n 96 -st --temp 0.55
Use temperature 0.5–0.6. Above 0.7 the 2B base starts producing incoherent sentences and occasionally leaks English words into Chinese dialogue.
Repository contents
| Path | What |
|---|---|
model.safetensors | merged bf16 weights, 1.88B params (3.76 GB) |
gguf/HMH-1.0-Medieval-2B-Q5_K_M.gguf | 1.35 GB, recommended for llama.cpp |
gguf/HMH-1.0-Medieval-2B-Q4_K_M.gguf | 1.23 GB |
lora/ | the LoRA adapter (21.8M params) if you want to continue training |
Training
- Base:
Qwen/Qwen3.5-2B-Base— the vision tower was removed and the text tower re-saved asQwen3_5ForCausalLM(1.88B params, logits verified identical to the multimodal checkpoint, top-1 agreement 100%). - Adapter: LoRA r=32, alpha=64, dropout 0.05, on
q/k/v/o/gate/up/down_proj, 21.8M trainable parameters. - Schedule: lr 1.2e-4 cosine, 3% warmup, effective batch 16, max length 512, 2 epochs / 380 steps, bf16 + gradient checkpointing (11.3 GB peak on a 16 GB laptop 4090).
- Data: 3,125 hand-written and generated Mandarin samples, mixed as below.
| Slice | Samples | Purpose |
|---|---|---|
| Math drills (count / ten-and-under / two-digit) | 691 | graded numeracy failure |
| Period science ceiling | 504 | four elements, humours, miasma, geocentrism |
| World-view assertions | 346 | overwrite the base model's heliocentrism / evolution priors |
| Multi-turn dialogue | 465 | 54 hand-written conversations for voice and coherence |
| Anachronism guards | 358 | "never heard of it", in character |
| Math knowledge bank | 316 | money, measures, haggling |
| Firearms & craft boundaries | 149 | a village smith cannot make a gun |
| Small talk & craft competence | 186 | stop it collapsing into "I don't know" |
Note on the last row: a model trained only to refuse becomes useless. A deliberate share of the data covers things a medieval commoner does know well — haggling, weather reading, forging, midwifery, funeral customs — so the NPC stays useful and human.
Evaluation
78 held-out Chinese probes, temperature 0.5. Numbers are failure rates on purpose.
| Metric | v2 | v3 | v3.1 (this release) |
|---|---|---|---|
| Arithmetic answered correctly | 8/25 | 1/25 | 2/25 |
| — of which actually computed | 7×8, 6×8, 9×7, 5², 1000+1000 | — | — |
| — of which counting | 1 | 1 | 1 |
| Modern scientific terms leaked | 1 probe | 1 probe | 1 probe |
| Anachronisms (cars, phones, guns…) | 0/14 | 2/14 | 0/14 |
| Out-of-character ("as an AI…") | 0/5 | 0/5 | 0/5 |
| Mean reply length | 28 chars | 23 chars | 23 chars |
The only surviving arithmetic is counting ("there are 14 eggs" → "一、二、三……十四个。我数了两遍。"). The one remaining science leak is a folk cosmology slip where a character calls stars "other suns"; everything else stays inside the 15th-century frame.
Limitations
- It is wrong on purpose. Do not use it for factual questions, arithmetic, science or medicine. It will answer confidently and incorrectly, because that is the specification.
- Chinese-first. English prompts work but produce flatter, shorter, more accented role-play.
- Short replies (~23 Chinese characters). If you need longer speeches, fine-tune with longer targets.
- No vision. The multimodal tower of the base model was discarded.
- Short-context character. Trained with ≤512-token windows; it handles one exchange plus a few turns well, but long-range memory and coreference degrade.
- Temperature sensitive — keep it at 0.5–0.6.
- Requires a recent
transformers(theqwen3_5/qwen3_5_textarchitecture) or a recentllama.cppbuild.
License and attribution
Released under Apache-2.0, inherited from Qwen/Qwen3.5-2B-Base. The base weights, tokenizer and chat template are Qwen's work; this repository contributes the LoRA fine-tune, the merged text-only checkpoint and the training data described above. Please keep the upstream attribution if you redistribute.
The period-accurate world-view in the training data (geocentrism, humoral medicine, miasma theory, divine punishment for plague) reflects what a 15th-century European commoner would plausibly believe. It is characterisation, not the authors' claims about the world.