# Qwen3.8 Arabic glossary fixes

Measured 2026-11-29 on a Mac Studio (Apple M3 Ultra, 96GB). Qwen3.8-27B
(`qwen3.8:27b-mlx`, NVFP4) through Ollama 0.40.16. Same 20 paragraphs and
12-term glossary as the [30B pack](../hy-mt3-arabic-translation/index.html) and
the [1.8B pack](../hy-mt3-1.8b-arabic-translation/index.html), three runs per arm.

## Headline results

| Arm | Glossary strict | COMET-Kiwi | Requests | Median latency |
|---|---:|---:|---:|---:|
| Zero-shot | 26.67% | 0.7923 | 60 | 2.34s |
| Glossary prompt | 46.67% | 0.7994 | 60 | 2.46s |
| Glossary + few-shot | 50.0% | 0.7968 | 60 | 2.35s |
| Glossary + repair | 56.67% | 0.781 | 102 | 3.72s |

## Findings

- **The glossary prompt is the single best fix.** It raised strict glossary
  from 26.67% to 46.67%
  (20.0 points overall; paired per-segment +19.5 points,
  p = 0.006). COMET moved
  +0.0071 (p = 0.221),
  so the prompt did not cost measurable raw quality.
- **Few-shot is not worth the extra prompt.** It added 3.3 points overall over
  the glossary prompt (paired +2.5,
  p = 0.718) and COMET moved
  -0.0026. The examples are extra
  context for a marginal gain.
- **The repair pass adds points but costs calls.** It raised strict glossary to
  56.67% (10.0 points overall; paired
  +6.7, p = 0.081),
  but 42/60 outputs were rewritten and the pipeline used
  102 calls for 60 outputs. COMET moved
  -0.0184 versus the glossary arm
  (p = 0.197), and the median
  latency rose from 2.46s to
  3.72s.
- **Production checks:** code spans, placeholders and URLs pass 100% in every
  arm. Exact digits pass 90.0% / 95.0% / 95.0% / 90.0% (zero / gloss / few-shot /
  repair); Latin-name style passes 50.0% / 45.0% / 45.0% / 45.0%. The last row is
  a brand-script choice, not a translation failure.
- **Where this leaves Qwen:** the glossary prompt gets it to
  46.67%, the repair to 56.67%.
  The 30B is 86.7%, the 1.8B Q8 60.0%, the 1.8B Q4 70.0%, and Haiku 50.0% on the
  same corpus. Qwen's paragraph COMET is high; its glossary discipline is the
  weakness.

## The repair example

Source sentence:

> An AI agent is an artificial intelligence program that can make decisions, pursue goals, and take actions independent of humans.

Draft (zero/gloss style):

> الوكيل الذكي الاصطناعي هو برنامج ذكاء اصطناعي قادر على اتخاذ القرارات...

Repaired:

> وكيل الذكاء الاصطناعي هو برنامج ذكاء اصطناعي قادر على اتخاذ القرارات...

The repair prompt's grammar note matters. A simpler prompt produced
`الوكيل الذكاء الاصطناعي`, which satisfies the strict checker but is not
grammatical. The checker can be gamed; the editor still has to read the output.

## Method notes

- Same 20 paragraphs, 12-term glossary and 3 runs as the 30B and 1.8B tests.
- Gloss arm reuses the Qwen outputs from the 30B test. Zero-shot, few-shot and
  repair were run for this pack.
- Decoding: temperature 0, `think: false`, 8,192 context, 2,048 max tokens.
- COMET-Kiwi is the int8 `wmt22-cometkiwi-da` build, reference-free.
- Glossary strict accepts definite/indefinite variation, not plurals or
  synonyms.
- The repair arm calls the model only when the strict checker finds a miss;
  passing outputs are kept. That is why it uses 102 calls for 60 outputs.
- The scorers read the 30B working directory from `NLT_30B_WORKDIR` (default
  `../hy-mt3-arabic-translation`). Set it to the directory that contains
  `comet/` when re-running the metrics; the checkpoints are not in this pack.

## Reproduction

```bash
python3 run_fixes.py
python3 score_fixes.py
```

## File map

- `index.html` — browsable index.
- `method.html` — readable HTML version of this document.
- `corpus/paragraphs.json` — the 20 paragraphs.
- `results/arms.jsonl` — every arm, draft, repair flag and token count.
- `scores/summary_fixes.json` — aggregates and paired tests.
- `scores/per_output.jsonl` — per-output COMET and glossary checks.
- `scripts/` — harness and scorers (in the zip; direct `.py` URLs are 410).
- `terminal/summary.cast` — real asciinema summary.

## Licenses

- Wikipedia source and translations: CC BY-SA 4.0.
- Qwen3.8-27B: Apache 2.0.
- COMET-Kiwi int8 build: CC BY-NC-SA 4.0.
- Harness and measurement tables: published for reuse with attribution.

## Caveats

- No human evaluation; COMET and the strict checker are automatic.
- One article, one language pair (English to Modern Standard Arabic).
- The repair pass can satisfy the checker while producing awkward grammar.
  Read the output, not just the metric.
- The glossary prompt is one prompt design; a different prompt could do better
  or worse.
