LiquidAI/LFM3-1.7B with its vocabulary cut down to Thai and English. No training: the tokens that can only ever spell other scripts were removed, the tokenizer and embedding were renumbered, and every other weight is untouched. Made and checked with model-surgery, a local tool for training-free edits that measures each change against the model it came from.
| LiquidAI/LFM3-1.7B | this model | |
|---|---|---|
| Vocabulary | 128,000 | 94,816 |
| Parameters | 100% | −3.9% (−130 MB in BF16) |
| Thai / English text | tokenized identically, same predictions | |
| Japanese, Chinese, Korean, Arabic, Cyrillic, Hindi … | yes | not supported (see Limitations) |
| File | Size | Use |
|---|---|---|
model.safetensors (+ config, tokenizer, *.py) |
3.2 GB | transformers, BF16 |
LFM3-1.7B-th-en-Q4_K_M-imat.gguf |
994 MB | llama.cpp, 4-bit with an importance matrix |
The cut changes nothing for Thai and English. On 8,000 characters each of Thai and English text the cut model tokenizes exactly as the original, its hidden states are identical (largest difference 0.0) and its top-1 prediction agrees on every token; perplexity over the kept vocabulary matches to 1e-6.
The 4-bit GGUF keeps Thai. Quantizing LFM3 to Q4_K_M the usual way costs Thai a lot; computing an importance matrix on Thai and English text first (and checking on other documents) removes most of it:
| GGUF | Size | Thai perplexity vs BF16 | 2,000 Thai questions (MMLU-ProX dev) vs BF16 |
|---|---|---|---|
| Q4_K_M | 994 MB | +11.8% | worse: +62 / −103, p 0.0018 |
| Q4_K_M + imatrix (this file) | 994 MB | +1.3% | no reliable difference: +63 / −74, p 0.39 |
| BF16 GGUF vs transformers | 3.2 GB | +0.3% | 21 of 2,000 answers differ (+13 / −8) |
"+R / −W" counts the questions one file gets right and the other wrong (paired sign test).
Side by side with the original (both as Q8_0 GGUF, same settings, same questions):
| Questions | this model | original | +R / −W | reading |
|---|---|---|---|---|
| 2,000 Thai multiple choice (MMLU-ProX dev, chance 10%) | 24.1% | 24.2% | +8 / −10, p 0.81 | no reliable difference |
| GSM8K, 200 written maths answers | 93% | 92% | +3 / −1 | no reliable difference |
| MGSM-Thai, 100 written maths answers | 78% | 81% | +2 / −5 | no reliable difference |
| Tool calls, English / Thai | 15/15, 12/15 | 15/15, 12/15 | +0 / −0 | same |
| Tool calls, Japanese | 2/15 | 14/15 | +1 / −13 | worse: the removed script |
| All of the above without Japanese | +5 / −6, p 1.0 | no reliable difference |
Written answers use thinking on, 4,096 tokens, greedy. Over all items including Japanese the verdict is worse (+6 / −19, p 0.015), and that difference is entirely the 15 Japanese requests. For Thai and English this model answers as the original does: it is smaller, not smarter.
Give maths room to think, and close the thinking before the limit. 4,096 tokens beat 2,048 on the same items (+21 / −3). On held-out test items (MGSM-Thai 150, GSM8K 300) closing the thinking at 3,840 tokens and letting the model answer, instead of cutting it off at 4,096, scored better: MGSM-Thai 79% → 85%, GSM8K 94% → 95%, +14 / −2, p 0.034 after correcting for every test-set comparison made on this model. With plain generation 33 of 450 answers ran out of tokens while still thinking.
System prompts did not change accuracy (MGSM-Thai and tool calls, dev): "ตอบเป็นภาษาไทยเสมอ" raised Thai replies from 85 to 91 of 100; "Always answer in the user's language." lowered them to 67. Neither changed the score reliably (7 / 7 and 5 / 10, p ≥ 0.30).
add_bos_token = false (as converted from the original). The chat template writes the BOS
token itself, so chat is fine; raw completion without the template predicts Thai far worse (llama.cpp
perplexity 158.8 without BOS, 32.6 with it).transformers (the LFM3 architecture code ships with the model):
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "zazeen123/LFM3-1.7B-Mew-Surgery"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype="bfloat16")
inputs = tok.apply_chat_template([{"role": "user", "content": "เมืองหลวงของประเทศไทยคืออะไร"}],
add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**inputs, max_new_tokens=1024)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
llama.cpp needs a build recent enough to know the lfm3 architecture:
llama-server -m LFM3-1.7B-th-en-Q4_K_M-imat.gguf --jinja -c 8192
Same terms as the base model: LFM Open License v1.0 (LICENSE in this repository).
ภาษาไทย: LFM3-1.7B ที่ตัด vocab เหลือเฉพาะไทยและอังกฤษ ไม่ได้เทรนเพิ่ม พารามิเตอร์ลดลง 3.9% ข้อความไทยและอังกฤษให้ผลเหมือนต้นฉบับทุก token ไฟล์ GGUF 4-bit (994 MB) quantize ด้วย importance matrix จากข้อความไทย ตอบข้อสอบไทย 2,000 ข้อไม่ต่างจาก BF16 ใช้กับภาษาอื่น (ญี่ปุ่น จีน ฯลฯ) ไม่ได้ เทียบกับต้นฉบับแบบข้อต่อข้อแล้ว ข้อสอบไทย 2,000 ข้อ คณิตศาสตร์ และ tool call ภาษาไทย/อังกฤษ ไม่ต่างกัน แย่ลงเฉพาะคำขอภาษาญี่ปุ่น เล็กลง ไม่ได้ฉลาดขึ้น โจทย์คณิตควรให้คิดได้ 4,096 token และปิดการคิดที่ 3,840 token (ชุดทดสอบ: MGSM-Thai 79% → 85%)
LiquidAI/LFM3-1.7B