Navigation menu
FlyHash for LLM Agent Memory: An Empirical Validation and a New Application
FlyHash for LLM Agent Memory: An Empirical Validation and a New Application
Mohan Bheemadolu, Chrisogonas O. Odhiambo
2026-11-10▲ 4arXiv 2611.05791v1Hugging FaceCode
AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.
TL;DR
FlyHash beats SimHash on matched-active-bit retrieval quality across datasets and seeds, including under non-circular agent-memory labels, but does not translate into default memory or latency savings and is dominated by HNSW at ordinary scale.
Problem
LLM agents increasingly store external memories as dense embeddings searched by approximate nearest-neighbor methods, which scale with embedding size and dimensionality. FlyHash, a sparse random projection plus winner-take-all hash inspired by the fruit fly olfactory circuit, was previously reported to preserve neighbor structure better per bit than SimHash on benchmarks. The paper asks whether that quality advantage holds for LLM agent memory, whether it becomes a real memory or latency advantage including against HNSW, and whether it survives genuine non-circular relevance labels.
Method
The paper compares FlyHash, which uses a sparse random projection into m Kenyon cells followed by k-winners-take-all, against SimHash, which uses dense random hyperplanes and sign thresholding. It evaluates retrieval with mAP@R under a matched-active-bit protocol that holds the number of compared active bits k equal, while distinguishing this from equal physical storage and equal query-time budgets. Main evaluations use 10 random seeds, four datasets spanning text and image modalities, and a 36-configuration sweep over sparsity and pool size. The authors also build an end-to-end agent memory demo with remember/recall tools and report a separate systems comparison against FAISS IndexHNSWFlat on full-precision GloVe vectors. A labeled agent-memory benchmark uses 150 synthetic personas, 6,000 memory sentences, and relevance labels fixed by construction rather than embedding similarity.
Results
- Under the corrected matched-active-bit protocol, FlyHash outperforms SimHash at every tested bit budget on all four datasets, with all 20 dataset-bit-budget comparisons classified robust; on GloVe the ratio is 4.2× at k=16 and 1.5× at k=256. §4.1
- In the hyperparameter ablation, all 36 sparsity and pool-size configurations exceed the SimHash baseline at their bit budget; sparsity 0.20 is marginally better at larger budgets, and increasing pool size beyond roughly 8× the bit budget yields diminishing or slightly negative returns. §4.2
- Dense FlyHash codes are m bits wide with exactly k active bits, so the default dense representation stores a near-constant about 250 bytes per record and takes a near-constant about 13 ms per query, 10–70× slower than SimHash at the same k. §4.3
- The sparse-set comparison is 10–22× faster than dense FlyHash and scales with k, but SimHash remains 2–5× faster at every tested budget and explicit index-list storage remains about 16× larger than SimHash’s bit-packed code. §4.4
- In the separate HNSW systems comparison on GloVe, HNSW reaches mAP@100 above 0.98 with sub-0.1 ms queries at about 1.6× the exact-storage memory cost, dominating both hash methods at that scale. §4.6
- On the labeled agent-memory benchmark with 150 queries and 6,000 memories, FlyHash beats SimHash robustly at every bit budget, including 0.195 vs. 0.038 at k=16 and 0.392 vs. 0.345 at k=256. §4.7
Limitations
- The paper states that the sparse-set comparison recovers most but not all of the speed disadvantage and leaves a meaningful memory disadvantage; a genuinely sublinear index and more compact active-index encodings remain unbuilt.
- The HNSW comparison is a single-scale, single-configuration snapshot on GloVe with 5,000 records and one HNSW configuration, and the paper says it has not swept very different corpus scales.
- The paper explicitly omits SIFT1M as a deliberate scope decision, and it does not implement DenseFly’s densification or BioHash’s learned projection, nor benchmark against vector quantization methods.
- The labeled agent-memory benchmark uses templated synthetic text and a TF-IDF plus SVD embedding rather than naturally occurring language or a real sentence-transformer, and the end-to-end latency result is a single data point on one machine.
Key points
- The central pitfall is conflating FlyHash’s active-bit count k with its pool size m; a naive sweep that fixes m and a winner-take-all percentage gives FlyHash far fewer active bits than SimHash at the same nominal bit value. §3.2
- The protocol separates equal active or output bits, equal physical storage, and equal query-time or resource budget, and the main quality comparisons use the matched-active-bit notion. §3.2
- The statistical protocol repeats main evaluations across 10 seeds, reports mean and standard deviation, and adds a paired GloVe analysis with t-interval, bootstrap, Cohen’s dz, Wilcoxon, and permutation tests. §3.4
- The paired GloVe analysis reports a mean FlyHash-minus-SimHash difference of 0.1485 at k=16 with a t-interval of 0.1421 to 0.1549 and Cohen’s dz of 16.6. §4.1
- The agent memory demo wraps a sentence-transformer embedding model and FlyHash-backed store behind remember and recall tools, and retrieves a fact shared several turns earlier in a representative interaction. §4.5
- In the end-to-end pipeline latency measurement, sentence embedding takes 14.1 ms and 68.8% of total time, FlyHash hash plus sparse rank takes 6.4 ms and 31.2%, and total end-to-end time is 20.5 ms per query. §4.5
- The discussion argues the quality advantage is largest at low bit budgets, but a quality advantage is not automatically a resource advantage, and HNSW should likely be used instead of either hash when there is no unusual storage constraint. §5
- Appendix A reports that the reproducibility discrepancy was caused by the k-versus-m conflation, and it explicitly retracts an earlier hypothesis that FlyHash specifically benefits from correlated, non-negative features. §A
Mind map
Sign In
Choose a method to continue
By signing in, you agree to our Terms and Privacy Policy

