Comment by crediblejhj
Hello HN!I made a vector database in C called Livero.
I wanted to make a database that can run on all local environments like laptop, mobile, and microcontrollers. Therefore I had to design for the smallest, a microcontroller.
There were lots of constraints in that environment, for example:
- It has small RAM size and may not have an MMU.
- It has small storage size and may not have a flash management layer.
- Crash can happen easily.
- Response time should be predictable.
- CPU is slow, similarity calculation may become a bottleneck in the high dimensions.
To fit in that environment, Livero uses ternary quantized vectors, flat search and asymmetric reranking for similarity calculation and allocates memory once at create/open. It also keeps two checksummed commit slots, so after a crash it recovers to the last flush and never reuses a record ID.
I tested all-MiniLM-L6-v2 (384 dimensions) and bge-base-en-v1.5 (768 dimensions) on macOS, and they showed 0.82-0.84 recall@10 with rerank_factor=2.
I also benchmarked on MacBook (macOS, M5), LG Gram (Fedora, Intel i7-1260P), and ESP32-S3-N16R8 (ESP-IDF with LittleFS). Brief top-10 query results are as follows:
- 678 µs on macOS (100K docs, postfilter)
- 956 µs on LG Gram (100K docs, postfilter)
- 37.6 ms on ESP32-S3-N16R8 (1500 docs, postfilter)
You can see more detailed recall and benchmark results in README.md and BENCHMARK.md.
I want to know if this idea has room to grow. There are embedding models that run on a chip, but I couldn't find a vector search engine built for one.
I'd love your feedback, especially on:
- Would you use on-chip vector search? For what?
- Is ~0.82 recall good enough, or should I keep the original vectors for reranking?
Thanks for reading!