Research
tiervec
A study of vector search for agent memory, where vectors change all the time. Every idea tried is listed with its bar and its result, failures included.

Question
A vector index for a memory that keeps changing.
An AI agent that remembers stores what it learns as vectors: lists of numbers that put similar texts close together. To recall something, it looks for the stored vectors nearest to a question. A vector index is the structure that makes that search fast.
Most vector indexes are built for large collections that change slowly, such as the documents behind a search engine. An agent's memory looks different. There are many small collections, one per user or task. Writes, deletes, and updates arrive in a steady stream. A search must see a write at once, because the agent may ask about what it has just stored.
tiervec asks what a vector index for that workload should look like when it runs inside a database engine, in the same process. It is a Java library, and the first engine it is meant for is ArcadeDB. It is not wired into any engine yet.
Approach
An exact tail, sealed segments, and a plain scan for small collections.
New vectors go into a small buffer, the tail. A search scans the tail exactly, so the next search finds a write without waiting for an index to be built.
When the tail is full, its vectors are sealed into a segment: a graph index (HNSW, the usual graph design for vector search) that never changes again. Segments are merged in the background and swapped in at once, so a search never waits for a merge.
Below a size threshold no graph is built at all, and every search is an exact scan. For a small collection, a scan is exact and needs no graph to build or keep up. Each collection gets its own index.
A delete or an update leaves a marker with a version, which also covers an id that the database reuses after a delete. The database stays the source of truth: the index can rebuild everything it holds from the database's rows, so transactions and recovery stay with the database.
The tier policy says which search algorithm and which vector codes each tier uses, which methods from research and other software could serve each one, and which studies would decide. It changes no default. Its reading of the evidence so far: under churn and at these sizes, the shape above holds, and the strongest candidate change is a compact code for sealed segments.
Measured
Recall at 100,000 and about 1,000,000 vectors.
Recall@10 is the share of the true ten nearest vectors that a search returns. These runs measure recall only. Each setting was built once, on low-power or efficiency cores of a laptop, in runs that were not timed studies, so they say nothing about speed.
Recall@10 at the default search setting (ef 100), one build each. The real set has 999,000 vectors in its large size.
| Data | 100,000 vectors | About 1,000,000 vectors |
|---|---|---|
| Real embeddings: DBpedia texts with OpenAI embeddings, cut to 768 dimensions, 1,000 queries | 0.9943 | 0.9763 |
| Generated clustered data, 768 dimensions | 1.0000 | 0.5830 |
On the real embeddings, recall fell by 0.0180 from the small size to the large one. The bar written before the runs allowed 0.03, so this run shows no drop with size. On the generated data, recall fell to 0.5830. A larger build there (M 32 and efConstruction 400) brought it back to 0.8385, and one rebuilt segment in place of the merges did not. On that data, that points at the build settings, not at the merges.
The result files are in results/106/real and results/106/synthetic. The evidence page prints its tables from them, with the commit, the command, and what each study does not claim.
A second study asked whether a merge that inserts into the largest segment can replace a full rebuild. At 100,000 rows of the real set, with one search thread and 10 generations of writes, it missed the bound on search latency in both cells with deletes, so the rebuild stays the default (results/16).
A third comparison counted the work of tiervec's merges against the compactor of JVector, which a branch of ArcadeDB uses, through ten merges with deletes and new rows (results/249). On real embeddings at 100,000 rows and on 1,000,000 generated rows, the merge that inserts into the largest segment did 2.00 to 79.34 times fewer distance computations than the compactor. At a narrow search beam (ef 10) on the 1,000,000 rows, the compactor lost 0.0183 to 0.0446 of recall over the merges and left 71 to 159 live rows that a walk from the graph's entry no longer reaches. Both tiervec merges stayed within the recall bar of 0.01 and left no such row. The insert merge has a weakness of its own: the rows that a search with their own vector misses grow over the merges (#283, open). The run counts work, one run per arm, and times nothing.
Screens
Twenty-three ideas, each with a bar written before it ran.
Before an idea goes into the library, it runs on a screen: short runs on GitHub Actions over small collections, most of them generated, with writes, deletes, and updates mixed in, and three seeds each. A screen counts recall and work (distance computations and bytes held), not time. The bar of each idea is written down before its first run. An idea that fails stays on the list with its numbers, so it is not tried twice.
Every idea on the screen so far. Passed and failed are against the bar written before the run.
| Idea | What it tried | Result |
|---|---|---|
| S1 | One graph updated in place, with the pruning setting alpha at 1.2 | failed: lower recall under churn |
| S2 | A merge that inserts into the largest segment instead of rebuilding | failed: the recall bar was missed with one seed of three |
| S3 | Smaller memory chunks for a small graph | passed; not merged |
| S4 | alpha above 1 in two passes, as in DiskANN's code | passed; in the library |
| S5 | Repair of rows with few neighbours, after Lucene | failed: no recall gain |
| S6 | One graph kept through 15 turnovers of its rows, against a rebuild | failed: thousands of rows became unreachable |
| S7 | A filtered walk that scores only allowed rows (ACORN, as in Lucene) | failed |
| S8 | The adaptive filtered walk of NaviX | failed |
| S9 | The long churn of S6 with the two-pass alpha of S4 | failed: rows became unreachable |
| S10 | A search beam for each segment, sized by its rows | failed: lower recall |
| S11 | One shared beam over all segments, after Lucene | failed: lower recall |
| S12 | A spanning tree that keeps every row reachable | failed: no row was lost, but the recall bar was missed |
| S13 | A plan for each filtered query, picked from two samples of the filter | failed: the cost bar was missed |
| S14 | Compact codes in memory, full vectors left in the files on disk | passed; the settings exist, not yet recommended |
| S15 | An exact scan when a filtered walk runs past its budget, as Lucene does | passed; in the library |
| S16 | The filtered walks of S7 and S8 again, after S15 | failed: the recall bar was missed |
| S17 | The long churn with alpha and the repair of S5 together | failed: rows became unreachable |
| S18 | Filtered searches across clusters over the long churn (a measurement) | failed: far below the recall of a rebuild |
| S19 | Filtered search over a range of allowed shares on real embeddings (a measurement) | met its recall bound; no change to the library |
| S20 | One bit per dimension, in the way of RaBitQ, with an exact rerank | passed; no time measured |
| S21 | As S20, with a rerank bounded by the error of the estimate | passed; no time measured |
| S22 | One extra random link per row, to keep clusters connected | failed: the cost bar was missed |
| S23 | The extra link of S22 on real embeddings, up to 100,000 rows | passed: the graph without it also kept every row reachable; not merged |
Each idea's source, bar, and numbers are in the list of ideas, which links the results of each one: for example S4 and S15, the two that changed the library.
Seven passed, S19 met its bound, and fifteen failed. Many of the failures (S1, S5, S6, S9, S12, S17, S18, and S22) are about one graph that is updated in place through many writes. In the long runs on generated data (S6, S9, and S17), such a graph lost the links between clusters, until thousands of rows could no longer be reached. On real text embeddings (S23), the same graph kept the recall of a rebuild, with no unreachable rows, up to 100,000 rows. A re-screen of the earlier failures on that real data is under way. The default tier never changes a graph after it is sealed: a merge rebuilds it from the live rows.
A separate comparison asked whether one graph updated in place beats the segments (the results). The challengers were tiervec's own graph, JVector, and Lucene, three seeds each, under a rule written before the runs. On the two collection shapes that the rule judges, none of them beat the segments: each either lost recall or did more work per write. This is a screen on generated data, with no timing.
A later run counted lost rows: live rows that a search with the row's own vector no longer finds (the run). It used 10,000 generated rows of 768 dimensions through 15 turnovers, with three seeds and no timing. At its worst checkpoint, the default tier lost 4 to 7 of the 10,000 rows and the exact scan lost none. One graph updated in place lost 148 to 262, a new graph built at every checkpoint lost 36 to 59, and Lucene lost 92 to 216, while Lucene's mean recall stayed at 0.9847 to 0.9897. The mean recall can hide rows that an agent would lose.
The result files of every cited run are kept in the repository, with an index, because GitHub deletes the files of a run after 90 days.
Open questions
What is not known yet.
How large is an agent's memory? The design assumes that a memory per user holds hundreds to a few thousand vectors. That assumption rests on three benchmark datasets that their authors built or edited (Mem0's evaluation, LoCoMo, and LongMemEval). No source read so far measures a memory in real use. The exact path and one index per collection depend on it, so it is the first assumption to confirm (the credibility check).
Speed. Timed studies exist only for narrow questions: the merge policy (#4), a seal beside a large merge (#216), the cost of a fixed order of the lane sums in the kernels (#169), and when a filtered search should scan first (#12). Their files are in results/. The last one changed a default on the main branch: a filtered search whose sample says that the filter allows at most 2% of a segment's rows now scans the allowed rows exactly from the start (filterScanBelow 0.02). On one laptop, all 135 cells at shares up to 2% were faster by median time, and none of the 243 cells was slower or lost recall. No general speed claim is made, and nothing is measured at 10,000,000 vectors.
Writers at scale. Concurrent readers and writers are tested at small sizes only.
Is it the best index for agent memory? That is not shown. The agent-memory benchmark is built: it replays a stream of creates, updates, deletes, searches, filtered searches, and restarts, and counts recall, lost rows, and work. What it lacks are its timed parts, real embeddings, and a study of many collections.
Inside an engine. No database engine runs tiervec yet.
Papers
A software paper and a preprint, planned.
Two papers are planned. One is a short software paper for the Journal of Open Source Software (JOSS). The other is a systems and measurement paper, posted on arXiv when the JOSS paper is submitted. JOSS takes a submission only after the repository has been public for six months, so neither comes before that. Nothing is submitted yet.
How to install and use the library is on the tiervec software page.
Resources