59 lines
3.5 KiB
Markdown
59 lines
3.5 KiB
Markdown
# Performance
|
||
|
||
Status: Draft v1.0. Targets are validated on named hardware. Translation speed depends on the model and the Mac; it is measured, not promised.
|
||
|
||
## 1. Reference measurements
|
||
|
||
| Date | Hardware | macOS | Ollama | Model | Prompt tokens | Output tokens | First token | Total | Eval rate | Resident |
|
||
|---|---|---|---|---|---|---|---|---|---|---|
|
||
| 2026-11-26 | M5 Pro, 48 GB | 27.2.1 | 0.40.18 | 7B Q4_K_M | 178 (owner: 177 cached) | 255 (owner) | not recorded | 5.97 s (owner) | 43.07 tok/s | — |
|
||
| 2026-11-26 | M5 Pro, 48 GB | 27.2.1 | 0.40.18 | 7B Q4_K_M | 178 | 246 | not recorded | 6.52 s | 44.6 tok/s | 6.49 GB |
|
||
|
||
The owner's run and the verification run used the same canonical prompt and the same source paragraph (the Hy-MT3 figure caption). The difference is normal sampling variance.
|
||
|
||
## 2. Budgets
|
||
|
||
| Metric | Budget | How measured |
|
||
|---|---|---|
|
||
| Second copy → session start | ≤ 150 ms | signpost `capture` |
|
||
| Panel visible | ≤ 250 ms after trigger | signpost `panel` |
|
||
| First translation token (warm 7B) | ≤ 1.5 s | signpost `firstToken` |
|
||
| 250 output tokens (warm 7B) | ≤ 8 s on an M-series Pro | CLI bench |
|
||
| Copy to clipboard | ≤ 100 ms | signpost `copy` |
|
||
| Replace via AX | ≤ 300 ms after click | signpost `insert` |
|
||
| Replace via paste | ≤ 700 ms including clipboard restore | signpost `insert` |
|
||
| Idle CPU | < 0.5% | Activity Monitor / `powermetrics` |
|
||
| Idle memory (app, excluding Ollama) | ≤ 90 MB | `footprint` |
|
||
| Main-thread hang | none > 100 ms | Instruments Hangs |
|
||
| 7B resident memory (8K context) | about 6.5 GB | `ollama ps` |
|
||
| 1.8B resident memory | about 1.6–2.0 GB | `ollama ps` (VERIFY) |
|
||
|
||
## 3. How to measure
|
||
|
||
```bash
|
||
make smoke # fixed synthetic sentence, 7B or all Hy-MT3 tags
|
||
swift run --package-path Packages/SprachmittlerKit sprachmittler-cli \
|
||
translate --file sample.txt --target de --model hf.co/tencent/Hy-MT3-7B-GGUF:Q4_K_M --json
|
||
ollama ps # resident memory and expiry
|
||
footprint -p $(pgrep -x Sprachmittler) # app memory, excluding Ollama
|
||
```
|
||
|
||
- Run cold (after `keep_alive: 0` and a restart) and warm.
|
||
- Record prompt tokens, output tokens, first-token latency and total time; the CLI JSON includes them.
|
||
- For the panel, use `os_signpost` intervals and Instruments; do not estimate from wall-clock clicks.
|
||
- For idle CPU, leave the app running with the panel closed for 5 minutes and sample Activity Monitor. The pasteboard poll is 120 ms; if idle CPU exceeds 0.5%, increase the interval to 200 ms and re-measure.
|
||
|
||
## 4. Model choice
|
||
|
||
- The 7B Q4_K_M is the quality default. It needs about 6.5 GB resident plus the app and the rest of the system; on a 16 GB Mac it is usable but not comfortable alongside a browser with many tabs.
|
||
- The 1.8B Q4_K_M is the Fast preset: about 1.35 GB download and much lower memory. Evaluate quality before recommending it broadly.
|
||
- The 30B-A3B is not a preset. It is far above a 16 GB budget.
|
||
- Streaming and a warm model matter more for perceived speed than a few tokens per second. Warm up on launch when the endpoint is loopback.
|
||
|
||
## 5. Caching
|
||
|
||
- The prompt prefix cache is the main latency win: the owner's run reported 177/178 cached prompt tokens. Keep the prefix stable.
|
||
- Do not add a system message, a timestamp or dynamic context to the default prompt.
|
||
- Changing the target language changes the prefix and the cache; that is expected.
|
||
- `keep_alive: "30m"` keeps the model loaded between translations. A cold load can add seconds; measure it on the target Mac and record it here.
|