Skip to content

Keys prc2?

All projects

SERVICE 01

PORT

Agentic RAG Document Intelligence

  • 87%retrieval precision
  • 100Ktoken corpora
  • <2sp95 latency

Stack Python · LangChain · FastAPI · PostgreSQL · pgvector · AWS EC2

Explain at

A multi-agent RAG pipeline on LangChain and GPT-4 over 100K-token corpora. Chunks are 512-token sliding windows; pgvector with HNSW indexing does the nearest-neighbour pass, cosine-similarity reranking tightens it, and structured citation metadata keeps every answer grounded. The FastAPI service runs horizontally scaled on AWS EC2 behind an ALB for more than 50 concurrent sessions. The result: 87% retrieval precision, sub-2 s p95, and a 70% reduction in manual document analysis time.

In plain words This is a search box that reads this website's own text. Ask it something and it shows you the exact passage it found, so you can check the answer yourself.

ASK THE SITE

Searching this page needs JavaScript and a Web Worker. The description and the numbers above are unchanged.

Questions it answers:

  • What broke in the RBAC project?
  • How was latency variance reduced?
  • Which cloud did Neural Inverse use?

A port, not the production system. Retrieval and citation run entirely in your browser over this page's own text. Production used 512-token windows and pgvector; this port uses 256-wordpiece windows with 64 overlap because the in-browser encoder's effective context is 256, and BM25 or MiniLM embeddings instead of pgvector. No LLM, no API: retrieval and grounding are the demonstrable part.

Work trace

Decisions
Sliding windows over fixed blocks; HNSW over exact search so the nearest-neighbour pass can stay inside the p95 budget as the corpus grows; citations carried as structured metadata rather than parsed back out of the answer.
Trade-offs
Overlapping windows mean more vectors to store and embed. I accept that cost so a fact is less likely to be cut in half at a chunk boundary.
What I guard against
An answer with no citation can look right and still be wrong. That is why every answer carries structured citation metadata, so it can be checked against the chunk it came from.
What I'd change
Measure precision per document type, not just overall, so a weak spot in tables or in prose cannot hide inside one average.
ingest
chunk(512-token windows)
pgvector HNSW
agents
rerank(cosine)
citations
Click a part of the drawing to read about it.

Pipeline

  1. tokenize—
  2. embed (or BM25)—
  3. score—
  4. rerank—
  5. cite—

Run it to see the real timing of each stage.