Data Cleaning for RAG Search and Response 0 ▲ Jens Willmer 156 days ago · 9 min read1763 words · Tech · hide · Fediverse post In a previous post, I covered what Retrieval-Augmented Generation is and how to prepare data for ingestion. A companion post on the ingest pipeline walks through the data cleaning techniques that get content into the vector store. This post picks up where retrieval begins. Ingesting documents into a vector database is only half the problem. The other half is what happens when someone types a question: understanding the query, ranking results, validating citations, and handling failures along the way. Query handling User input can contain control characters, excessively long text, or prompt injection attempts. Before the query reaches any LLM or embedding model, three layers of sanitization run: Control character removal: strip everything except newlines and tabs. Prompt injection mitigation: regex-based detection of patterns like “ignore previous instructions” or “disregard system prompt.” Matched patterns are stripped before the query reaches any model. Length truncation: queries are… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town