Vector Database Retrieval for Copilots
Semantic retrieval over embedded design documents, shot summaries, and fault records, with metadata filters that scope results to a machine and confidentiality tier.
Semantic recall over engineering knowledge
The vector index is the semantic half of copilot retrieval. Documents — design notes, physics rationale, fault write-ups, procedure prose, and diagnostic descriptions — are chunked, embedded, and stored with metadata. A query is embedded into the same space and the nearest chunks are retrieved, then filtered and reranked. This complements the exact, structured retrieval from the shot database.
Approximate nearest-neighbor search
Retrieval uses approximate nearest-neighbor search (for example an HNSW graph) over normalized embeddings with cosine similarity, sized so that the search stays well under the copilot's context-assembly latency budget. Recall is tuned against a labeled retrieval set specific to fusion engineering, not a generic benchmark.
def search(query, machine, tier, k=20):
q = normalize(embed(query))
hits = hnsw.query(q, ef=200, k=4*k) # over-fetch
hits = [h for h in hits
if h.meta.machine in (machine, 'both')
and h.meta.tier <= tier] # access scope
return rerank(hits, query)[:k] # cross-encoder
Metadata filtering is a safety control
- machine: breeder / burner / both, so advice pulls the right physics
- tier: confidentiality scope, enforced from L2 lineage
- recency and validity: superseded documents are down-weighted or excluded
- source type: design doc, fault record, procedure, twin run
The confidentiality filter is not optional formatting — it is a hard control. Internal-confidential material must never surface in a public-facing copilot response, and the tier filter enforces that at retrieval time, backed by L2 lineage and the authorization path. A retrieval that would cross a tier boundary returns nothing rather than leaking.
Reranking with a cross-encoder over the over-fetched candidates sharply improves precision, which matters because a copilot's answer is only as good as the top handful of chunks it actually reads. Retrieved chunks carry provenance ids for citation. The embedding and chunking choices that shape recall are covered in chunking and embedding strategy; see also the L3 RAG vector database page.