Engineer Retrieval-Augmented Generation Systems
Optimizes RAG retrieval: semantic chunking, hybrid search, re-ranking, and separated retrieval quality evaluation.
Why it matters
Build and optimize Retrieval-Augmented Generation (RAG) systems to bridge the gap between raw documents and LLM understanding, ensuring high-quality, relevant outputs.
Outcomes
What it gets done
Design and implement RAG pipelines, focusing on embedding models, vector databases, and chunking strategies.
Optimize retrieval quality through hybrid search, re-ranking, and context window management.
Develop semantic chunking and hierarchical retrieval patterns for diverse content types.
Evaluate and improve retrieval performance independently from generation quality.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-rag-engineer | bash Overview
RAG Engineer
Optimizes RAG retrieval quality covering semantic chunking, hybrid search, reranking, and separated retrieval evaluation. Use when building RAG systems, implementing hybrid/vector search, or debugging poor RAG answer quality.
What it does
Builds and optimizes Retrieval-Augmented Generation systems, treating retrieval quality as the primary determinant of generation quality - covering embedding model selection, vector database architecture, chunking strategies, and retrieval optimization.
When to use - and when NOT to
Use this skill when building RAG systems, implementing vector or hybrid search, designing chunking strategies, working with vector databases (Pinecone, Weaviate, ChromaDB, pgvector), or debugging poor RAG answer quality. Core principle: fix retrieval before tuning generation - always evaluate retrieval quality separately from generation quality, since if retrieval fails, prompt changes won't help.
Inputs and outputs
Core principles: retrieval quality matters more than generation quality, chunk size depends on content type and query patterns, embeddings have blind spots and aren't magic, and hybrid search beats pure semantic search in most cases. Six retrieval patterns are provided: semantic chunking (splitting on sentence/paragraph boundaries and embedding-detected topic shifts rather than arbitrary token counts, with overlap and metadata preservation), hierarchical retrieval (multi-level indexing at paragraph/section/document granularity, coarse-then-fine two-pass retrieval), hybrid search (combining BM25/TF-IDF keyword matching with vector similarity via Reciprocal Rank Fusion), query expansion (LLM-generated query variations, synonyms, Hypothetical Document Embeddings, multi-query deduplication), contextual compression (extracting or summarizing only relevant content to fit context limits), and metadata filtering (pre-filtering by date/source/category before semantic search to shrink the search space).
Documents eight sharp edges with fixes. Fixed-size chunking breaks sentences and context (high severity, causing incomplete-feeling chunks and low precision) - fixed via semantic chunking respecting document structure. Pure semantic search without metadata pre-filtering returns outdated or wrong-source content - fixed via hybrid metadata pre/post-filtering. Using one embedding model across content types (text embeddings for code) produces poor matches - fixed via content-specific embeddings (e.g. CodeBERT for code) benchmarked before adoption. Using first-stage vector search results directly skips precision optimization - fixed via retrieving a larger candidate set (top 20-50) and cross-encoder reranking down to the final top-K. Cramming maximum context into the prompt causes answer drift and higher cost - fixed via relevance-score thresholds and context ordering by relevance. Not measuring retrieval quality separately from generation makes debugging impossible - fixed via a labeled retrieval test set measuring MRR, NDCG, and Recall@K independent of generation quality. Not refreshing embeddings when source documents change returns stale or deleted content - fixed via document version/hash tracking and re-embedding on change. Using the same retrieval strategy for all query types fails on either exact-term or paraphrase queries - fixed via hybrid search with query-pattern-tuned weights.
Integrations
Works with vector databases (Pinecone, Weaviate, ChromaDB, pgvector), keyword search algorithms (BM25/TF-IDF), cross-encoder rerankers, and content-specific embedding models (e.g. CodeBERT for code), composing with ai-agents-architect, prompt-engineer, database-architect, and backend skills.
Who it's for
Engineers building or debugging RAG systems who need concrete chunking, hybrid search, and reranking patterns plus a disciplined retrieval-vs-generation evaluation split rather than treating RAG quality as a single opaque metric.
Retrieve top 20-50 candidates -> rerank with cross-encoder -> return top 5.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.