The data that is not a number

What repetition is worth once the logarithm is gone

On prose, nearly three quarters of the fall in phrases per character with size is arithmetic that any text pays. On a collection built of copies it is a fifth, and what is left is a factor of three that is genuinely the arrangement.

Two measures of repetition are quoted side by side in every account of compressed indexing: r, the number of runs in the Burrows–Wheeler transform, and z, the number of phrases in the Lempel–Ziv parse. Both are reported per character, both fall as a collection grows, and the fall is offered as evidence that the collection repeats.

The half of a fall that is the logarithm showed that on real prose most of that fall is not evidence of anything. Phrases per character on a collection of essays fell by a factor of 2.34 between eight thousand characters and a million — and a shuffle of the same characters, holding the length, the alphabet and the zeroth-order entropy exactly and destroying the arrangement, fell by 1.70. What the collection was actually worth was 1.37.

The reason is arithmetic rather than empirical. On a text with no structure at all, z/n is about 1/log_σ n: a greedy parse of a random string produces phrases of length about log_σ n, because that is how long a string has to be before its earlier occurrence stops being likely. So any text at all shows a falling phrase rate as it grows, and the fall is a logarithm.

That measurement was made on the case the structures are not for. This one is made on the case they are.

On a genuinely repetitive collection the fall is the collectionPhrases per character against size, with the axis being the copy count at a fixed base of 2,048 characters — so the arrangement changes and the alphabet does not. The pale line is a shuffle of the same characters: same length, same alphabet, same zeroth-order entropy, no arrangement. It falls by 1.45x across the sweep, which is the logarithm every text pays because z/n is about one over log_sigma n. The collection falls by 4.71x, so what the repetition is actually worth is 3.24x. On real prose the same two-ended measurement left 1.37x; here the control accounts for 30.8% of the raw curve rather than for most of it, which is the difference between a collection that repeats and one that is merely predictable.10⁴0.1charactersphrases of the parse, per charactershuffled: 1.45xthe collection: 4.71x4,111 to 65,551 charactersworth 3.24x after the control
Fig. 1 Phrases per character against the copy count at a fixed base, with a shuffled control. Same length, same alphabet, same zeroth-order entropy, no arrangement.

The axis has to be the arrangement

There is a design decision here and getting it wrong produces a plate that says nothing.

Sweeping the total size of a repetitive collection at a fixed copy count grows the base along with everything else. The collection is sixteen copies at every point, so its repetitiveness is constant, and the only thing changing is the length — which means the phrase rate falls exactly as the control’s does and the plate reports a logarithm. That is a correct measurement of the wrong quantity, and it is what a naive size sweep on this cell produces.

Sweeping the copy count at a fixed base is the experiment. The base is two thousand and forty-eight characters throughout; the collection is two copies, then four, then eight, out to thirty-two. The alphabet does not move. The length does move, so the control is still necessary, and the control is what separates the two effects.

The result: the collection’s phrase rate falls by a factor of 4.71 and the control’s by 1.45. What the repetition is worth, after the logarithm is removed, is 3.24.

There is a second reason the copy-count axis is the right one, and it is about what a reader can do with the answer. A number attached to “this collection is sixteen copies of a base” is a number an engineer can act on: an archive of sixteen releases, a mirror set of sixteen hosts, a document with sixteen revisions. A number attached to “this collection is a million characters” is a number about a size, and sizes are the thing the control is removing. So the axis that isolates the effect is also the axis that carries the meaning.

The base length is held at two thousand and forty-eight characters throughout, which is short enough that the whole sweep fits in sixty-five thousand characters and long enough that the base itself is past the region where a parse is dominated by its own start-up. Both of those are choices and both would change the numbers slightly; neither changes the ordering, and the control is what makes that claim checkable rather than asserted.

Two ends of one measurement

That number should be read against the 1.37 the same procedure produced on prose, and the comparison is the point rather than either figure alone.

On prose, the control accounted for 73% of the raw fall. On a collection of copies it accounts for 31%. The two collections are being measured with the same instrument, the same control and the same two-ended check, and they give answers a factor of two and a half apart in what the arrangement is worth.

That is what the distinction between repetitive and predictable is, stated numerically. Prose is predictable: its next character is guessable, its entropy is low, and a compressor exploiting that does well. It does not repeat: no long stretch of it occurs earlier verbatim, so a parse that copies from earlier text finds only short phrases and finds them for the arithmetic reason above. A collection of copies repeats, and the parse finds phrases hundreds of characters long.

The four cells, and the two measures in eachRuns of the transform and phrases of the parse, per character, on 8,192 characters arranged four ways. The top row is prose and the bottom is 16 near-copies of one base; the left column is one text and the right is that text cut into 16 documents with a separator between them. Everything the repetition strand measured is the bottom left cell and everything the document strand measured is the top right; the bottom right is the one nothing here had filled. Cutting the repetitive text raises r/n from 0.0638 to 0.0768 — 1.20x — and cutting prose raises it from 0.2996 to 0.3053. Those two factors are the subject of the next plate, and they do not come out in the expected order.one text16 short documentsprosecopies of one baseprose, one textr/n 0.2996z/n 0.1273prose, many short documentsr/n 0.3053z/n 0.1301copies of one base, run togetherr/n 0.0638z/n 0.0354one copy per documentr/n 0.0768z/n 0.04188,192 characters throughoutthe outlined cell is the one that was empty
Fig. 2 The two texts and the two arrangements, with runs and phrases per character. The left column is one text and the right is that text cut into documents.

The run count tells the same story with a sharper control. Runs per character on the shuffled text is 0.906 at two copies and 0.906 at thirty-two — flat to three decimal places, because the shuffle has destroyed every run longer than chance allows and the number of those does not depend on the length. So r’s fall of 3.40 has no logarithm in it at all; every bit of it is the arrangement.

That asymmetry between the two measures was found on prose too, and it is worth restating because it is the more useful half of both essays. The phrase count carries a size effect and the run count does not. A collection reporting a falling z/n as it grows may be reporting nothing. A collection reporting a falling r/n is reporting repetition.

The gap also explains a persistent confusion in how these two words are used. A text compressor’s ratio does not distinguish them: a good compressor exploits predictability and repetition alike, and a collection that is strongly one or the other will compress well either way. So “this compresses to eight per cent” is compatible with both, and choosing a structure on that basis is choosing without the information that decides.

The entropy that cannot see a copy is where the two came apart in this collection, and the measurement there was the sharp one: the Burrows–Wheeler transform is a permutation, so H₀ of the transform equals H₀ of the text to fifteen decimal places, and an index priced at n·H₀ therefore cannot shrink when a text is duplicated. That is the same fact this plate shows from the outside — the flat line among two falling ones — and it is the reason a compression ratio is not a structure-selection criterion.

Why the run count has no logarithm

The reason is a one-line consequence of what a shuffle preserves.

A run of the transform is a stretch of positions that share a right context and agree in the character before them. On a random string over σ symbols, two adjacent rows of the sorted rotations agree in their preceding character with probability 1/σ, independently of n. So the expected number of runs is n(1 − 1/σ) plus lower-order terms, and r/n is 1 − 1/σ — a constant in n.

At σ = 22 that is 0.955, and the measured control sits at 0.906. The gap is the shuffle not being quite uniform: the character frequencies are the text’s, so collisions are more likely than 1/σ, and Σ pᵢ² is 0.094 rather than 0.045. Substituting the actual collision probability gives 0.906 exactly.

That is a small thing and it is the kind of small thing that makes a control trustworthy. A control whose value can be predicted from the collection’s own character frequencies, to three decimal places, is a control that is measuring what it claims to measure rather than an artefact of how it was built.

Cutting a repetitive text into documents costs it almost nothingRuns per character against the document count, on one fixed text of 8,192 characters cut more and more finely — so nothing moves but the number of separators. The expectation this measurement was made against is that a separator breaks a run, which would make a repetitive collection pay for its document count in the measure it exists to be small in. It does not. Across seven doublings the repetitive line rises by 1.02x and the PROSE line rises by 1.10x — the opposite ordering. In absolute terms the same 127 separators add 19 runs to the repetitive text and 293 to prose. The reason is not in this plate; it is in the characters the documents end with.1101000.1documentsruns of the transform, per characterprose: 1.10xcopies: 1.02x8,192 characters, cutthe control rises further
Fig. 3 The other thing that moves a run count on this cell: cutting the text into documents, with prose as the control. The effect is under two per cent against the copy count’s factor of three.

There is one more thing to extract from the run count’s flatness, and it is a small methodological win rather than a result. Because the control is predictable, it can be checked rather than merely computed: if a shuffled control’s runs per character comes out far from 1 − Σ pᵢ², something is wrong with the shuffle or with the transform. That is a self-test the control provides for free, and it is not available for the phrase count, whose control has no closed form worth relying on.

A control that can validate itself is worth more than one that cannot, and it is a reason to report both measures rather than one. The run count’s control checks the instrument; the phrase count’s control does the work.

What the fall is worth to a structure

A factor of three in the phrase rate is not an abstraction; it is the size of an index.

A phrase index stores a length, a source and a literal per phrase, plus three permutations of the phrase boundaries — so its size is very nearly proportional to z. A run-length index stores heads and lengths and a handful of directories, so its size is very nearly proportional to r. Halve either and the structure halves.

One index does not notice the repetition and two of them are made of itThree compressed indexes on 8,192 characters, against how many near-copies the text is made of — which in this cell is also the document count, because each document is one copy. The entropy-bounded FM-index is flat at about 6.4 bits a character throughout: the transform is a permutation, so its zeroth-order entropy is the text's, and no amount of repetition changes it. The run-length index falls from 18.5 to 3.4 and the phrase index from 9.1 to 1.6. At one copy the two repetition-aware structures are the LARGEST of the three, by a factor of 2.88x; the crossing is what decides which structure a collection wants, and it is a property of the collection rather than of the field.051015204060documents, which here is also the copy countbits a characterFM-indexrun-length indexphrase index8,192 characters throughout2665 runs down to 427
Fig. 4 Bits a character for three indexes over the same characters, against how many copies the text is made of. Two of the three follow the measures above and one does not.

Across the same sweep the run-length index goes from 18.5 bits a character to 3.4 and the phrase index from 9.4 to 1.6. The entropy-bounded index stays at 6.4 throughout, and the reason is the entropy that cannot see a copy: the transform is a permutation of the text, so its zeroth-order entropy is the text’s, and a structure priced at n·H₀ is blind to arrangement by construction. What is still proportional to n is where the same question was asked of the run-length structure, and found terms that follow the text’s length surviving inside a size that is supposed to follow the runs.

So the three structures sort themselves by which of the two properties they are built on. Two of them charge for arrangement and one charges for predictability, and a collection that is one and not the other will find them a factor of four apart.

The crossing between the flat line and the two falling ones is where this becomes a decision rather than a description. At one copy — an ordinary text with no duplication — the run-length index is 2.9 times the entropy-bounded one and the phrase index is 1.5 times it. Somewhere between one copy and four the two falling lines cross the flat one, and past that point every additional copy widens the gap.

The collection decides which index is small made that argument on one long text and it is unchanged by the document count. What this sweep adds is the control: the crossing is where it is because of the arrangement rather than because of the size, so it does not move as the archive grows unless the archive’s shape changes. An archive that doubles by adding two more releases keeps its crossing. One that doubles by adding unrelated material moves it.

The correction, applied backwards

There is a use for this beyond describing a corpus, and it is the one that makes the control worth computing every time.

A published number of the form “this collection has z/n = 0.03” is not comparable to another collection’s 0.05 unless the two are the same size. Half the difference could be the logarithm. Computing the shuffled control for each and reporting the ratio makes the two comparable, and the computation costs one shuffle and one parse.

The same applies within a collection over time. An archive that grows will report a falling phrase rate whether or not the new material resembles the old, and a monitoring number that falls for arithmetic reasons is a monitoring number that cannot detect anything. The control removes exactly that.

On a genuinely repetitive collection the fall is the collectionPhrases per character against size, with the axis being the copy count at a fixed base of 2,048 characters — so the arrangement changes and the alphabet does not. The pale line is a shuffle of the same characters: same length, same alphabet, same zeroth-order entropy, no arrangement. It falls by 1.30x across the sweep, which is the logarithm every text pays because z/n is about one over log_sigma n. The collection falls by 3.21x, so what the repetition is actually worth is 2.48x. On real prose the same two-ended measurement left 1.37x; here the control accounts for 40.3% of the raw curve rather than for most of it, which is the difference between a collection that repeats and one that is merely predictable.10⁴0.1charactersphrases of the parse, per charactershuffled: 1.30xthe collection: 3.21x8,207 to 65,551 charactersworth 2.48x after the control
Fig. 5 The same sweep on a four-symbol alphabet, where the control’s own arithmetic — one over log_σ n — falls faster, so more of the raw curve is the logarithm.

The alphabet matters to the control and not to the collection, which is a further reason to compute it rather than remember it. On four symbols, log_σ n grows faster with n than it does on twenty-two, so the control falls further over the same sweep and the fraction of the raw curve it accounts for is larger. A rule of thumb calibrated on English will be wrong on DNA in the direction of overstating what the collection is worth.

There is a version of this correction that applies to a claim rather than to a number, and it is the one worth carrying out of this field. The sentence “compressed indexes get relatively better on large collections” is true and is mostly a logarithm. The sentence “compressed indexes get relatively better on collections with more redundancy in them” is true and is the arrangement. The first is often offered as evidence for the second, and this pair of sweeps is what separating them looks like.

A million characters of the same thing is the other half of the pair, and reading the two together gives the calibration: on prose at a million characters the arrangement is worth 1.37, and on sixteen copies of a two-thousand-character base it is worth 3.24. Those are the two ends of the range a real archive sits in, and a collection can be placed inside it with one shuffle and two parses.

What a shuffle does and does not hold

The control’s whole authority rests on what it preserves, so it is worth being exact.

A uniform shuffle of a text holds the length exactly, the alphabet exactly, and every character’s frequency exactly — therefore the zeroth-order entropy exactly. It destroys every higher-order structure: the conditional entropies, the runs, the phrases, and any repetition at any scale.

What that means for a two-ended check is that anything surviving the shuffle is a property of n, σ and H₀ alone, and anything the shuffle destroys is arrangement. The check therefore has two halves and both are necessary. The control must move, or the comparison is against a constant and proves nothing about the instrument. And the control’s movement must account for less than the raw curve, or the collection is worth nothing beyond its own character frequencies.

Prose passes the first half and barely passes the second. This cell passes both comfortably. A text that failed the second — a raw curve fully explained by its control — would be a text whose falling phrase rate is an artefact, and reporting it as evidence of repetition would be reporting a logarithm.

The separators sort first, so their rows hold the documents' last charactersWhy the cut is nearly free on a repetitive collection. A separator sorts before every ordinary character, so its rows sit at the top of the suffix array — and the transform characters in those rows are the LAST characters of the documents. Those characters form one block of the transform, and a block costs one run per change inside it. At 128 documents a repetitive collection cut at one offset of near-identical copies ends with 6 distinct characters and prose ends with 18. The runs follow: 19 added against 293, which is 0.15 a separator against 2.31. The price of a boundary is the entropy of what precedes it.051015255075100125documentsdistinct characters the documents end with+7+52+162+293+4+-1+9+19prosecopies of one basethe label is the runsthe cut added128 documents0.15 against 2.31 runs a separator
Fig. 6 A third quantity that a size sweep moves without meaning to: the distinct characters a collection’s documents end with, which decides what its boundaries cost.
Twelve long documents, and two thousand short onesEach collection's documents drawn as a range: the shortest, the median and the longest. Every collection in this field until now has been the top three rows — a dozen documents of about twelve thousand characters each, which is what a version history of one file looks like. A real collection of 2,214 figure captions has a median of 230 characters and a spread of 7.4 between its ends. Everything a listing structure costs depends on which of these two shapes it is built over, and nothing in this collection had ever been measured on the second.① prose12,33512① code13,1508① revisions7,77410② essays12,33582② captions2302,214② history12,96314documentscharacters in a document① the first freeze · ② the secondmedian marked
Fig. 7 The other property of a collection that a size sweep moves without saying so: how its characters are apportioned between documents, which decides a different set of costs entirely.

One limitation of the shuffle is worth naming because it bounds what the control can claim. A uniform shuffle destroys all arrangement, so what survives it is arithmetic — but the converse does not follow. Something destroyed by the shuffle is not necessarily repetition in the sense a structure exploits; it could be any higher-order structure at all, including the kind of local predictability a Markov model captures and a copy-based parse does not.

So the control separates arithmetic from arrangement and does not separate the two kinds of arrangement. Doing that needs a second control — a text generated from the collection’s own conditional distributions, which holds the local structure and destroys the long-range copies. What the generated collection was right about built that control for a different purpose and it would work here; it is not applied in this sweep, and the consequence is that 3.24 is an upper bound on what the copying is worth rather than an exact figure for it.

Where the two measures disagree about a collection

One last comparison is worth drawing, because it is the case where the two measures give different advice and a reader has to choose.

Across this sweep r/n falls by 3.40 and z/n by 4.71, so the phrase count falls further — but 1.45 of the phrase count’s fall is the logarithm and none of the run count’s is. Corrected, the two are 3.40 and 3.24: the same number to within five per cent.

That agreement is not automatic and it is the useful part. The two measures are computed by entirely different machinery, count entirely different objects, and are usually quoted as though one implied the other. On this collection they agree about how much the arrangement is worth, once the arithmetic is taken out of the one that carries it. On prose they did not: r/n fell by 1.39 with a flat control and z/n by 1.37 after correction, which also agreed — and the raw figures, 1.39 and 2.34, did not.

So the corrected numbers agree on both collections and the raw numbers agree on neither. That is about as strong an argument for computing the control as this collection is going to produce, and it arrived as a consistency check rather than as the thing being looked for.

Repetition does not give the listing apparatus anything to doOccurrences per document for two patterns, in three collections of 32 documents. The pale bar is the collection's own most frequent 6-character string and the dark bar is a string drawn from one of its documents, which is what a reader asks for. On the drawn pattern all three cells read within a tenth of each other — prose 1.87, one copy per document 1.84, copies cut across documents 1.88. In a collection of versions the copies and the documents are the same partition, so a phrase of the base occurs once in each of d documents: d occurrences and d documents, and a ratio of one. The apparatus needs a pattern that repeats INSIDE a document, and repetition of this kind does not provide one.prose, many short documents2.38 most frequent1.87 drawn from a documentone copy per document4.78 most frequent1.84 drawn from a documentcopies cut across the boundaries2.91 most frequent1.88 drawn from a documentoccurrences per document holding the pattern32 documents · 6-character patternsall three within a tenth on the drawn pattern
Fig. 8 A property this sweep does not move at all, and which no amount of repetition changes: how often a pattern occurs in each document that holds it.

The one quantity that neither measure predicts is the one one copy per document is one occurrence per document is about. A collection can fall by a factor of three in both measures and leave its occurrences-per-document exactly where it started, because that number is a property of the base rather than of the copying. Three measures of a collection, two of which agree after correction and one of which is independent of both.

The convention this settles

The rule this collection now follows is one sentence and it has been arrived at twice from opposite directions.

A sweep whose axis is size draws a control, and the check is two-ended. The control holds n, σ and H₀ and destroys the arrangement; it must move, and its movement must account for most or little of the raw curve, and which of those it is is the finding.

On prose the answer was “most”, and the honest headline became 1.37 rather than 2.34. Here the answer is “little”, and the honest headline is 3.24 rather than 4.71 — a smaller correction, on a larger number, in a case where the raw figure would not have been badly wrong.

That the correction is small here is exactly why it had to be computed. A convention that only gets applied when the answer is expected to change is not a convention; it is a rationalisation with a procedure attached. The two sweeps together are the evidence that the procedure is worth its cost, and the cost is one shuffle.

What this makes readable

Essays that name this one as a prerequisite.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

Alphabet sizeBurrows-wheeler runsControlCorpusEntropyMeasurement designPhrase countRepetitionSelf-index