Log in
docs/token-calibration-factors.md 50 lines · 2.5 KB

Token Calibration Factors (2026-06-11)

Measured with scripts/token_calibration.py against the exact o200k_base tokenizer (tiktoken), on per-style command outputs captured from one identical fixture (40 files, 12 commits, 9 dirty + 1 new file) snapshotted by both subjects. Factor = exact tokens / (chars Γ· 4); factor > 1.0 means char/4 underestimates real tokens for that style.

Output styleCommandFactorSample bytes
git_statusgit status1.216589
git_status_shortgit status --short1.605172
git_diffgit diff1.7271611
git_diff_statgit diff --stat1.643223
git_loggit log --oneline -122.465171
git_log_fullgit log -51.863697
oak_statusoak status1.645123
oak_status_jsonoak status --json1.176704
oak_diffoak diff --print1.6561382
oak_diff_statoak diff --stat --print1.969257
oak_logoak log -n 122.107705
oak_log_fulloak log -n 5 -v1.962418

What this means for published deltas

  • Same-family agent-default pairs are close enough to compare raw where both factors agree within ~5% (status: git --short 1.605 vs oak 1.645; diff: 1.727 vs 1.656). The char/4 delta direction holds there.
  • Log and stat families are not safe raw: git log --oneline (2.465) vs oak log (2.107) is a 15-point bias gap favoring git in char/4 terms; diff --stat flips it (git 1.643 vs oak 1.969, ~20 points favoring oak). Apply the factors (or report exact-tokenizer counts) before publishing any cross-subject token claim involving log or stat output.
  • Hash density drives the bias (hex tokenizes at ~2.4 chars/token), so any output style change in either tool invalidates its row here β€” recapture rather than reuse.

Caveats

  • n=1 sample per style on a small fixture (123–1611 bytes). Before a public drop, recapture from real result artifacts at scale (--per-file over workflow outputs) β€” these factors are working values, not final.
  • Tool-call envelope constants in oakbench/tokens.py were updated the same day from the same tokenizer: per-call emitted 45β†’58, ingested 27β†’44 (anthropic templates 61/45, openai 56/43). Historical rows used the old constants; token_estimate.cost_weights/ENVELOPE_NOTE on each row records which constants priced it.

Regenerate: capture outputs per style, then python3 scripts/token_calibration.py <files> --label <style> --compact.