Topological vector search for edge runtimes. 24KB gzip.
Runs in Cloudflare Workers, Deno, browser, Node.js — with no server, no API keys, no infrastructure. Built in Rust, compiled to WASM. Ships HNSW + RaBitQ 4-bit quantization + Betti-0 topological reranking.
| Metric | palace-edge |
|---|---|
| Bundle (gzip) | 24 KB |
| Retrieval latency | 26 µs |
| Recall @ 10 (SIFT-100K) | 98.7% |
| Memory per vector (4-bit) | 80 B |
| NEON Hamming throughput | 290M ops/s |
| Cloudflare Workers limit | 128MB — your budget after import: 127.97MB |
vs Python-based engines shipped as WASM: >2MB bundle, >1ms latency, ~5KB/vec.
Topological reranking — Betti-0 component coverage second pass. Finds diverse results across connected semantic clusters that cosine similarity collapses. Not in FAISS, Qdrant, Milvus, or usearch.
4-bit RaBitQ asymmetric quantization — 80B/vec with 98.7% recall. 6.4× smaller than float32, no accuracy cliff.
npm install palace-edgeimport init, { PalaceIndex } from "palace-edge";
await init();
const index = new PalaceIndex(384, 16, 200); // dim, M, ef_construction
// Insert
index.add(0, new Float32Array(embedding));
// Search — standard HNSW, returns Uint32Array of ids (nearest first)
const ids: Uint32Array = index.search(queryVec, 10, 50);
// Search — topological rerank (Betti-0 component diversity)
const ids: Uint32Array = index.search_topo(queryVec, 10, 50);
// Persist — serialize to bytes for KV storage
const bytes = index.serialize();
const restored = PalaceIndex.deserialize(bytes);import init, { PalaceIndex } from "palace-edge";
import wasm from "./palace_edge_bg.wasm";
export default {
async fetch(request: Request, env: Env): Promise<Response> {
await init(wasm);
const bytes = await env.KV.get("index", "arrayBuffer");
const index = PalaceIndex.deserialize(new Uint8Array(bytes!));
const query = new Float32Array(await request.arrayBuffer());
const results = index.search_topo(query, 5, 30);
return Response.json({ results: Array.from(results) });
},
};Memory budget at Cloudflare Workers free tier: 128MB. palace-edge uses ~0.03MB of that.
import init, { PalaceIndex } from "npm:palace-edge";
await init();
const index = new PalaceIndex(1536, 16, 200); // OpenAI ada-002 dimensions| Runtime | Status |
|---|---|
| Cloudflare Workers | ✅ |
| Deno | ✅ |
| Browser (offline) | ✅ |
| Node.js 18+ | ✅ |
| Bun | ✅ |
cargo install wasm-pack
wasm-pack build --release --target bundler
# output: pkg/ (~69KB uncompressed, 24KB gzip)palace-edge is the WASM frontend of Palace-X — a bare-metal Rust vector search engine with topological reranking, RaBitQ 4-bit quantization, and NEON SIMD.
The same algorithm. Different deployment target.
MIT © Maksym Dyachenko, Kyiv