use-case
RAG, embedding, and reranking model guide
Direct answerRAG combines chunking, embeddings, retrieval, reranking, grounded generation, and evaluation; completeness comes from citable evidence and no-answer handling, not a larger model list.
Updated · Reviewed
RAG is not one model
Reliable RAG combines data cleaning and permissions, chunking, embeddings, vector or keyword retrieval, reranking, context assembly, evidence-grounded generation, and citations. Skipping a stage can make fluent answers look like correct retrieval.
Build the index
Use the provider's documented input type for documents and queries and record embedding model, dimension, normalization, and chunking version. A model or dimension change requires a new index and staged migration; never mix incompatible vector spaces.
Query flow
Apply authorization before retrieval, combine enough lexical and semantic candidates, rerank them, and pass document IDs, titles, locations, and text to generation. Require answers to use evidence and return no answer when evidence is insufficient.
Evaluation
Measure Recall@K, MRR or NDCG, reranking, answer correctness, citation coverage and entailment, no-answer accuracy, and latency separately. Include stale, conflicting, unauthorized, and missing-evidence cases.
Security and operations
Do not let prompt injection in documents gain tool authority; isolate retrieved text from system instructions. Monitor index freshness, empty retrieval, authorization failures, model upgrades, cost, and propagation of deletion requests.
Use cases
- Enterprise knowledge Q&A
- Semantic search
- Retrieval reranking
API protocols
/v1/embeddings/v1/rerank/v1/chat/completions
FAQ
Can an existing vector index be reused after changing the embedding model?
Usually not. A model, dimension, normalization, or input-type change can make vector spaces incompatible. Build a new versioned index and migrate gradually; never mix old and new vectors in one index.
Do I still need RAG and reranking when the context window is large?
Often yes. Sending many documents raises cost and latency without guaranteeing attention to key evidence. Retrieval and reranking can apply authorization first, shrink the evidence set, and preserve traceable citations.
How should RAG be evaluated—can fluent final answers be enough?
No. Measure Recall@K, MRR or NDCG, reranking quality, answer correctness, citation coverage and entailment, no-answer accuracy, and latency separately. Include stale, conflicting, unauthorized, and missing-evidence cases.
How can RAG prevent unauthorized documents or prompt injection from leaking data?
Apply server-side authorization before retrieval, isolate document text from system instructions, and never let retrieved text grant tool authority. Logs and indexes need redaction, tenant isolation, and deletion propagation, while answers retain document IDs and locations for audit.
Related guides
Official sources
- Jina Models Official
- Cohere Models Official
兔子API