Build your own knowledge base Q&A with a large language model
- AI Applications
- Retrieval-Augmented Generation

The reason for building this tool is simple: notes are scattered across multiple places, making it hard to find specific sentences. Instead of continuing to organize directories, let's create a Q&A interface that supports natural language search.
Step 1: Chunking. Do not feed the entire document to the model; instead, split it into semantic chunks based on heading hierarchy. Perform a secondary split on paragraphs that exceed the length limit while maintaining overlap to prevent answers from being cut off.
Step 2 is retrieval. After converting semantic chunks into vectors and storing them in a local index, the system first retrieves a batch of candidates, filters them using keywords, and finally passes the most relevant segments to the model for generating the response.
Step 3 is citation. Including source documents in your answers significantly boosts credibility and makes results verifiable. This is especially important for personal use.
The overall setup avoids complex frameworks; a few scripts plus a retrieval service are sufficient to get it running. The real time investment went into iteratively tuning the splitting strategy and retrieval ranking.


