Advertisement
Data Processing

The Unit Mirage: 60% of Weights Read Successfully — and Wrong by a Factor of 1,000

Every weight in the test file was the same weight. One thousand values, each truly 5 kilograms, each truly 5,000 grams, differing only in how the...

Every weight in the test file was the same weight. One thousand values, each truly 5 kilograms, each truly 5,000 grams, differing only in how the number and its unit were written down. That sameness is what makes the results so stark. A plain numeric parser read only 20.0 percent of the file at all. A cleverer parser — one that strips the letters, keeps the digits and reads everything as grams — reported a perfect score: 1,000 values read, no failures, nothing flagged. It was also wrong about six hundred of them, silently, by a factor of one thousand. The file that looked fully imported was the most dangerous file of the three, because nobody goes looking for an error that the import log says never happened.

What The Unit Mirage means

The Unit Mirage means the false confidence produced when a parser extracts a number successfully while discarding the unit that gives the number its meaning. A weight is not a number; it is a number married to a unit, and the two halves carry very different shares of the information. The digits say how much, in a purely relative sense. The unit says on what scale — and between grams and kilograms, the scale differs by a factor of 1,000. A parser that keeps the digits and drops the unit has kept the smaller half of the message and thrown away the larger half, while reporting the operation as a success. The mirage is the success report itself: a clean count of values read, indistinguishable from a correct parser's report, covering a file in which the majority of values have been moved three orders of magnitude from the truth.

Five writings of one weight

The test file held 1,000 weight values, every one with the same true value of 5 kg, which is 5,000 g. They were written five ways, 200 values each: as a bare number, "5000"; with a compact gram suffix, "5000g"; in kilograms without a space, "5kg"; in kilograms with a space, "5 kg"; and in uppercase with a decimal, "5.0KG". The five forms are not contrived edge cases. They are the ordinary variety of a column assembled from supplier feeds, warehouse exports and hand-edited spreadsheets, where each source has its own habit.

Three parsers were run over the file. The first was the naive approach: hand each string to a plain float conversion and keep whatever converts. It succeeded on 200 of 1,000 values, 20.0 percent — only the bare "5000" group converts, because every suffixed form contains letters or spaces that a plain numeric conversion refuses (Source: SmartDataAI import test V2, run 2026-11-23; script and result JSON filed with this batch's evidence pack). A 20.0 percent success rate is a bad result, but it is an honest one. It announces itself. No pipeline ships on a run that dropped eighty percent of its rows; somebody investigates, and the investigation finds the suffixes within minutes.

The second parser was the common fix for exactly that failure: strip everything that is not a digit or a decimal point, convert what remains, and read the result as grams. This parser extracted a number from all 1,000 values, a 100 percent extraction rate — and that is where the mirage begins. The 400 gram-written values were read correctly: "5000" and "5000g" both yield 5,000, the true weight in grams. But the 600 kilogram-written values — "5kg", "5 kg" and "5.0KG", 200 each — had their units discarded along with their letters, and their digits, 5 or 5.0, were recorded as grams. Six hundred values were silently misread as 5 grams instead of 5,000 grams, wrong by a factor of 1,000. That is 60.0 percent of the whole file, and 75.0 percent of the values that carried a suffix (derived by dividing the misread counts by the file total and by the suffixed total respectively) (Source: SmartDataAI import test V2, run 2026-11-23; script and result JSON filed with this batch's evidence pack). The parser's report, however, would show no trace of any of this. Extraction succeeded everywhere. The error lives entirely in the values, where almost nothing ever looks.

The third parser was unit-aware: it read the suffix as part of the value, converted kilograms to grams, and treated the bare number according to the column's declared gram scale. It read all 1,000 values correctly, 1,000 of 1,000, matching the true 5,000 g on every row (Source: SmartDataAI import test V2, run 2026-11-23; script and result JSON filed with this batch's evidence pack). The contrast between the second and third parsers is the article in miniature. Both report total success. One is right everywhere and the other is wrong three times in five, and the difference is nothing more sophisticated than reading the letters instead of deleting them.

Consider what the misread values would do downstream. Six hundred products recorded at 5 grams instead of 5 kilograms would produce shipping quotes off by orders of magnitude and freight classifications in the wrong band entirely. And because the misreading is uniform within each written form, it does not look like noise: it looks like three product lines that happen to be very light, plausible until the first physical shipment is weighed.

The ordering of danger is the reverse of the ordering of success rates. The naive parser, at 20.0 percent, is the safest failure in the test: loud, total and impossible to miss. The stripping parser, at 100 percent extraction, is the hazard: quiet, partial in its wrongness and total in its confidence.

How this was measured

The values in this test were synthetic, generated by the test script itself: a single true weight, 5 kg or 5,000 g, was rendered into the five written forms described above, 200 values per form, under a fixed seed of 42, so that every value's true weight was known by construction and any deviation in a parser's output could be scored exactly. The three parsers — plain float conversion, letter-stripping extraction read as grams, and unit-aware conversion — were fixed in advance, and all parsing was carried out by the script's own deterministic logic, applied uniformly to all 1,000 values. The counts are stated exactly as constructed: 1,000 values, five forms, three parsers. This exercise measures the behaviour of parsing strategies against constructed written forms; it says nothing about any commercial product, none of which was tested.

The Unit Mirage: 60% of Weights Read Successfully — and Wrong by a Factor of 1,000

Questions, answered

Which parser was most dangerous, and why? The letter-stripping parser. It extracted a number from all 1,000 values and reported complete success, yet 600 of those values — 60.0 percent of the file — were misread by a factor of 1,000, because the discarded unit was the difference between grams and kilograms. A failure that reports itself gets fixed; a wrong value that reports success gets used.

Why did the naive parser only reach 20.0 percent? Because a plain float conversion accepts only the bare number form. The 200 values written as "5000" converted; the 800 values carrying a suffix, a space or uppercase letters did not. Its low score is a format refusal, not a misreading — every value it did accept, it read correctly.

What share of suffixed values did the stripping parser misread? 75.0 percent (derived). Of the 800 values that carried a suffix, the 200 written "5000g" survived stripping intact, while the 600 written in kilograms — "5kg", "5 kg" and "5.0KG" — lost the unit that multiplied their meaning by 1,000 and were recorded as 5 grams.

Does a 100 percent extraction rate mean an import is correct? No, and this test is the counterexample. Two parsers both extracted numbers from all 1,000 values; the unit-aware one was right on every row and the stripping one was wrong on 600. Extraction measures whether digits were found. Correctness requires the unit to be read as part of the value, and no extraction count can show the difference.

Summary

One true weight, written five ways, separated three parsers completely. Plain float conversion read 20.0 percent and failed loudly. Letter-stripping extraction read everything and silently misread 60.0 percent of the file by a factor of 1,000. Unit-aware parsing read everything and was right everywhere. The Unit Mirage is the middle result: the import that looks best in the log and is worst in the data, because it kept the digits and discarded the half of each value that said what the digits meant.

Sources

Know someone who needs this? Share it.

Advertisement