1The problem
In 1962 Kenneth Arrow described why information is hard to sell: “its value for the purchaser is not known until he has the information, but then he has in effect acquired it without cost.” Training data is the purest case of this. A lab can't judge a company's archive without reading it, and once it has read it, the archive has already done most of its work.
Training data adds a second problem that Arrow's buyer didn't have. What a dataset is worth to a lab depends mostly on what the lab already holds. Ten years of a roofing contractor's job records are worth a lot to a lab with nothing like them and little to a lab that bought three similar archives last quarter. So the number that sets the value is a function of two private things: the seller's content and the buyer's corpus. Neither side will show the other.
Today the gap is filled with a sample the seller picked, an NDA, and weeks of diligence. That is the market for lemons that Akerlof described: when a buyer can't tell good from bad, everything is priced as average, and the best sellers are the ones who lose.
Three questions carry most of a dataset's value, and each one can be answered without disclosure:
| Question | What answers it | What is revealed |
|---|---|---|
| Is it real, and is it what I was shown? | A signed datacard, a hash of every file, and a sample the buyer's own random string selects (sections 3 and 4) | Counts, hashes, and the sample |
| How much of it do I already have? | Private set intersection over 13-word windows and MinHash bands (section 5) | Totals only, to the lab |
| Did people write it? | A screening check anyone can re-run on the same files (section 8) | Three rates |
None of the building blocks are new. The contribution is putting them together for this one transaction, fixing the parameters, and publishing what each party can and can't learn.
2The protocol in one picture
There are three parties. The seller holds the data and a signing key. The room is Grepped's clean room, or any neutral operator: it holds the seller's data in custody. The lab is the buyer and holds its own corpus.
a never leaves the lab and b never leaves the room.3Provenance
The seller runs one command on its own machine. It writes these files next to the data. They hold counts and hashes, never text.
| File | Contents |
|---|---|
SHA256SUMS | One line per file, sorted by path. Checkable with plain sha256sum -c. |
manifest.jsonl | Per file: path, bytes, SHA-256, source system, kind, modified date. |
datacard.json | Owner, volumes by system, years, table summary, quality shares, counts of personal data and credentials found, the AI-content check, both roots, and a canary GUID. |
schema.json | Per table: columns, inferred types, fill rates, date ranges. No cell values. |
datacard.json.sig.json | The seller's Ed25519 signature over the datacard. |
Two roots. manifest_root is the SHA-256 of the bytes of SHA256SUMS, so it names the exact set of files. merkle_root is the root of the Certificate Transparency tree over the same lines:
leaf(line) = SHA-256( 0x00 ‖ line ) node(l, r) = SHA-256( 0x01 ‖ l ‖ r ) an unpaired node moves up unchanged
The Merkle root is what makes a sample meaningful. Any one file can be shown to belong to the full delivery with about log2 n sibling hashes: 20 hashes for a million files.
The signature covers the canonical JSON of the datacard's hash and this statement: “I am authorised to make this data available on behalf of <owner>, and this datacard describes the files listed in its manifest.” It shows who vouched for the datacard and that nothing changed afterwards. It doesn't prove the statement is true. The right to license is established by the contract.
The canary is a random GUID in every pack, the same device BIG-bench uses. A lab can filter on it to keep the data out of the wrong pipeline, and anyone can search for it to see whether the data has leaked into a public corpus.
On delivery the lab runs one command. It checks SHA256SUMS against both roots, every file against its hash (naming missing, changed and unlisted files), and the signature, and it re-measures the datacard's volume, duplicate and AI-content numbers from the files. It exits 0 only if everything passes.
4A sample nobody can steer
A sample the seller chose proves little. Here the buyer chooses it, blind:
- The buyer receives the signed datacard. That fixes
merkle_rootand the file countn. - The buyer sends a nonce: any string it made up after step 1.
- The sample is the files at these positions of
SHA256SUMS:
seed = SHA-256( "grepped.sample/1|" ‖ merkle_root ‖ "|" ‖ n ‖ "|" ‖ nonce ) i_j = SHA-256( seed ‖ j as 8 big-endian bytes ) mod n j = 0, 1, 2, … skip repeats, and values at or above the largest multiple of n below 2^256
The seller couldn't know the nonce when it fixed the root, and the buyer couldn't know the files when it chose the nonce. Each sample file arrives with its Merkle proof, and the buyer checks that the proof's path is the one position i has in a tree of n leaves. A file the room has to hold back is listed with its position, its proof and the reason, so the buyer sees exactly how many were held back.
How big a sample? If a share f of the files are bad (junk, off-topic, machine-written), a uniform sample of k files contains none of them with probability (1 − f)k. So the sample size that catches a defect rate f with 95% confidence is ln 0.05 ÷ ln(1 − f):
| Share of bad files | 20% | 10% | 5% | 2% | 1% |
|---|---|---|---|---|---|
| Files to sample | 14 | 29 | 59 | 149 | 299 |
A 50-file sample is enough to rule out a dataset that is one-tenth junk. It is not enough to rule out 2%. The buyer picks k.
5Overlap without a shared key
The usual way to compare two corpora privately is to hash both with a shared key and compare the hashes. The weakness is the key: anyone who holds it and one side's fingerprint can test guessed text against it offline, for ever. Version 2 removes the key. It uses the commutative-blinding private set intersection of Meadows (1986) and Huberman, Franklin and Hogg (1999), the same construction Google deployed in Private Join and Compute, and it uses it to count, not to list.
What is compared
Text is lower-cased and split into tokens (\w+). Each side slides a 13-token window over every document and hashes each window to 64 bits, keyed with the session's public salt. Thirteen tokens is the window the GPT-3 paper used to test for benchmark contamination, and labs have used it since, so the result is in a unit a lab already reasons in.
Both sides keep a window only when its hash is divisible by 16. Sampling by value means both sides keep the same windows without talking to each other, and it cuts the work 16-fold. Each document also contributes 16 MinHash band values, which catch copies whose windows have been broken by light edits (section 6).
The exchange
Let p be the 2048-bit safe prime of RFC 3526 group 14, and work in the squares modulo p, a group of prime order (p − 1) ÷ 2. H hashes a window into that group. The lab picks a secret a and the room picks a secret b, 256 bits each, fresh for every run.
H(w) = ( SHAKE-256( "grepped.overlap/2|" ‖ salt ‖ w ) mod p )² mod p
commit lab → room A = { H(x)^a } x in the lab's windows, shuffled
challenge room → lab S = { H(y)^b } y in the seller's windows, padded, shuffled
answer lab → room S' = { s^a : s ∈ S } in the order received
result room count the s' that are in { c^b : c ∈ A }
H(x)^(a·b) = H(y)^(b·a) exactly when x = y
Raising to a secret power hides the window: under the decisional Diffie–Hellman assumption a blinded value is indistinguishable from random to anyone without the exponent. The two powers commute, so a window both sides hold lands on the same value and nothing else does.
The lab doesn't have to trust our count. On request the room also returns the lab's own commit raised to b, shuffled. The lab intersects that with its own answer and gets the number of matches itself. It must equal the number in our signed result. Because the returned set is shuffled, it doesn't show the lab which of its windows the seller holds.
What comes back
{
"schema": "grepped.cleanroom.overlap/2",
"seller_documents": 1000, "lab_windows": 68143,
"window_share": 0.2118, // seller windows the lab holds
"near_copy_share": 0.158, // documents with 80%+ of their windows in the lab's set
"mostly_copied_share": 0.216, // 50%+
"near_duplicate_share": 0.193, // documents sharing a MinHash band with a lab document
"new_share": 0.784,
"matched_values": 6254, // the lab can recount this itself
"by_system": { … }, "by_year": { … }, // groups under 20 documents merged
"transcript": { "sha256": "4f9cb879…" } // hash of all four messages
}
This is real output from the run described in the next section.
6What it measures, measured
We ran the reference implementation on synthetic corpora with known answers. Documents are 300 random words from a 20,000-word vocabulary, and an “edit rate” of 5% means each word was independently replaced with probability 0.05. Random text has no boilerplate, so these numbers describe the mechanism and are not a claim about any real archive.
How the two signals respond to edits
| Words changed | 0% | 1% | 2% | 5% | 10% | 15% | 20% | 30% |
|---|---|---|---|---|---|---|---|---|
| 13-word windows surviving | 100% | 88.0% | 76.7% | 51.8% | 25.4% | 12.1% | 5.6% | 0.9% |
| Predicted, (1 − r)13 | 100% | 87.8% | 76.9% | 51.3% | 25.4% | 12.1% | 5.5% | 1.0% |
| Flagged by a MinHash band | 100% | 99.7% | 93.4% | 38.0% | 2.5% | 0.1% | 0% | 0% |
| Jaccard of 5-word shingles | 1.00 | 0.91 | 0.82 | 0.64 | 0.42 | 0.29 | 0.20 | 0.09 |
Three things follow, and they are the part worth knowing.
Window share is a ruler. A window survives only if all 13 of its words do, so the surviving share is (1 − r)13, and the measurement matches that to within half a point at every edit rate. Read backwards, a document's window share s tells you how heavily it was edited: r ≈ 1 − s1/13. The two thresholds in the result therefore have plain meanings. “Near copy” (80% of windows) means at most about 1.7% of words differ. “Mostly copied” (50%) means at most about 5.2%.
MinHash bands are a tripwire, and a narrow one. With 16 bands of 8 over 5-word shingles, two documents share a band with probability 1 − (1 − J8)16 at Jaccard similarity J. That catches almost everything up to about 2% of words changed and almost nothing past 10%. It is tuned so that unrelated documents don't trip it: across 5,000 unrelated documents tested against a 20,000-document set, there were no false matches. Its job is to flag a lightly edited copy even when sampling left a document with few windows.
Neither signal sees paraphrase. A document rewritten in other words shares no 13-word windows and no bands. This protocol measures copied text. Whether a dataset teaches a model something it doesn't already know is a different question, and the honest way to answer it is to train on a sample and measure.
An end-to-end run
A seller corpus of 1,000 documents against a lab corpus of 2,000, in which we planted 150 exact copies, 100 copies with 5% of words changed, and 100 with 20% changed. Default parameters, four cores.
| Reported | Value | Expected from what was planted |
|---|---|---|
| Near-copy share | 15.8% | 15.0%, plus the few 5%-edited documents whose sampled windows happened to clear 80% |
| Mostly-copied share | 21.6% | 15% plus about two-thirds of the 5%-edited documents, whose expected share is 51%, right at the threshold |
| Window share | 21.2% | 20.7% = (150 + 100 × 0.513 + 100 × 0.055) ÷ 1,000 |
| Near-duplicate share | 19.3% | 18.8% = 150 exact + 38% of the 5%-edited |
| Matches, room's count | 6,254 | Must be equal, and are |
| Matches, lab's own count | 6,254 |
Sampling error. At 1 in 16, a 300-word document keeps about 18 windows, so one document's share is only good to about ±12 points. That is why the result reports shares of documents over thresholds and never a per-document score. Across the corpus the error shrinks with the square root of the count: on the 34,000 values here it is under half a point.
7Who learns what
| Learns | Cannot learn | |
|---|---|---|
| Lab | The totals in the result. The number of challenge values, which is the seller's sampled size rounded up to a multiple of 1,024. | Any seller text or window. Which seller documents overlap. Whether one particular text is in the seller's data, except through the totals. |
| Room | Which of the seller's sampled windows the lab holds, which it needs in order to count. The size of the lab's sampled set. | Any lab text. Any lab window the seller doesn't hold. |
| Seller | Nothing from the lab. | Anything about the lab's data. |
| A thief with every file | Sizes. | Everything above. Without a or b the values are indistinguishable from random. |
What the cryptography doesn't hide, and the rule that covers it:
| Residual leak | Rule |
|---|---|
| The total is information. A lab that committed only a few chosen documents could read from the result whether the seller holds them. | The room refuses a commit under 10,000 sampled values, allows 2 runs per lab and dataset before a person reviews, merges groups under 20 documents, and a person signs off on each result. |
| The room builds the challenge. A dishonest room could plant guessed windows and learn whether the lab holds them, one guess per value answered. | The lab sees the size of every challenge, can refuse one out of proportion to the dataset (--max-values), and can log each challenge it answered by hash. |
| A dishonest lab can answer with wrong values. | It only spoils its own result. |
A non-square challenge value could reveal the parity of a. | The reference fixes that bit, and a receiver must reject any element outside 2 … p − 2. |
| 64-bit window hashes can collide. | Expected false matches are (lab windows × seller windows) ÷ 264: about 0.0005 with 100 million sampled windows on each side. |
Each side still has to be trusted to run the protocol on the corpus it says it ran it on. The seller's side is tied down by the manifest root. The lab's side is the lab's own business, since it is the one that wants the answer.
8AI-content check
Every pack reports three rates for its text: the share dated before December 2022, the share of documents with chat-assistant artefacts, and the rate of post-2023 style markers per 1,000 words, measured against the same company's writing up to 2022. Using a company's own earlier writing as the baseline matters: a firm that always wrote formally shouldn't be scored against the internet's average.
The date is the strongest of the three, because ChatGPT was released on 30 November 2022 and a document written before then was not written by it. The check is deterministic, so a lab can run it on anything it receives and should get the same numbers. It is a screening signal with no measured error rate yet, and every datacard says so.
9Cost
The cost is one 256-bit exponentiation modulo a 2048-bit prime per value, and 256 bytes per value on the wire. For a corpus of W words in D documents:
values V ≈ W ÷ 16 + 16 × D lab computes V_lab + V_seller exponentiations, sends 256 × (V_lab + V_seller) bytes room computes V_seller + V_lab exponentiations per dataset
| Measured | |
|---|---|
| One exponentiation, one core, with GMP | 0.33 ms |
| Pure Python, no dependencies | 2.5 ms |
| A browser's built-in big integers | about 1.5 ms |
| End-to-end run in section 6 (68,143 lab values, 33,899 seller values, 4 cores) | 25 s, 53 MB exchanged |
Scaled up: a lab slice of 1 billion words in 2 million documents is about 95 million values, which is 24 GB of commit and under 9 core-hours, or about 16 minutes on 32 cores. One commit serves every dataset in a catalogue. Each further dataset costs the lab one answer: for a 50-million-word seller archive in 100,000 documents, about 26 core-minutes. Raising the sampling divisor lowers all of this in proportion and widens the per-document error.
10Prior work
What we took from each, and where this differs.
| Work | What it does | Relation to Grepped Proof |
|---|---|---|
| DH private set intersection Meadows 1986; Huberman, Franklin, Hogg 1999 | Two parties learn which items they share by blinding with commuting secret exponents. | Used directly, restricted to counts over thresholds. |
| Private Join and Compute Ion et al., Google, 2020 | The same blinding, deployed at scale to compute an intersection sum for ad attribution. | Same core. We add near-duplicate bands, a transcript hash, and the lab's own recount. |
| MinHash and LSH Broder 1997; Indyk, Motwani 1998 | Estimates document resemblance from small signatures. The standard tool for deduplicating pretraining corpora. | Used directly. Band values go through the same blinding as windows. |
| 13-gram contamination test Brown et al. 2020 | Flags benchmark items that share a 13-token run with training data. | Same unit, so results read the way a lab's own contamination checks do. |
| Certificate Transparency RFC 6962 | A Merkle tree that lets anyone prove one certificate is in a log. | Same tree, over a dataset's file hashes. |
| Datasheets for Datasets, Croissant Gebru et al. 2018; MLCommons 2024 | A structured description that travels with a dataset. | Our datacard is the same idea, with the difference that every number on it can be recomputed from the files and the card is signed. |
| C2PA Content Credentials | Signed provenance manifests attached to individual media files. | Same goal at a different grain: one signature over a whole dataset's manifest. |
| Data Provenance Initiative Longpre et al. 2023 | Audits the licences and lineage of public datasets after the fact. | We record the owner's statement at the source, before the first sale. |
| Data clean rooms AWS, Snowflake and others | Both parties load data into an environment a third party controls and run approved queries. | Not used for the lab's side. A lab won't upload its training corpus anywhere. |
| k-anonymity range queries Have I Been Pwned, 2018 | The client sends a hash prefix and gets every hash in that bucket. | Not used. It reveals a prefix of every item, which for a corpus-sized query adds up. |
| Enclave-based matching Signal contact discovery, 2017 | Runs the comparison inside secure hardware. | Not used. It moves the trust to a chip vendor. Here the trust rests on a published assumption. |
| BIG-bench canary string Srivastava et al. 2022 | A unique string that marks data as not-for-training and makes leaks searchable. | Used directly, one per pack. |
11Run it here
This page carries a second implementation of the exact-window part of the protocol, written from the description above. It runs in your browser and makes no network calls.
Test vectors
| Vector | Computed here | |
|---|---|---|
| Computing… | ||
Inputs: a SHA256SUMS of the files a.txt, b.txt and c.txt, each holding its own name; salt of 32 zero bytes; the sentence “The quick brown fox jumps over the lazy dog and then runs home again”; and w = 1.
Two texts
Paste any two texts. The page plays both parties with two separate secrets and shows each message as it would cross.
Small inputs are for seeing the mechanism. A real run refuses anything under 10,000 values, for the reason given in section 7.
12Limits
- No independent security review yet. The construction is a standard one, but this implementation hasn't been audited.
- Not constant-time. The reference code is for running on your own machine against your own files, not for a service that answers on request.
- It measures copied text, not knowledge. Paraphrase and translation are invisible to it (section 6).
- Overlap runs on extracted text. Images, audio and CAD files are covered by hashes and proofs only.
- The AI-content check has no measured error rate.
- The canary is per pack. Per-buyer canaries added at delivery are not in this version.
- The measurements on this page are on synthetic text. Real archives carry signatures, disclaimers and quoted replies that will match legitimately.
References
- K. Arrow, “Economic Welfare and the Allocation of Resources for Invention”, 1962.
- G. Akerlof, “The Market for ‘Lemons’”, Quarterly Journal of Economics, 1970.
- C. Meadows, “A More Efficient Cryptographic Matchmaking Protocol for Use in the Absence of a Continuously Available Third Party”, IEEE S&P, 1986.
- B. Huberman, M. Franklin, T. Hogg, “Enhancing Privacy and Trust in Electronic Communities”, ACM EC, 1999.
- M. Ion et al., “On Deploying Secure Computing: Private Intersection-Sum-with-Cardinality”, IEEE EuroS&P, 2020.
- A. Broder, “On the Resemblance and Containment of Documents”, 1997.
- P. Indyk, R. Motwani, “Approximate Nearest Neighbors: Towards Removing the Curse of Dimensionality”, STOC, 1998.
- T. Brown et al., “Language Models are Few-Shot Learners”, NeurIPS, 2020 (appendix C).
- B. Laurie, A. Langley, E. Kasper, “Certificate Transparency”, RFC 6962, 2013.
- S. Josefsson, I. Liusvaara, “Edwards-Curve Digital Signature Algorithm (EdDSA)”, RFC 8032, 2017.
- T. Kivinen, M. Kojo, “More Modular Exponential (MODP) Diffie-Hellman Groups for IKE”, RFC 3526, 2003.
- T. Gebru et al., “Datasheets for Datasets”, 2018.
- M. Akhtar et al., “Croissant: A Metadata Format for ML-Ready Datasets”, 2024.
- S. Longpre et al., “The Data Provenance Initiative”, 2023.
- A. Srivastava et al., “Beyond the Imitation Game” (BIG-bench), 2022.
Want to run it on real data?
Email e@grepped.ai and our team will send the seller kit, the lab kit, the one-file checker and the full spec.