Skip to content

Commit 8f025bc

Browse files
author
UXBYISSA
committed
Publish the full measured token table and the isolation experiment
Every file now carries a measured token count and chars-per-token figure from count_tokens on claude-opus-5, replacing the character-ratio estimates. Two corrections came out of measuring, in opposite directions, and the section states both rather than quietly fixing the numbers. The estimates were low by 33-57% on every row: the assumed English prose ratio was 3.9 chars/token against ~2.99 actual, and English is most of these files, so the miss was systematic rather than random. The Arabic multiplier was understated. Isolating pure samples gives Arabic prose at 1.47 ch/tok against English prose at 3.50 — about 2.4x, not the 1.6x previously claimed. But file-level ch/tok here is driven by code-versus-prose, not Arabic share: no file exceeds 5% Arabic, and probe-focus.js with zero Arabic measures 2.17 against probe-rtl.js at 2.19. The two-rate model reconciles probe-rtl.js to within 0.8% of its measured total, which is what makes both rates credible on their own rather than a coincidence of one comparison. Sample size is stated with the figure: one matched prose pair, corroborated by the reconciliation on unrelated text. Order of magnitude, not a constant. Also records a finding with no payoff: raw Unicode ranges are the most expensive construct measured and escapes tokenise ~30% cheaper, but only 48 characters across all probes sit inside them — roughly 41 tokens. Measured before refactoring, which is how a pointless refactor gets avoided.
1 parent a0d32a4 commit 8f025bc

1 file changed

Lines changed: 74 additions & 27 deletions

File tree

README.md

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,37 @@ of JSON into something a team will act on.
124124

125125
### What it loads
126126

127-
Measured with `scripts/count-tokens.mjs` against `/v1/messages/count_tokens`,
128-
not estimated. Skills load in three stages, so the full repository is never in
129-
context at once.
127+
Measured with `scripts/count-tokens.mjs` against `/v1/messages/count_tokens`
128+
on `claude-opus-5`. Not estimated — see the note at the end of this section for
129+
why that distinction earned its place.
130+
131+
Skills load in three stages, so the full repository is never in context at once.
130132

131133
| Stage | What loads | tokens |
132134
|---|---|---|
133135
| Always | the skill description only | **522** |
134136
| On trigger | `SKILL.md` body | **5,779** |
135-
| On demand | a probe, when read ||
136-
| On demand | a reference, when read ||
137-
| All 8 probes together | never happens in practice | 42,334 |
138-
| All 6 references together | never happens in practice | 19,265 |
139-
140-
The two "never happens" rows are there for a ceiling, not a forecast. A typical
141-
audit reads three or four probes and at most one reference, and the number that
142-
actually matters is the first row: **522 tokens sit in context whether or not
143-
you ever use the skill.**
144-
145-
For the per-file breakdown and a chars-per-token column:
137+
| On demand | a probe | 1,944 – 8,532 |
138+
| On demand | a reference | 2,315 – 4,505 |
139+
140+
The number that matters most is the first: **522 tokens sit in context whether
141+
or not you ever use the skill.** A typical audit then reads three or four
142+
probes and at most one reference. Loading all fourteen files at once — 61,599
143+
tokens — does not happen in practice.
144+
145+
| Probe | tokens | ch/tok | | Reference | tokens | ch/tok |
146+
|---|---|---|---|---|---|---|
147+
| `probe-routes.js` | 1,944 | 2.48 | | `report-template.md` | 2,315 | 2.59 |
148+
| `probe-focus.js` | 2,549 | 2.17 | | `foundations.md` | 2,427 | 2.85 |
149+
| `probe-parity.js` | 3,408 | 2.42 | | `wcag-thresholds.md` | 2,721 | 2.44 |
150+
| `probe-ltr.js` | 5,942 | 2.34 | | `evaluation-matrix.md` | 2,948 | 2.56 |
151+
| `probe-perception.js` | 6,208 | 2.47 | | `reading-list.md` | 4,349 | 2.61 |
152+
| `probe-heuristics.js` | 6,729 | 2.43 | | `arabic-rtl.md` | 4,505 | 2.34 |
153+
| `probe-core.js` | 7,022 | 2.30 | | | | |
154+
| `probe-rtl.js` | 8,532 | 2.19 | | | | |
155+
| **all 8** | **42,334** | | | **all 6** | **19,265** | |
156+
157+
Reproduce it, or run it on your own content:
146158

147159
```bash
148160
ANTHROPIC_API_KEY=sk-ant-... node scripts/count-tokens.mjs
@@ -153,19 +165,54 @@ subtracts it, so each number is the file's own cost. Counting is a metering
153165
endpoint — it returns a count without generating anything, so a full run costs
154166
fractions of a cent. `--json` to pipe it, `--model` to compare tokenisers.
155167

156-
**A note on why this section is measured rather than estimated.** It used to
157-
carry character-ratio estimates. Measuring showed they were low by 33–57%
158-
across every row — the assumed ratio for English prose was 3.9 chars/token
159-
against roughly 2.99 actual, and English is most of these files. Estimates
160-
under-reported the real cost by between a third and a half, which is exactly
161-
the kind of confident-but-wrong number this project exists to avoid.
162-
163-
Files containing Arabic do measure denser than English prose — `probe-rtl.js`
164-
at 2.19 and `arabic-rtl.md` at 2.34 chars/token against ~2.99 for English
165-
prose. How much of that gap is the Arabic itself and how much is the dense
166-
regex and Unicode ranges surrounding it is not something these numbers can
167-
separate, so no multiplier is claimed here. Run the script on your own content
168-
if you need that figure.
168+
### What tokenises expensively, measured
169+
170+
This section previously carried character-ratio estimates and a claim that
171+
Arabic costs about 1.6× English. Measuring produced two corrections, in
172+
opposite directions, and both are worth stating.
173+
174+
**The estimates were low by 33–57% on every row.** The assumed ratio for
175+
English prose was 3.9 chars/token against ~2.99 actual, and English is most of
176+
these files, so the miss was systematic rather than random. Published as fact,
177+
that table would have told readers the skill was a third to a half cheaper than
178+
it is.
179+
180+
**The Arabic multiplier was understated, not overstated.** Isolating pure
181+
samples on the same endpoint and model:
182+
183+
| Sample | ch/tok |
184+
|---|---|
185+
| English prose | 3.50 |
186+
| JS code, zero Arabic | 2.27 |
187+
| **Arabic prose** | **1.47** |
188+
| Raw Unicode-range regex (`[؀-ۿ]`) | 1.16 |
189+
| The same ranges as `\uXXXX` escapes | 1.52 |
190+
191+
Arabic prose costs **≈2.4× more tokens per character** than English prose, not
192+
1.6×.
193+
194+
**But file-level ch/tok in this repo is driven by code-versus-prose, not by
195+
Arabic.** No file here is more than 5% Arabic by character count. `probe-rtl.js`
196+
sits at 2.19 and `probe-focus.js`, which contains no Arabic at all, sits at
197+
2.17 — the same band. Reading a low ch/tok as an Arabic signal would be
198+
comparing code against prose and calling the difference language.
199+
200+
The two-rate model reconciles: `probe-rtl.js` is 17,798 non-Arabic characters
201+
at 2.27 plus 915 Arabic at 1.47, predicting 8,462 tokens against 8,532
202+
measured — **0.8% off**, which is what makes both rates credible rather than
203+
coincidental.
204+
205+
*Sample size, honestly:* the 2.4× figure comes from one matched prose pair of
206+
roughly 600–700 characters in the same register, on one model. The
207+
reconciliation above is independent corroboration on entirely different text
208+
(word lists rather than prose), which is why it is published at all — but treat
209+
2.4× as the right order of magnitude rather than a constant.
210+
211+
*And a finding with no payoff here:* raw Unicode ranges are the most expensive
212+
construct measured, and writing them as `\uXXXX` escapes tokenises ~30%
213+
cheaper despite being longer in characters. Across all eight probes only 48
214+
characters sit inside raw ranges — about 41 tokens. Measured before
215+
refactoring, which is how a pointless refactor gets avoided.
169216

170217
### Roughly what one audit costs
171218

0 commit comments

Comments
 (0)