The LoRA Didn't Close the Glossary Gap. The Repair Pass Did.
Hy-MT3-1.8B: a 200-example LoRA gained 6.7 glossary points, not significant. A 30B repair pass reached 96.7%. The 30B kept the best COMET.

Table of contents
The 1.8B followed the 12-term Arabic glossary 60.0% of the time. The 30B followed it 86.7%. That is a 26.7-point gap.
I trained a 9.7M-parameter LoRA on 200 term-context examples to see whether the small model could close it. The adapter gained 6.7 points. The paired confidence interval crossed zero, so the gain is not statistically significant. A checker-driven 30B repair pass reached 96.7%, but lost COMET. The 30B direct kept the best COMET.
Here is the full runbook, the data, and the decision table.
The benchmark pack has the 200/20 data, the adapter, all four arms, the leakage gate and every script. The zip is self-contained.
The end goal in one picture

| Arm | Glossary | COMET-Kiwi |
|---|---|---|
| 1.8B Q8 base | 60.0% | 0.7621 |
| 1.8B bf16 + LoRA | 66.7% | 0.7593 |
| 1.8B Q8 + repair | 96.7% | 0.7541 |
| 30B direct | 86.7% | 0.7863 |
Latency and memory: base 1.2 s / 1.9 GB, LoRA 9.7 s / 3.6 GB, repair 1.8 s / 32.9 GB, 30B 2.3 s / 32.9 GB. The decision image below keeps all six columns.
The table is term-weighted: 54 of 90 required terms for the base, 60 for the LoRA, 87 for repair and 78 for the 30B. The forest plot later uses per-paragraph averages, so its point estimates differ slightly. Both answer valid questions. Do not mix them.
The result is not "the LoRA won." It is a constraint problem:
- Glossary compliance: repair wins.
- Raw quality: 30B direct wins.
- Memory: 1.8B base wins.
- Latency: 1.8B Q8 base wins, and the 30B beats the Transformers LoRA path.
The runbook

| Step | Checkpoint | Observed |
|---|---|---|
| 1. Hold out the test | 20 paragraphs, 3 runs | base 60.0% strict |
| 2. Generate term-context data | 25 per term | 300 candidates |
| 3. Teacher + strict filter | at least 200 keepers | 293 of 300 |
| 4. Leakage gate | zero leaks | 0 |
| 5. Train the adapter | 300 steps | 155 s, loss 0.027 |
| 6. Evaluate on unseen text | glossary and COMET | LoRA 66.7% |
| 7. Compare alternatives | repair vs 30B | repair 96.7%, 30B COMET 0.7863 |
Every stage has a pass condition. If a stage fails, the next one does not run.
Step 1: Define the deployment case
Hy-MT3-1.8B is the small member of Tencent's translation family: 1.8B parameters, a 1.9 GB Q8 file and a 1.35 GB Q4 file1. Hy-MT3-30B-A3B is the 31 GB mixture-of-experts model2. The 30B is the glossary specialist. The 1.8B is the model that fits on a small machine.
The glossary has 12 fixed terms:
AI agent, agentic AI, large language model, tool use, agent harness, orchestration, prompt injection, sandbox, guardrail, evaluation, observability, human in the loop.
The deployment case is a team with that fixed glossary, Arabic output, and a machine that cannot hold the 30B. The test set is 20 unseen paragraphs from the Wikipedia article on AI agents. The adapter is allowed to see the 12 terms during training. It is not allowed to see the 20 test paragraphs. That is the boundary: seen terms, unseen sentences.
Step 2: Hold out the test and measure the base
The base 1.8B Q8 scored 60.0% strict, 93.3% lenient, COMET 0.7621, 1.2 s median, 1.9 GB. The bf16 base scored the same 60.0% strict, which lets the LoRA comparison use the same Transformers runtime. The 30B direct scored 86.7% strict and COMET 0.7863.
The strict checker accepts definite and indefinite forms of the Arabic term. It does not accept plurals or synonyms. The lenient score uses the optional regex patterns in the glossary. The gap is mostly terminology discipline, not a missing translation.
A useful surprise: on this 96 GB Mac Studio, the 30B direct is faster than the 1.8B in Transformers bf16, 2.3 s versus 6.1 s. The 1.8B Q8 is faster still at 1.2 s. The small model's case is memory, not speed.
Checkpoint: reproduce 60.0% on the base. If not, the test or the prompt changed.
Step 3: Build 300 term-context examples
I used synthetic term-context sentences instead of training articles. The reason is practical: the fixed glossary has 12 terms, most articles cover only a few, and using the evaluation article would leak. Synthetic sentences guarantee 25 examples per term, are license-clean, and make the recipe reproducible.
The generator is Qwen3.8-27B. The prompt is in the pack. It asked for 25 natural sentences per term, with varied subjects and contexts. The generator produced 889 candidates. I capped the pool at 25 per term for 300.


Checkpoint: 300 candidates and every term represented. The exact 300-row pool is in the pack.
Step 4: Filter with the 30B teacher
The 30B translated every candidate with the glossary in the prompt. I kept only outputs that passed the strict checker for every term present in the source. That removed 7 of 300: 293 keepers, a 97.7% teacher pass rate.
The final split is 200 training examples and 20 validation examples. Every term appears in training. The primary-term counts range from 13 to 21 because the split is stratified, not exactly 25 each. The other 73 keepers were left unused.
Three examples from the training set:
| Source | 30B target |
|---|---|
| The development team integrated the AI agent into their workflow to automate repetitive data entry tasks. | دمج فريق التطوير وكيل ذكاء اصطناعي في سير عملهم لأتمتة مهام إدخال البيانات المتكررة. |
| The agent harness records every tool call for observability. | يسجل إطار تشغيل الوكيل كل استدعاء أداة لأغراض قابلية المراقبة. |
| A guardrail blocks a forbidden tool call before the sandbox executes it. | يحجب ضابط حماية استدعاء أداة محظوراً قبل أن تنفذه بيئة معزولة. |
The filter matters. If the teacher misses a term, the student learns the miss. A 97.7% pass rate means the targets are mostly clean, but it is not a guarantee. The pack includes every rejected row.
Checkpoint: at least 200 strict-passing examples. If not, generate more.
Step 5: Gate leakage before training
The 20 eval paragraphs and their existing 30B, 1.8B and bf16 outputs are hashed. The gate checks training sources and targets against:
- 84 eval texts
- 213 sentence hashes
- 4,972 twelve-word shingles
It fails on an exact paragraph, an exact sentence, any shared 12-word shingle, or 8-word containment of 0.20 or more.
The controls:
| Control | Result |
|---|---|
| Clean unrelated sentences | pass |
| Clean glossary-term sentences | pass |
| Exact eval paragraph | fail |
| Every sentence rewritten | fail, 32 shared 12-grams |
| Copied 30B output | fail |
| Copied bf16 baseline output | fail |
The gate runs inside train_lora.py as a hard precondition. A clean file trains. A leaked file exits 1 before the model loads and writes no adapter. Training cannot skip the gate.
Checkpoint: zero leaks in train and validation. No exceptions.
Step 6: Train the adapter
The adapter is LoRA rank 8 on q, k, v, o, gate, up and down projections: 9,699,328 trainable parameters, 0.539% of the model3. It is implemented with PEFT4. Training used 200 examples, batch size 2, three epochs, 300 steps, on MPS.
It took 155 seconds. Peak MPS memory was about 4 GB. The final loss was 0.027. The adapter is 37 MB.

This is a small training run. The speed is secondary. What matters is that the data was gated, the base was measured in the same runtime, and the adapter was evaluated on text it never saw.
Checkpoint: loss falls, adapter saves, gate passed. Do not evaluate on the training rows.
Step 7: Evaluate on unseen paragraphs
The LoRA scored 66.7% strict, 60 of 90 required terms. The raw gain over the 60.0% base is 6.7 points. The paired per-paragraph gain is 6.8 points, with a 95% interval from -5.8 to +21.0 and p = 0.307.
COMET-Kiwi5 moved from 0.7621 to 0.7593, a difference of -0.0028 (p = 0.606). There is no evidence of a quality gain or a quality loss.

The interval is the result. A 20-paragraph test cannot distinguish a 6.7-point gain from zero. Reporting the point estimate as a win would be wrong.
The per-term view explains the noise:

The arrow points from base to LoRA. Red is a regression. The large language model row moves left because the adapter made that term worse; it is not a reversed axis.
The adapter learned agent harness completely, moved AI agent from 53% to 65%, and regressed large language model from 67% to 33%. The last row is a warning about small per-term samples, not a victory. Three terms in the glossary, prompt injection, guardrail and observability, were trained but do not appear in the 20 eval paragraphs. They were not measured.
Checkpoint: report the interval, not only the point estimate. A +6.7 point result with a CI that crosses zero is not a green light.
Step 8: Compare the no-training alternatives
The repair arm uses the fast 1.8B Q8 draft. A strict checker finds missing terms. If the draft is clean, it is kept. If a term is missing, the 30B rewrites the paragraph with the source, the draft and the glossary.

The repair arm scored 96.7% strict, 87 of 90 terms. That is 36.7 raw points over the base and +39.5 paired points (p < 0.001). It repaired 30 of 60 outputs and kept 30. COMET fell from 0.7621 to 0.7541, a significant -0.0080 (p = 0.004). Median latency was 1.8 s, but the arm needs the 30B and 32.9 GB of memory.
The 30B direct scored 86.7% and COMET 0.7863, the best raw quality. The repair pass beats it on glossary because the checker and prompt enforce every term. The repair pass loses COMET because a rewrite can flatten the prose.

Decision table


| Constraint | Pick | Why |
|---|---|---|
| ≤ 8 GB memory, no 30B | 1.8B Q8 base | 60.0%, 1.2 s, 1.9 GB. The fastest and smallest |
| 32 GB+, raw quality first | 30B direct | 0.7863 COMET and 86.7% glossary, no training |
| 32 GB+, glossary is critical | 1.8B Q8 + repair | 96.7% glossary, 1.8 s median, but COMET 0.7541 |
| Want a one-time adapter | 1.8B bf16 + LoRA | +6.7 points, not significant. 9.7 s in Transformers |
No single arm wins every column. The repair arm is the glossary champion. The 30B direct is the quality champion. The base 1.8B is the memory and latency champion. The LoRA is a small, uncertain improvement that is slower than every alternative in the runtime I measured.
What I would ship
If the 30B fits on the machine, I would use the 30B direct for general translation and add the repair pass only when glossary compliance is a hard requirement and the COMET loss is acceptable. That is the practical glossary fix in this test.
If the machine has 8 GB or less, I would ship the 1.8B Q8 base and accept 60.0%. The LoRA's +6.7 points are not enough to justify a 9.7 s Transformers path. A merged GGUF adapter could be much faster, but I did not test that conversion, so I will not claim it.
If you want to train anyway, 200 examples and 155 seconds are cheap. Measure the interval on your own paragraphs. A point estimate from 20 paragraphs is not a deployment decision.
On this 96 GB machine the 30B is faster than the 1.8B. The 1.8B's advantage is 1.9 GB of memory. That changes the use case from "small and fast" to "small enough to run where the 30B cannot."
Generalization boundary
This is a fixed-glossary adaptation, not general distillation.
- The adapter saw the same 12 terms during training and was tested on unseen sentences. It did not learn arbitrary new terms.
- The eval set exercises 9 of the 12 terms.
prompt injection,guardrailandobservabilitywere trained but not measured. - The training text is synthetic. The evaluation text is a real Wikipedia article. The result is a test of term mapping in new sentences, not a test of a new domain.
- The per-term samples are small. The
large language modelregression from 67% to 33% is 6 of 9 to 3 of 9. Treat it as a warning, not a precise estimate. - The LoRA was evaluated in Transformers bf16. The base Q8 and 30B run in llama.cpp. The latency comparison is a runtime comparison as much as a model comparison.
- The repair arm is a pipeline. It uses a 30B and a checker. It is not a 1.8B-only result.
Reproduce it
The pack has the scripts, data, adapter and raw outputs. The short version:
# 30B teacher (separate terminal)
llama-server -m /path/to/Hy-MT3-30B-A3B-Q8_0.gguf -ngl 99 -c 8192 --jinja --port 8081 -np 1
python3 make_synthetic_sources.py
python3 translate_teacher.py
/path/to/venv/bin/python filter_teacher.py
python3 train_lora.py --train data/train200.jsonl --val data/val20.jsonl \
--steps 300 --batch-size 2 --out adapters/full200
python3 eval_adapter.py --adapter adapters/full200 --out results/lora_full_bf16.jsonl
/path/to/venv/bin/python run_repair.py
/path/to/venv/bin/python score_arms.py
filter_teacher.py, run_repair.py and score_arms.py need the COMET/sacrebleu environment. train_lora.py and eval_adapter.py need Transformers and PEFT. The 30B server is used by the teacher and repair steps. The exact prompts are in the pack.
The data recipe is three steps: generate 25 term-context sentences per term, translate with the 30B, keep only strict-passing targets. The leakage gate runs before training. The evaluation is the same 20 paragraphs and three runs used in the earlier Hy-MT3 tests.
Limitations
- Synthetic training data. It guarantees term coverage and avoids leakage, but it is not a real corpus. A real-article training set could behave differently.
- One article, 20 paragraphs, three runs. The confidence intervals are wide. This is a case study, not a leaderboard.
- Nine of twelve terms tested. Three trained terms are not present in the eval paragraphs.
- One LoRA configuration. Rank 8, three epochs, no sweep. A different rank, learning rate or epoch count could move the result.
- Runtime mismatch. LoRA is Transformers bf16 at 9.7 s. Base and 30B are GGUF at 1.2 s and 2.3 s. A merged GGUF adapter is untested.
- No human evaluation. COMET-Kiwi is reference-free. The strict checker accepts definite and indefinite forms, not synonyms.
- One machine. A 96 GB M3 Ultra. A smaller machine changes the memory trade-off, not the quality numbers.
- Local cost. The API bill is $0. The cost is wall time, 31 GB of memory for the 30B, and the 155-second training run.
Related reads
Frequently Asked Questions
Did the LoRA work?
It gained 6.7 points, and the paired interval crossed zero. It is a real experiment, not a proven fix. The repair pass is the stronger glossary result.
Why did repair beat the 30B on glossary?
The repair prompt gives the 30B the source, the draft and the glossary, and the checker decides when to call it. The 30B direct writes once. The repair pipeline can enforce every term, but its COMET is lower because rewrites can flatten the prose.
Is the 1.8B faster?
Not here. The 1.8B Q8 base is 1.2 s, the 30B direct is 2.3 s, and the Transformers LoRA is 9.7 s. The 1.8B's advantage is 1.9 GB of memory.
Why synthetic data?
A fixed 12-term glossary is hard to cover with a few articles, and using the eval article would leak. Synthetic term-context sentences give 25 examples per term and a license-clean recipe. The evaluation is still a real article.
Can I use this recipe for my glossary?
Yes, with one rule: measure on your own unseen sentences and report the interval. Generate term-context sentences, filter teacher outputs, gate leakage, train, and compare against the no-training alternatives.
What about the three untested terms?
prompt injection, guardrail and observability were in training but not in the 20 eval paragraphs. I do not claim a result for them.
Is this distillation?
No. It is a 200-example glossary adaptation. A real distillation would train on a much larger teacher corpus and evaluate broader capabilities.
Did you test a merged GGUF adapter?
No. The adapter was evaluated in Transformers. A merged GGUF conversion is the obvious next step for latency, but it is not measured here.
Footnotes
-
Tencent, "Hy-MT3-1.8B" model card: 1.8B translation model, Apache 2.0. https://huggingface.co/tencent/Hy-MT3-1.8B ↩
-
Tencent, "Hy-MT3-30B-A3B" model card: 30B total / 3B active mixture-of-experts, Apache 2.0. https://huggingface.co/tencent/Hy-MT3-30B-A3B ↩
-
Hu et al., "LoRA: Low-Rank Adaptation of Large Language Models," 2021. https://arxiv.org/abs/2106.09685 ↩
-
Hugging Face, "PEFT" parameter-efficient fine-tuning library. https://huggingface.co/docs/peft ↩
-
Unbabel, "wmt22-cometkiwi-da" reference-free quality estimation. https://huggingface.co/Unbabel/wmt22-cometkiwi-da ↩
For AI agents:get_post/posts/index.json/hy-mt3-1-8b-glossary-lora.md
Free newsletter
Stay on the Nerd Track
One email a week: a Thursday issue with one system teardown, three remote jobs, one workflow and one Arabic takeaway.