TeardownOct to Nov 2026Solo project
AeroIntel
A RAG system for aircraft maintenance that answers only from the manual, and refuses in code when the manual doesn't cover the question.
- recall@5 on 35 answerable questions
- 1.000
- numeric answers with a figure missing from the cited page
- 0 of 24
- must-not-answer questions caught after the distance gate
- 17/17
Move the refusal gate
Drag the distance gate and watch what each kind of question does. The distances are the real examples from AeroIntel's evaluation.
- Weld questionclosest chunk 0.422, answer chunk 0.495
Answered from the right page
- Near-topic questionsthe manual covers the subject, not the figure asked
100% pass the gate, then the answer check catches 17 of 17
- Closest chunk at 0.495the README's example of a refusal
Refused, the model is never called
At AeroIntel's 0.48 every near-topic question passes the gate. They're caught by the answer check, which reads the passages and asks whether they answer the question.
The problem
A maintenance assistant that invents a torque value or a wire gauge is dangerous. The model has to answer from the manual, cite the page, and say so when the manual doesn't cover the question.
How I built it
Built stage by stage. Each stage had to pass its own verify script before the next one started.
Refusal is structural. The model only sees numbered passages from the database, and if the closest chunk is further than 0.48 it is never called.
Hybrid retrieval: Postgres full-text search and pgvector merged with Reciprocal Rank Fusion, then re-ranked by a cross-encoder. Answers must carry [n] citations, and code checks every figure against the cited passage.
A FastAPI service with async SQLAlchemy and Alembic, Redis token-bucket rate limiting in an atomic Lua script, JWT scopes, idempotency keys, SSE streaming, and timeouts, retries and a circuit breaker around the local Ollama model. Docker and CI.
What happened
- Measured on FAA AC 43.13-1B: 756 pages, 1,749 chunks, 35 questions that should be answered and 32 that must not be.
- The right page was in the top 5 for every answerable question (recall@5 1.000, MRR 0.859).
- 15 of the 32 must-not-answer questions were refused before any model call. The answer check caught the other 17 of 17.
- 0 of 24 answers with numbers contained a figure missing from the cited passage.
- The hard finding: 12 near-topic questions sit closer to the manual than many correct answers (distance 0.33 to 0.47), so no distance threshold can separate them. They are caught by reading the passages instead.
Architecture
- Python
- FastAPI
- PostgreSQL
- pgvector
- Redis
- Ollama
- SQLAlchemy
- Docker
- GitHub Actions
Next teardown
Energy Bill Extractor
The model reads, code checks