Files

88 lines
4.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Model evaluation
Status: Draft v1.0. Module: `SprachmittlerEval` (CLI only). Agent: `translation-evaluator`. Skill: `translation-quality`.
The default model is the one that works best on **your** texts on **your** Mac, at an acceptable speed. Publisher benchmarks (FLORES-200, WMT26, IFMTBench, WildMTBench) are context, not evidence for the default.
## 1. Corpus
- Manifest: `evaluation/corpus.json` (copy from `evaluation/corpus.example.json`; schema `evaluation/corpus.schema.json`).
- Texts: `evaluation/corpus/` (git-ignored, denied to agents). Use texts you are allowed to process; prefer public or your own.
- Size: about 60 segments. Suggested mix:
| Category | Segments | What it tests |
|---|---|---|
| `en-de-prose` | 10 | baseline EN→DE |
| `de-en-prose` | 10 | baseline DE→EN |
| `technical` | 8 | compounds, units, acronyms |
| `legal` | 4 | formality, terms |
| `ui` | 6 | short strings, buttons, placeholders |
| `markdown` | 5 | structure, links, code spans |
| `json` | 4 | keys vs values |
| `placeholders` | 5 | `{{var}}`, `%s`, `${x}`, URLs, e-mails |
| `numbers` | 4 | decimals, thousands, units |
| `idioms` | 4 | non-literal meaning |
| `long` | 2 | chunking and context |
| `cjk` | 3 | CJK direction, character density |
| `rtl` | 2 | Arabic/Hebrew direction |
- References: human translations written or corrected by you. For public texts, a published translation may be used with attribution. Mark `referenceKind: "human"` or `"public"`.
- Never commit private corpus material. The manifest is shared; the texts and results are not.
## 2. Procedure
1. Record hardware (chip, memory), macOS, Ollama version, model digests, `num_ctx`, sampling, prompt policy.
2. For each model: unload (`keep_alive: 0`), run one warm-up, then all segments warm, in manifest order.
3. Run 3 times at temperature 0.7 to measure variance; one run at 0.2 for comparison.
4. Compare 7B vs 1.8B. Compare default vs Structured Data 1 on the `markdown`, `json` and `ui` categories only.
5. Store raw outputs and metrics under `evaluation/results/<ISO date>/<model-slug>/`.
6. Generate `report.md` and `report.json`.
7. Review a sample in the panel and record correction minutes in `corrections.csv` (`segmentID,model,minutes,notes`).
Do not run other heavy workloads during measurement.
## 3. Metrics
| Metric | Definition |
|---|---|
| Failure rate | Share of segments with empty, truncated, loop, preamble or transport failure |
| chrF | Character n-gram F-score against the reference (primary, language-agnostic) |
| BLEU | SacreBLEU-style corpus BLEU (secondary; tokenisation documented) |
| Protected-token retention | Share of URLs, e-mails, placeholders and code spans present in the output; must be 1.0 |
| Numeric consistency | Share of normalised numeric values present; locale separators normalised |
| Structure | Paragraph/sentence count match; Markdown/JSON key preservation on structured categories |
| First-token latency | Median and p90 from request to first delta |
| Warm s/segment | Median and p90 total time |
| Cold load | `load_duration` of the first request after unload |
| Memory | `size` and `size_vram` from `/api/ps` after the first request |
| Human rating | 1–5 adequacy + fluency, or correction minutes |
chrF and BLEU are implemented in `SprachmittlerEval` with hand-computed unit tests. Do not add a Python dependency.
## 4. Report format
`report.md` starts with the environment block, then one table per direction/category:
| Model | Temp | Segments | Fail % | chrF | BLEU | Token retention | Num. consistency | First token p50/p90 | Warm s/seg p50/p90 |
|---|---|---|---|---|---|---|---|---|---|
Followed by "Observations" (max 10 bullets, no quotations above 15 words) and "Limitations".
## 5. Default-model gate (T7.5)
Write ADR "Default model and sampling" with:
- report location and date, corpus size per category, hardware;
- chosen default and Fast preset, with the numbers that justify them;
- rule used, for example: "no model may be default if protected-token retention < 1.0 or failure rate > 2%; then highest chrF on `en-de-prose` + `de-en-prose` + `technical`, then highest human rating, then lowest first-token latency";
- the chosen temperature and prompt policy;
- what triggers re-evaluation (new model version, Ollama upgrade, prompt change, user complaints).
Until the ADR is accepted, the 7B remains labelled provisional and the app may ask the user to pick a model on first run if both are installed.
## 6. Results log
| Date | Report | Models | Decision |
|---|---|---|---|
| 2026-11-26 | kit reference only | 7B Q4_K_M | 246 output tokens, 6.52 s, 44.6 tok/s; no corpus evaluation yet |