Draft-model cascades for faster speculative decoding
A short summary written at ingest, sized to the reader's chosen depth, so the card can be judged without opening it.
Applied AI • Personalized research platform
A research feed that explains every pick, and an assistant that cites its sources or says it doesn't know. I built it alone, from first commit to production. It finds AI and ML reading for each user, ranks it against their interests, learns from their feedback and keeps their sources in a private library. Every answer is grounded, cited and checked against a 143-question evaluation set before release.
Role
Sole engineer: product, backend, ML, frontend, infra
Timeline
Jun – Oct 2026 · 178 commits · 45 PRs
Stack
FastAPI · Celery + RabbitMQ · PostgreSQL + pgvector · Next.js 14
Status
RAG v1.2 released · deployed from CI
The "% match" badge is semantic relevance between the item and the reader's interests. The full score is five weighted factors, saved with the recommendation as a trace, so the explanation is read back from stored data rather than written after the fact.
A short summary written at ingest, sized to the reader's chosen depth, so the card can be judged without opening it.
01 — Problem
An engineer following AI research has arXiv, lab blogs, newsletters and news sites to keep up with. Collecting all of it is easy. Deciding what deserves an hour of attention today is the hard part, and most feeds hand that decision back to the reader.
The tools that do decide tend to hide their reasons, so a bad pick can't be corrected. Chat assistants have the opposite problem. They answer confidently whether or not the reader's sources support the answer.
"Reinforcement learning" means different papers to a robotics student and a quant. A shared ranking serves neither of them well.
When a reader can't see why an item surfaced, their feedback has nothing to act on. The model drifts and they lose trust in it.
A fluent answer about the wrong product version costs more than "I don't know". The assistant has to know when to refuse.
02 — Solution
DeepFeed splits the job into a feed that decides, a library that remembers and an assistant that answers. All three share the reader's interests, feedback and saved sources, so a signal from one improves the others.
Feed
A research agent searches the reader's sources and the open web, then reads, summarizes and ranks what it finds.
Library
URLs, PDFs, DOCX, HTML, Markdown and notes become immutable documents. Each one is chunked, embedded and searchable.
Ask DeepFeed
A streaming assistant answers from the feed and library together, with an inline citation in every paragraph.
Interests → research plan → discovery → ranking → feedback → learned preferences. Agents run the loop nightly. Each change they make is saved as an AdaptationEvent with a reason, a confidence and before/after values, so the feed's drift can be audited.
03 — Architecture
One FastAPI codebase serves the API and also runs in the Celery workers, so a ranking pass behaves the same whether a request or the scheduler starts it. PostgreSQL holds everything: relational records, full-text indexes, 1536-dimension embeddings, job state and the dispatch outbox. RabbitMQ only carries messages. A lost message can always be recovered from the database.
Video — Architecture walkthrough: layers, boundaries, and how requests flow through the system
FIG 02 — System architecture. Pick a path to trace one journey; open full view to zoom.
04 — Techniques
The retrieval pipeline below is the version the evaluation measures. Every setting here was either set by an eval run or is listed as a known limitation.
[E#] citation in every paragraph, at temperature 0. A small gate holds back the first characters so the INSUFFICIENT_EVIDENCE marker never flashes on screen.done eventEach check is cheaper than the next. Most answers pass at the first step.
E#. No URLs, and no other brackets.reset event.Interests now dominate the score. The old weights let credibility and freshness fill the feed with off-topic items.
Calibrated on 206 live items. Items below 0.15 relevance keep only half their score.
05 — Engineering decisions
knowledge_dispatches) and database leases with fencing tokens. A maintenance task republishes due work every 15 seconds.RecommendationTrace per recommendation (factor scores, weights, matched interests) and an AdaptationEvent per agent change (reason, confidence, before/after).reset and a repaired answer follows. The turn is saved before done.traceparent saved on knowledge jobs so the trace continues across the outbox. Each service exports Prometheus metrics.06 — Trade-offs
| Chose | Over | Cost accepted | Revisit when |
|---|---|---|---|
| Support check before every answer | Trusting citation structure | About 6–7% false abstention on answerable questions, plus an extra model call | A semantic near-miss detector beats it on a held-out set |
| Exact cosine scan | HNSW / IVFFlat index | Linear cost per query as a library grows | Personal libraries reach tens of thousands of chunks |
| Byte-based token budgets | Model tokenizers | The window is conservative, about 4 bytes per token | Multiple providers need exact per-model budgets |
| gpt-4.1-mini as judge | gpt-4.1 | 1–4 points stricter on correctness. Only numbers from the same judge are compared | Never mixed. Every run was re-judged after the switch |
| One global active index | Per-user index versions | A re-index migrates every library together | Users need different embedding models |
| Single-host Compose | Kubernetes, managed services | Rate limits and caches are process-local, and storage is a shared volume | A second API replica is needed (move to Redis and object storage) |
| Rank-only fusion, no reranker | Score fusion, cross-encoder | A strong single-channel match carries no extra weight | Hit@10 is already 97.3%, so answer quality is the bottleneck, not recall |
07 — Evaluation
RAG quality was measured on a fixed corpus in an isolated stack. The corpus is 97 Wikipedia articles across nine AI topics plus 13 fictional documents about products and organizations that exist nowhere else. Questions about them can only be answered from retrieval, never from what the model already knows. The fictional documents include near-duplicate traps such as Petrel X3 and X4, Quillnet v1 and v2, and Marlowe-7 base and instruct.
143
Golden questions · 73 answerable, 70 not
97.3%
Retrieval Hit@10 · MRR 0.795
97.1%
Best correct abstention, knowledge chat
0
Production errors per run, down from 4–5
What is the maximum flight time of the Petrel X3?
31 minutes with no payload E1
Trap: the Petrel X4 field manual says 38 minutes. That figure is listed as a forbidden fact.
What is the Petrel X4 Pro's return-to-home altitude?
My sources don't cover the X4 Pro. They give figures for the X4 only.
At v1.0 the system answered with the X4's 60 m and the support check accepted it. The identifier guard was built to catch this.
Each bar spans two independent runs. A gate passes only if it passes in both. Each release added freshly written unanswerable questions, frozen before that release's fixes were designed.
FIG 03 — Correct abstention per release candidate, two runs each
| Gate | Threshold | Run 1 | Run 2 | Result |
|---|---|---|---|---|
| Retrieval Hit@10 / Recall@10 / MRR@10 | ≥ 90% / 85% / 0.70 | 97.3 / 96.6 / 0.795 | same | PASS |
| Knowledge: correct abstention (70) | ≥ 95% | 95.7% | 97.1% | PASS |
| Knowledge: citations resolve / on expected doc | 100% / ≥ 95% | 100 / 100% | 100 / 99.2% | PASS |
| Knowledge: unsupported claims (judge) | ≤ 5% | 4.0% | 3.3% | PASS |
| Assistant: correct abstention (70) | ≥ 95% | 94.3% | 95.7% | EXCEPTION |
| Assistant: citations resolve / on expected doc | 100% / ≥ 95% | 100 / 97.0% | 100 / 96.4% | PASS |
| Assistant: unsupported claims (judge) | ≤ 5% | 4.0% | 2.8% | PASS |
| Evaluation crashes / production errors | 0 | 0 / 0 | 0 / 0 | PASS |
Documented release exception
The assistant missed the abstention gate by a single question in one run (66 of 70, where 67 were needed). I shipped v1.2 with that exception written down rather than tuning on the test set until it passed. The remaining misses are sibling-item answers that a token rule can't catch:
| Run | Change | Judged correct | Unsupported claims |
|---|---|---|---|
| v0.1 | Baseline: round-robin context across documents | 14.4% | |
| v0.2a | Context in retrieval rank order. Context recall went from 74.7% to 92.5% | 4.0% | |
| v0.2b | 24 KiB context window | 6.6% | |
| v0.2c | 24 KiB, no per-document cap. Adopted as the default | 3.2% | |
| v0.2d | 32 KiB with a cap of 4 per document. Rejected | 5.3% |
Knowledge chat, answerable cases, judged by gpt-4.1-mini. Most of the v0.1 "padding from prior knowledge" disappeared once the model was given the passage that answered the question.
Retrieval is scored from chunk-independent evidence quotes, with no LLM needed.
gpt-4.1-mini agreed with gpt-4.1 on 96.8% of verdicts. It was adopted for cost, with its known 1–4 point offset recorded.
golden-v3 and golden-v4 each added 20 unanswerable questions, frozen before that round's fixes.
Changes were developed against it, so no test case was used to tune.
A gate passes only when both runs pass.
evaluation.compare flags any gate a candidate breaks relative to v1.2.
08 — Story of the product
FastAPI, Celery, pgvector and Next.js, with the agents written as services from the start. It ran, but most of it had never been exercised end to end.
The first real run showed Celery tasks routed to queues no worker consumed. I registered and routed them properly, bounded task runtimes, and made orphaned runs heal themselves after a worker restart.
Images went to GHCR with automatic deploys. Getting the backend tests green meant fixing five separate real bugs, not skipping tests. Every service got real Prometheus metrics.
Built in eleven planned phases: permanent storage, extraction, chunking, embeddings, durable ingestion, hybrid retrieval, context budgeting, grounded chat, safe reindexing, related documents and the UI. DeepFeed stopped being only a feed.
Dependency and runtime upgrades were validated in Docker. Auth moved to in-memory access tokens with an HttpOnly rotating refresh cookie. Nginx gained TLS, CSP and edge limits.
A user who followed Rainforcement Learning
saw about 0% relevance on every item. Relevance was a substring match, and 60% of the score ignored interests entirely. I replaced it with calibrated semantic relevance, gave interests 60% of the score and added a relevance floor. The same day shipped the assistant with memory, plus email verification.
Answers began streaming over SSE. Speculative retrieval cut the wait for the router. Provider fallback and circuit breakers keep the assistant answering through an outage.
I built the corpus, golden sets and a calibrated judge, then ran tuning sweeps. v1.0 was blocked on abstention: in its worse run, the assistant answered a third of the unanswerable questions. v1.1 got to 94%. v1.2 shipped, with the remaining gap documented as an exception.
Distributed tracing with Jaeger and Grafana gives one trace per Discover run, carried across the outbox. Per-user content pools stopped one reader's search results from filling another reader's feed.
I redesigned the UI around the logo's palette and reading-room typography, and moved deployment to a DigitalOcean droplet.
09 — What's next
Catches sibling-item answers that token rules miss. It will be measured on a new held-out set (golden-v5) and must pass in two runs in a row with no exception.
plainto_tsquery with the simple config requires every word and doesn't stem, so "drones" never matches "drone". Ranking is effectively semantic-only today.
Rate limits and caches move from process memory to Redis, and raw files move to object storage, so the API can scale out.
The hook already exists. It ships only if answer quality improves at the current retrieval recall.