Skip to content

Axon

Axon is a retrieval augmented generation engine with swappable stages and a benchmark harness whose committed result files back every table.

On this page

I asked a search engine to prove it was good. It brought numbers, some of them rude. Axon is a retrieval augmented generation engine with a benchmark harness attached, started in September 2026, built so that every choice inside it can be swapped out and then measured against the thing it replaced.

Every stage is a socket

A retrieval pipeline is a chain of opinions. How to load a file, where to cut it, which model turns a chunk into a vector, who gets to rerank, who writes the answer. Most projects fuse those opinions into one script, and then nobody can say which one was wrong.

In Axon each stage sits behind a Python protocol and registers under a name, so configuration picks the opinion.

StageWhat plugs in
LoaderMarkdown, HTML, PDF
Chunkerrecursive, sentence window, semantic, LangChain
Embedderint8 ONNX, or sentence-transformers
Vector storeexact in memory, pgvector, Chroma, Pinecone
Keyword searchPostgres full-text, or in-memory BM25
Rerankerint8 ONNX cross-encoder
Generatora chain of OpenAI-compatible providers
Cachein memory, Redis or Upstash
Conversation memoryPostgres

A sketch of the configuration, written for this page:

title="sketch"yaml
chunker: recursive
embedder: onnx
vector_store: pgvector
sparse: pg_fts
reranker: onnx

Postgres is the system of record: text and the keyword index stay there, while a vector store holds only chunk ids, vectors and filter metadata. pgvector, with its HNSW index, is one answer to “where are the neighbours”. Swapping the store changes who answers that question and nothing about what a chunk is.

Ingest that survives being interrupted

The order of writes is the whole trick, so here it is.

sequenceDiagram
    participant R as Ingest runner
    participant M as Run manifest
    participant E as Embedder
    participant P as Postgres
    participant V as Vector store
    R->>M: which documents are done?
    M-->>R: content hashes
    Note over R: skip those, chunk the rest
    loop each batch
        R->>E: chunk text
        E-->>R: vectors
        R->>P: documents and chunks
        R->>V: vectors under chunk ids
        R->>M: mark documents done
    end

Text lands before vectors, so a vector never points at a chunk that is missing. The manifest is written last, so after a crash the unfinished documents are done again and the finished ones are skipped. Chunk ids derive from content, which means the redo overwrites instead of duplicating, and re-ingesting unchanged content does nothing. That is the most underrated feature a pipeline can have.

The embedder and the reranker are small int8 ONNX models run directly through onnxruntime and a tokenizer, with no heavyweight framework in the serving path. Each is pinned to a revision and its download is checked against a SHA-256. A model that quietly changes upstream is a benchmark that quietly changes meaning.

Two searches, one ranking

Dense search finds passages that mean something similar. Sparse search finds passages that use the same words. Axon runs both at once and merges them.

flowchart TD
    Q[Question] --> D["Dense: similar meaning"]
    Q --> S["Sparse: same words"]
    D --> F["Reciprocal rank fusion"]
    S --> F
    F --> H["Fetch chunk text from Postgres"]
    H --> X["Cross-encoder reorders the head (optional)"]
    X --> O[Ranked sources]

Fusion looks only at positions: a chunk earns 1 / (60 + rank) from each list it appears in, and the sums are sorted. Scores from the two searches never have to be comparable, which is convenient, because they are not. Each branch offers 50 candidates. Fusion happens in Python, so it behaves the same over every store. If one branch fails, or the reranker does, the query carries on with what is left and the response says which stage degraded.

When the free tier says no

The design constraint is that Axon should run on free tiers. So what happens when the daily allowance for the language model runs out?

flowchart TD
    Q[Question] --> C{"One-off and already answered?"}
    C -- yes --> A[Serve the cached answer]
    C -- no --> R[Retrieve sources]
    R --> G{"Sources, model and quota?"}
    G -- no --> P[Serve the passages alone]
    G -- yes --> T[Stream the answer]
    T -- "provider fails before any text" --> P
    T --> K["Resolve numbered citations"]

Generation stops and the service keeps serving. If the quota counter itself cannot be reached, the answer to “quota?” is no, since spend that cannot be metered is spend that does not happen. A citation pointing at a source that does not exist is stripped and noted. Close the browser tab and the upstream model call is closed too, because paying for an answer nobody is reading is a strange hobby.

Every request carries a trace with stage timings, degradation flags and the ranking as it looked after each stage. A FastAPI service streams it over server-sent events, and the Next.js app reads it in four views: chat, a retrieval inspector, a pipeline playground and a benchmark dashboard.

A retrieval augmented generation benchmark, small and honest

The harness runs on two public BEIR test sets, SciFact with 5183 documents and 300 queries, and NFCorpus with 3633 documents and 323 queries. The retrieval ablation uses one chunk per document and exact search in memory, so no database gets to blur the comparison. Postgres full-text search needs a database, so its two rows were run separately.

Variant (nDCG@10)SciFactNFCorpus
BM25 in memory0.6520.306
Dense0.7050.343
Hybrid, BM250.7010.352
Hybrid plus reranker0.6880.357
Postgres full-text alone0.0720.206
Hybrid, Postgres full-text0.7080.361

Two things survive that caveat. The reranker costs seconds per query here, under heavy load, and on SciFact it lowered nDCG. And Postgres full-text search alone returned nothing for 274 of the 300 SciFact queries.

The store comparison, one run per store on SciFact, asks how much of the exact top ten an approximate index keeps.

Store and settingMean keptWorst query
pgvector, narrowest search width tried0.9060.10
pgvector, default search width0.9860.70
pgvector, widest search width tried0.9990.90
Chroma, local0.9940.90
Pinecone0.9970.90

Read the last column before trusting the middle one. An average of 0.906 can hide a query that kept one result in ten.

Then generation. A RAGAS run asked 30 questions over three documents. The generator was a local half-billion-parameter model, judged by Claude Haiku.

xychart-beta horizontal
    title "RAGAS means, 30 questions, one run"
    x-axis ["Context recall 0.939", "Context precision 0.872", "Answer relevancy 0.709", "Faithfulness 0.623, n=27"]
    y-axis "score" 0 --> 1
    bar [0.939, 0.872, 0.709, 0.623]

The two retrieval scores came out higher than the two answer scores. Faithfulness covers 27 of the 30 answers, the ones that were scored. An earlier round let the small model grade its own answers, and it called plainly wrong ones faithful. Letting a model grade its own homework remains a bad idea.

The part that keeps the tables straight

Benchmark datasets are pinned by hash and checked on load. Result files record library versions and machine load, and the retrieval ablation commits its ranked lists alongside the metrics. The metric code was cross-checked against pytrec_eval on the dense runs: recall matched exactly and per-query nDCG differed by at most 2.2e-16. The results block in the README is generated from those files, and a check mode fails when it goes stale.

Where it stands

Axon is a version 0.1 development build. It is not deployed, it has no live demo and it is not on PyPI. The LangChain retriever adapter is not written. What exists is the library, the command line, the API, the web app and the benchmarks.

For the database underneath, how database indexes work covers why an index is fast, and HNSW is the same bargain with one extra clause: it is allowed to be slightly wrong.