Repository navigation
Description
Hi, sharing a reproducible on-device measurement of quantization decay along the "Agent tool-trigger" dimension for MiniCPM5-2B (GGUF), run on a phone. Everything below is a binary decision metric (did the model emit a valid tool call for a SKILL.md skill or not), not a language-modeling-quality metric.
Setup
- Device: Xiaomi 23013RK75C, Android 15, aarch64, 7 cores, no root
- Runtime: Termux + llama.cpp 0.7.0
llama-server,-c 4096 -t 7, 4 slots - Model:
openbmb/MiniCPM5-2B-GGUF(Q4_K_M 1,561,318,368 B / Q8_0 2,679,710,688 B, SHA256 verified against 8000 HF tree APIlfs.oid) - Sampling: temp=1.0, top_p=0.95, min_p=0.0 (llama.cpp's default 0.05 filters out the tokens needed to escape a reasoning loop — must be zeroed explicitly), max_tokens=384 (512 in the follow-up arm)
- 12 cases (9 positive, 3 negative) × 3 repeats = 27 positives/arm
TL;DR
| Metric | Q4_K_M@384 | Q4_K_M@512 | Q8_0@384 |
|---|---|---|---|
| Trigger rate | 18/27 = 66.7% | 8/9 = 88.9% | 22/27 = 81.5% |
| Parse rate | 100% | 100% | 100% |
| Filled rate | 100% | 100% | 20/22 = 90.9% |
| EMPTY_THINKING (positives) | 8 | 1 | 2 |
| Positive mean latency | 27.9s | 33.9s | 41.6s |
| Memory | 1.49GB | 1.49GB | 2.68GB |
Main finding: the decay is a token-budget artifact, not a capability loss.
The only failure mode that grows with quantization is EMPTY_THINKING: the whole max_tokens=384 budget is burned inside reasoning_content and content comes back empty. Same Q4_K_M weights, only max_tokens raised 384 → 512: EMPTY_THINKING 8 → 1, trigger rate 66.7% → 88.9%. So "small quant + big budget" (88.9%, 1.49GB) dominates "big quant + small budget" (81.5%, 2.68GB) on this dimension.
Format layer shows zero decay. Parse rate is 100% on both quants — once a well-formed XML tool call is emitted, a 158-line zero-dependency loader caught 100% of them. No tolerance hardening needed for quantized models.
Honest caveats (please read before quoting numbers)
- Dimension-limited. This is not "Q4 beats Q8". External KLD/perplexity measurements show Q8_0 is better on language-modeling quality, and I have no reason to dispute that. The claim is narrower: on the tool-trigger decision, budget compensation can close the quantization gap.
- Latency advantage is calibration-sensitive. The headline "Q4@512 is 18.5% faster" uses the 41.6s mean where a CURL_ERR value was replaced by a 213s timeout re-run (an outlier). Drop that outlier (35.0s, n=26) and Q4@512 is only 3.1% faster. Direction holds under both calibrations; magnitude does not.
- Small n. n=27/arm, 95% CI on 66.7% is roughly ±17pp, and the 512 arm is single-repeat (n=9). The value here is the failure-mode taxonomy and the attribution, not the point estimates.
- Counter-intuitive but not over-read:
EMPTY_PARAM(call triggered, arguments empty) appeared twice on Q8_0 and zero times on Q4_K_M. n=2 vs 0 — recorded, not inferred. Note it is a filling-layer failure, kept separate from parse-layer failures so the 100% parse rate stays self-consistent. - Negatives never regressed. Abstention 9/9 on both quants, 3/3 (4/4 including one re-run row) on the 512 arm — raising the budget did not make the model over-trigger on cases it should decline.
- word-count stayed at 66.7% in every arm (2/3 even at 512). That skill's trigger phrasing is the weakest of the three, so budget compensation helps it least — that looks semantic, not quantizational.
Full report / data
- Report: https://github.com/Lmeng486/awesome-termux-mcp/blob/main/docs/QUANT-DECAY-MINICPM5.md
- Loader used in the loop (158 lines, zero deps): https://github.com/Lmeng486/skillmd-termux
Repro is a single harness call per arm:
TAG=q4km REPEATS=3 MAXTOK=384 sh run_tests.sh
TAG=q4v512 REPEATS=1 MAXTOK=512 sh run_tests.sh
python3 posthoc.py results_q4v512.tsv outs/ q4v512Happy to share the raw TSVs if useful. Also: I noticed #387 (loop-thinking on rule-dense tasks) reports the same underlying mechanism from a different angle — reasoning overrunning its budget — so these two datasets may be worth cross-referencing.
Activity
README: link the upstream measurement thread (OpenBMB/MiniCPM#388)
hansjohn commentedon Oct 23, 2026
Thank you for sharing this detailed on-device study of quantization’s impact on MiniCPM5-2B’s tool-calling behavior. We really appreciate your efforts to make the experiments reproducible and clearly document the findings and limitations.
Please feel free to follow up with any further findings or questions. Thanks again for the thoughtful analysis and for contributing to the MiniCPM community!
docs: record upstream review of the MiniCPM5 quant-decay report (Open…