khora-accel Rust extension (built on PyO3) handles these natively, with zero-copy NumPy access, GIL release during compute, and Rayon work-stealing parallelism across cores.
It’s entirely optional: if Rust isn’t installed, Khora falls back transparently.
The 3-tier fallback
Every accelerated operation has three implementations. The fastest available is chosen automatically at import:
Force a tier with the
KHORA_ACCEL_BACKEND env var: rust, numpy, or python (unset = auto-detect). python is handy for debugging.
Installing
khora-accel wheel is pinned in lockstep with Khora’s own version. Install the matching pair. Verify it loaded:
What’s accelerated
khora-accel ships ~40 functions across vector math, string similarity, ranking, and graph ops. Indicative speedups over pure Python:
These power entity dedup, skeleton indexing, MMR diversity selection, and RRF fusion, so the benefit shows up across both ingestion and query.
Thread pool tuning
Rayon uses one global thread pool per process. Size it for your workload before any parallel work runs:When it matters
- Large-scale ingestion (>1,000 docs): entity resolution and pairwise cosine dominate, and Rayon scales near-linearly across cores.
- Skeleton indexing: PageRank and keyword extraction run every ingest batch.
- High-volume query: BM25 and RRF fusion benefit at >10k indexed documents.
- Small workloads (under ~100 docs): the NumPy/Python tiers are plenty, and Rust is unnecessary (but harmless).
Integrations
Wire Khora into CrewAI, LangGraph, Google ADK, OpenAI Agents, or LlamaIndex.
Performance & scaling
Where Rust acceleration fits among the other scaling levers.