Akshay More

Projects · AI & Engineering

RAG assistant for actuarial documentation

Retrieval-augmented Q&A over pricing methodology notes, model documentation and guidelines, built with pgvector and citations to source paragraphs.

PythonPostgreSQLpgvectorFastAPIReactLLM APIs

Architecture described in general terms. It includes no internal documents or data.

The problem

Actuarial knowledge is spread across methodology papers, model documentation, review packs and email threads. Answering “why is this factor banded this way?” can take an hour of searching.

Approach

  • Ingestion. Documents (PDF, Word, Markdown) are chunked by section heading, not fixed token windows, so each retrieved chunk is a coherent piece of methodology.
  • Storage. Embeddings live in PostgreSQL with pgvector next to metadata (document, version, section, date). This allows hybrid filtering, such as “only the current model version”.
  • Retrieval. Vector similarity is combined with keyword search and then re-ranked.
  • Answering. The LLM must answer only from the retrieved passages and cite them. The UI links each citation to its source section.
  • Evaluation. A small gold set of question-answer pairs, written with the team, is used to track retrieval hit rate and answer faithfulness as the pipeline changes.

Lessons

  • Chunking by document structure matters more than the choice of embedding model.
  • Citations are what makes actuaries willing to trust the answers.