# Xtriever

A hybrid retrieval engine for retrieval-augmented generation, written in Rust to run on-device on a phone or a laptop, combining lexical BM25 search, dense embedding search, reciprocal-rank fusion and cross-encoder re-ranking with no server.

Xtriever is a hybrid retrieval engine for retrieval-augmented generation, written in Rust and built to run entirely on the device doing the searching, whether that is an iPhone, an Android phone or a laptop, searching its own local index offline with no server and no network. A query passes through lexical search using BM25 over tantivy, dense search using an eight-bit-quantized MiniLM embedding model run in-process, reciprocal-rank fusion of the two result lists, and a cross-encoder re-ranking pass over the head of the fused list.

The same engine is reachable from Rust, Python, Swift and Kotlin, returning identical results and scores on one machine across every language surface, and demo applications search an index of Simple English Wikipedia on a laptop, an iPhone and an Android phone. If a later stage such as the dense search or the re-ranker fails or runs out of its time budget, the search degrades to the previous stage's results and reports that it did so, rather than failing outright, unless a strict mode is requested instead. The project is at an early, unpublished version, with an optional sparse-expansion stage and a learned-ranking stage still incomplete.

Website: https://github.com/mirth/xtriever
