Key takeaways
- Test reproducibility on fresh stores, not only on repeats. In our first test, repeats on one store never changed a result (0 of 227 probes), while fresh stores changed the top-10 order on 226 of 227.
- A quantized embedding model can make a vector depend on its batch. The same text, embedded in different batches, scored a cosine as low as 0.886 against itself.
- Break ties with a stable key, never a random id, in fusion and in the database alike.
- Label every difference by its cause before fixing anything. Of 116 probe readings, 75 differed only in a digest of a random id.
- Check the test's own inputs. Once our harness sent every store the same event ids, 94 of 94 searches returned one page across six fresh stores.
The need: memory that answers the same way twice
A memory layer is rebuilt more often than you might think: a restore from backup, a re-index after a model change, a second region, a test environment. If the same question gets a different top 10 after each rebuild, three things go wrong:
- The person sees memory that seems to change its mind. What was "the latest decision" yesterday is the third item today.
- Tests stop meaning anything. A pass or a fail can come from the copy, not from the change you are testing.
- Audits get harder. "Why did the agent see this note?" needs an answer that does not depend on luck.
So we set a line before measuring: the same synthetic world, loaded into three fresh stores, must give the same page for every search.
Our approach: compare fresh stores, then label each difference by cause
- Fresh stores, not repeats. Each store is built from nothing: a new database, the same synthetic events, the same code. Repeats on one store hide every cause that is fixed at write time.
- One page per probe. A probe is one search from our synthetic test world (EEC). We compare the served page item by item across stores.
- A cause for every difference. For each probe whose pages differ, a diagnostic logs each ranked row's score, time
and tie-break key, and labels the probe:
score_differs,tie_at_differs,tie_ref_only(equal scores and times, only the tie-break digest differs),cut_or_quota(an item is missing, or the cut falls differently), orother. - Lines first, and an outside review. Each fix had its pass line written before its run, and the decisions went to a council of AI models and a judge.
Why not just sort harder, or accept some drift?
- "Add more sort keys." We did, and it helped, but a sort key that is itself random (a fresh UUID per row) only moves the randomness. The key has to come from something that is the same on every copy.
- "Hash the content." Using the text as the tie key would make identical texts collide, and it ties the order to what is stored, which matters when a value must be erased. Our council rejected a content key.
- "Some drift is fine." Not for a memory that serves people under permissions and must explain why it served what it served. And without a fixed baseline, every later test inherits the noise.
How we tested it
- The data: a synthetic company world: 360 events and 227 probes in the first test, 288 events and 108 probes in the later arm runs. No real user text.
- The stores: three fresh stores per run, on the same build, with the same embedding model (arctic-embed-m-v2.0, int8).
- The checks:
- pages compared item by item across stores, and the verdict (whether the right note is found) compared too;
- for the test repair, two full runs with fixed ids, checked for identical ids in every repeat, no refused or duplicate event, and nothing else changed from the random-id run.
Results
First test (227 probes, 3 fresh stores, 20 and 21 Nov 2026):
- Repeats on one store: 0 of 227 probes changed.
- Fresh stores: the top-10 order changed on 226 of 227 probes, and the verdict on 9.
Cause 1: the embedding model depends on its batch. The int8 build of our embedding model made each vector depend on the other texts in its batch. Embedding each document on its own made every sampled stored vector identical across stores (60 of 60, against 0 of 60 batched). With that change, our second fusion's verdict changed on 0 of 227 probes, though its order still changed on 16.
Cause 2: ties broken by random ids. When two items score the same, something has to decide their order. In both the fusion step and the database queries, that something was a random id. A stable tie order in the database (score, then time, then a digest of the event id) brought order changes to 0 of 227 across fresh stores. It is not adopted yet: it slowed one vector search path by 11.81% at p95 against a 10% line, and a cheaper form we tried was slower still.
Cause 3: our test gave every store new event ids. One search still swapped two items across fresh stores. The diagnostic showed why (23 Nov 2026): the two items had equal scores and equal times, and only the tie-break digest differed. The digest is made from the event id, and our test harness sent every store fresh random event ids. Across all probes, with random ids:
| Label | Probe readings |
|---|---|
| identical | 25 |
tie_ref_only: equal scores and times, only the id digest differs |
75 |
cut_or_quota: an item missing, or the cut falls differently |
14 |
score_differs |
2 |
We changed the harness to derive each event's id from the synthetic world's own event (a UUIDv5 of a fixed namespace and the world id), then ran it twice, three fresh stores each (runs 23 Nov, read 28 Nov 2026):
- Identical ids for all 288 events in all six stores, with no refused or duplicate event, and nothing else changed from the random-id run.
- Every probe reading identical within each run: 0
tie_ref_only, 0cut_or_quota, 0score_differs. - 94 of 94 searches returned exactly one page across all six stores.
The cut_or_quota and score_differs probes went too, which we had not predicted: they were also downstream of the
ids. The product's code was the same in both runs; only the test's ids changed.
What failed along the way
- The swap was first recorded as a failure of the stable tie order. Two of the three council members called it a test defect at once. The judge asked for a diagnosis before any fix, and kept the failure on record until the diagnosis pointed at the test.
- A rebuild check still finds one difference. After the tie keys are rebuilt, every served page is identical, 96 of 96 in all three stores. But for one probe, the ranked rows just past the page (and their tie keys) change after the rebuild. With fixed ids this happens in every store, so it is ours to fix, and we are tracing which key changes.
- The stable tie order still costs too much. Its cost line fails, so it stays out of the served path.
What's next, and what we'd suggest
Next for Yukti Memory:
- find the tie key that changes after a rebuild, and make the rebuild give back exactly the keys written at ingest;
- a stable tie order that passes its cost line, then the reproducibility test again on that build;
- fixed world ids are now the default in every comparison run, so later tests start from a clean baseline.
What we'd suggest if you are testing an AI memory layer:
- Build fresh stores for reproducibility tests; repeats on one store prove almost nothing.
- Give your test harness deterministic ids. A random id in the test looks exactly like nondeterminism in the product.
- Label each difference by cause before changing code. A table of causes is cheaper than a week of fixes.
- Make the tie key stable and meaningful, such as time, then a digest of the source event id, never a fresh UUID.
- Embed one text alone twice, then in two different batches, before adopting a quantized embedding model.
Frequently asked questions
Why does my vector search return different results for the same query?
Common causes are ties broken by random ids, approximate indexes, and embedding models whose output depends on the batch. Compare fresh copies of the same data, and log each row's score and tie key, to see which one it is.
How do I make search results deterministic in Postgres?
End every ORDER BY with a key that is the same on every copy of the data, for example the item's time and then a
digest of its source event id. A random UUID as the last key makes the order random among ties.
Is a quantized embedding model safe for search?
It can be, but test it: embed the same text alone and in different batches, and compare the vectors. Ours drifted to a cosine of 0.886 in batches and was bit-identical alone.
What is a fresh-store test?
Load the same data into a new, empty store several times and compare results across stores. It finds causes that are fixed when data is written, which repeating a query on one store cannot find.