# Four models, one Arabic RTL docs page

Measured 2026-11-29 on a Mac Studio (Apple M3 Ultra, 96GB), macOS 15.7.4.
One prompt, three runs per model, one request at a time.

The four models built the same single-file Arabic documentation page for a
fictional **NLT API**: RTL, five sections, search, dark mode, nav, tables, code
blocks, responsive at 390px and 1440px, no external assets.

## Headline results

| Model | Runtime | Median wall | Output tokens | Functional checks | Inline bidi |
|---|---|---:|---:|---:|---:|
| Claude Haiku 5.5 | Anthropic Messages API | 18.1s | 4,573 | 18/18 ×3 | 4/4 |
| Gemma 4 31B | Ollama 0.40.16 | 46.8s | 2,874 | 18/18 ×3 | 0/3 |
| Qwen3.8 27B | Ollama 0.40.16 | 2:27 | 12,919 | 17/18, 18/18, 18/18 | 0/6 |
| Inkling 2 Mini | Ollama 0.40.18 | 2:34 | 6,739 | 18/18 ×3 | 0/4 |

**215 of 216 functional checks passed.** The only miss is Qwen run 1, which
overflowed a 390px viewport (451px). Runs 2 and 3 passed. The inline-bidi audit
is separate from the 18 checks; it is explained below.

## Findings

- **All four produced a complete page.** No truncation: every run finished with
  `stop` or `end_turn`. The hard part was not getting Arabic on the screen.
- **Claude was fastest and the only one that got inline bidi right.** Median
  18.1s, 4,573 tokens, 18/18 in all three runs, and 4/4 inline paths in the
  correct order. It is an API result, so the wall time includes network.
- **Gemma was the fastest local model and the most token-efficient.** Median
  46.8s, 2,874 tokens, 18/18 in all three runs. It finished 3.1× faster than
  Qwen and used 4.5× fewer tokens. But 0/3 inline paths stayed LTR.
- **Qwen spent the most and still missed the small thing.** Median 2:27,
  12,919 tokens, a 37.6 KB page with a hero, stat cards, a sticky sidebar and copy
  buttons. That is 4.5× Gemma's token count and 3.1× its wall time. It was 17/18
  in run 1 because of a 451px mobile overflow, and 0/6 inline paths stayed LTR.
- **Inkling was the slowest and deterministic.** Median 2:34, 6,739 tokens,
  15.3KB, the same output in all three runs. 18/18 every run, but 0/4 inline
  paths stayed LTR.
- **The 18-check suite is a floor, not a grade.** It catches missing nav, broken
  search, missing dark mode, contrast, overflow, external requests and console
  errors. It does not catch inline bidi, design quality or copy quality.

## The bidi tell

All four pages set `<html lang="ar" dir="rtl">`. All four made their block code
LTR. The difference is inline code inside Arabic prose and table cells.

In an RTL paragraph, the string `/analyze` can render as `analyze/` because the
slash has no strong direction and the inline code inherits the paragraph
direction. The fix is one rule:

```css
code, .path {
  direction: ltr;
  unicode-bidi: isolate;
}
```

The audit finds every `<code>` whose text is a single path such as `/analyze`,
then compares the x-position of the slash and the next character. If the slash
is to the right of the next character, the visual order is wrong.

- Claude: 4/4 correct. It uses `direction:ltr` and `unicode-bidi:isolate` on
  inline code.
- Qwen: 0/6.
- Gemma: 0/3.
- Inkling: 0/4.

This is a targeted bidi read, not a full RTL audit. It was added after looking
at the four pages; it is reported separately from the pre-registered 18 checks.

## Method

| Item | Value |
|---|---|
| Prompt | [`prompt.md`](prompt.md) |
| Runs | 3 per model, 12 pages total |
| Decoding | temperature 0, 24,576 output cap, 32,768 context |
| Local thinking | off for all three local models |
| Claude thinking | disabled |
| Local state | warm; cold load was 3.9 to 4.3 s and is excluded from the timed runs |
| Selection | run 1 is the published representative; all runs are in the pack |

Models:

| Model | Local ID | Runtime |
|---|---|---|
| Qwen3.8 27B | `qwen3.8:27b-mlx` | Ollama 0.40.16, NVFP4 |
| Gemma 4 31B | `gemma4:31b-mlx` | Ollama 0.40.16, NVFP4 |
| Inkling 2 Mini | `inkling-local-chat` | Ollama 0.40.18, isolated store, renderer `inkling2` |
| Claude Haiku 5.5 | `claude-haiku-5-5` | Anthropic Messages API |

The 18 checks, per page:

1. `doctype`
2. `lang="ar"`
3. `dir="rtl"`
4. Arabic prose ratio and minimum length
5. nav links to `#overview`, `#quickstart`, `#auth`, `#endpoints`, `#errors`
6. search keeps the auth section and hides at least one non-match
7. `zzzz` shows `لا توجد نتائج` and hides all five sections
8. clearing restores all five sections
9. dark toggle changes the visible colors
10. light contrast ≥ 4.5:1
11. dark contrast ≥ 4.5:1
12. at least two LTR block code areas with `curl` and `Authorization`
13. no page-level horizontal overflow at 390px
14. no page-level horizontal overflow at 1440px
15. no external requests or external asset tags
16. no console or page errors (favicon 404 ignored)
17. footer contains 2026 and NLT API
18. single-file isolation, no external stylesheet/script/image

The bidi audit is check 19 in spirit, but it is not one of the 18.

## Costs

- Local models: $0 API spend. Wall time and hardware are the cost.
- Claude: 13,608 output tokens across three runs, about **$0.0068** at
  $0.50/MTok, plus input tokens; under one cent for the set.
- The fictional `api.nlt.example` endpoint is never called. The pages are
  static.

## Reproduction

```bash
export ANTHROPIC_API_KEY=...
python3 run_bakeoff.py
python3 score_all.py
node bidi_audit.cjs
```

The local models must exist in Ollama. `run_bakeoff.py` reads the Anthropic key
from the environment or `NLT_ENV_FILE`. `score_all.py` expects Playwright and
`NODE_PATH` pointing at a node_modules with it. The exact prompt is
[`prompt.md`](prompt.md).

## File map

- `index.html` — browsable scoreboard.
- `method.html` — readable HTML version of this file.
- `prompt.md` — the exact prompt.
- `<model>/index.html` — published run 1, sandboxed with CSP.
- `pages/` — all 12 raw extracted pages.
- `results/runs.jsonl` — every run with raw text, timings and token counts.
- `results/raw/` — raw model responses.
- `scores/` — per-run checks, aggregates and the bidi audit.
- `screenshots/` — desktop, mobile, dark and bidi evidence.
- `scripts/` — harness, Playwright suite and audit.
- `terminal/summary.cast` — real asciinema capture.
- `arabic-rtl-docs-bakeoff-pack.zip` — this directory.

## Licenses

- Qwen3.8-27B: Apache 2.0.
- Gemma 4 31B: Apache 2.0.
- Inkling 2 Mini: Apache 2.0.
- Claude Haiku 5.5: Anthropic API terms.
- The generated pages and measurement tables are published for reuse with
  attribution. The NLT API content is fictional.

## Caveats

- One prompt, one page, three runs. This is not a general model ranking.
- No human design score. The 18 checks are functional; the bidi audit is
  targeted. A native editor would still find copy and typography issues.
- Local models are NVFP4 quantized and run on different Ollama versions
  (0.40.16 for Qwen/Gemma, 0.40.18 for Inkling). Claude is an API model.
- Local times are warm. Cold load (3.9 to 4.3 s) is excluded. Claude includes
  network latency.
- Chrome only. No Firefox, Safari or screen-reader pass.
- Qwen run 1's 451px mobile overflow is real; runs 2 and 3 pass. The published Qwen
  page is run 1, so the bug is visible.
- The bidi audit was written after the pages were generated. It applies the same
  rule to every model, but it is not part of the pre-registered 18.
