# Extreme Binning: similarity is not matching scope

## Answer

A candidate selector and a duplicate detector answer different questions.
Our exact examples hold the overlap of two chunk sets at four out of five,
yet store either five or nine equal-size chunk copies across the two files.
The difference is whether the chosen minimum remains shared.

These are constructed counterexamples, not estimates of how often the event
occurs. No confidence interval or performance claim follows from them.

## Read the evidence

[Bhagwat et al., MASCOTS 2009](https://escholarship.org/content/qt0tt8q4ht/qt0tt8q4ht.pdf)
defines the original procedure in section III. This demonstration follows its
retained-first-file hash rule. The
[2012 parallel-binning paper](https://crss.us/media/pubs/e5318725a703fca005efbefc1df99c14d9f7a8d2.pdf)
broadens candidate access. Its description of file hashes should not silently
replace the specific 2009 fast path. Neither paper was experimentally reproduced
here. Sources were read on 2026-12-02.

## Inspect the examples

[Generated table](EXAMPLES.md) | [Full transitions](examples.json) |
[Implementation](model.mjs) | [Tests](model.test.mjs)

- Changed minimum: [2,3,4,5], then [1,2,3,4,5]. Four shared identities are
  stored again. Extra copies / global unique chunks = 4/5; extra copies /
  input occurrences = 4/9. These denominators answer different questions.
- Retained minimum: [1,2,3,4], then [1,2,3,4,5]. All four common identities
  are reused. Both examples have the same set-overlap fraction.
- Cumulative bin: [1,4], then [1,5], then [1,4,5]. The last file adds no
  chunk copies, although neither predecessor alone contains it.
- First-file fast path: [1,2], [1,2,3], [1,2,3], [1,2]. Only the final
  file takes the fast path. The repeated later file needs a bin lookup.
- Reordered and repeated identities distinguish sequence identity, distinct
  chunks and input occurrences.

A pairwise selection probability is not a stored-byte fraction. Inferring a
fleet-level savings ratio requires workload distribution, sizes and index state.

## Reproduce

With Node.js supporting the built-in test runner, no third-party packages:

```sh
node --test model.test.mjs
node model.mjs --check
```

To regenerate both result files: `node model.mjs --write`.
The tests compare all 3375 three-file workloads made from the 15 nonempty
subsets of four identities with a separate closed-form oracle. That oracle
counts distinct (representative, chunk) pairs, not simulated writes.

## Model contract and limits

IDs are nonnegative safe integers in a fixed collision-free hash order.
Every occurrence is an equal-size chunk. Files are ordered lists; their exact
list identity stands in for a collision-free whole-file hash. No cryptographic
security property is modeled. The minimum is taken over the complete file.
Empty workloads are supported; empty files are deliberately rejected because
this model does not define a representative for them.

The model starts empty and retains all data. No deletion, eviction, prefix-only
sampling, byte weighting, concurrency or distributed placement is modeled.
Within-bin identical chunks share a copy. The original paper's wording about
writing all chunks in a newly created bin is not a physical-write accounting
specification; the demonstration counts retained unique copies in that bin.

A bin read/write is a logical operation. It is not a disk command, cache miss,
seek, latency or total backup I/O. Payload, recipes, reference-count updates,
allocation, durability barriers and database internals are excluded. Thus a
zero-bin-read case does not mean zero backup I/O.

No historical workload, code or paper figures are redistributed. This directory
contains only Hesela's original explanatory code and generated synthetic data.
