A RAG chunking strategy for technical manuals
Splitting a manual into arbitrary-length pieces makes the right answer get searched in the wrong context. Preserve headings, tables and revision information.
Semantic search matches meaning, not spelling. This article explains embeddings, vector similarity, and why hybrid keyword-plus-vector retrieval is the robust production pattern.
Traditional search matches words. Query "PLC programming" and a keyword index returns documents containing those exact terms — but misses a document about "programmable logic controller software" even though it is exactly what you wanted. Semantic search matches *meaning*: it represents both the query and the documents as vectors in a shared space and looks for the closest neighbours.
An embedding is a fixed-length vector of numbers — typically 128 to 1536 dimensions — produced by a neural model that has learned that words and phrases with similar meanings sit close together. "PLC" and "programmable logic controller" are embedded near each other; "PLC" and "pizza" are far apart.
Modern embedding models are trained on enormous text corpora and can be run locally in the browser (via TensorFlow.js and similar) or on a server. Once documents are embedded, searching is pure linear algebra: embed the query, then compute similarity against every document vector.
The most common similarity measure is cosine similarity: the cosine of the angle between two vectors, ranging from 1 (identical direction) to -1 (opposite). It ignores vector length, which makes it robust to document length differences.
Ranking by pure vector similarity has failure modes: rare technical abbreviations, numbers, and exact identifiers (register addresses, part numbers) embed poorly. "Port 502" or "0x40001" are strings a model may not have seen in context, and exact-match is what matters for them.
Production systems therefore combine both signals:
This hybrid pattern is what makes domain search robust: an engineer can search "Modbus TCP" and get both the exact-protocol entries and the conceptual "industrial Ethernet" context, while a search for a specific register address still finds the exact document.