[{"data":1,"prerenderedAt":132},["ShallowReactive",2],{"term-r\u002Freranking":3,"related-r\u002Freranking":115},{"id":4,"title":5,"acronym":6,"body":7,"category":95,"description":96,"difficulty":97,"extension":98,"letter":99,"meta":100,"navigation":101,"path":102,"related":103,"seo":109,"sitemap":110,"stem":113,"subcategory":6,"__hash__":114},"terms\u002Fterms\u002Fr\u002Freranking.md","Reranking",null,{"type":8,"value":9,"toc":89},"minimark",[10,15,19,23,26,30,78,82,85],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"Reranking is the second opinion after your search engine hands you 50 maybe-relevant results. A smaller, smarter model looks at the actual question next to each candidate and re-sorts them by how well they truly answer it, instead of just how similar their embeddings looked. It's the difference between 'these words seem related' and 'this passage actually answers your question.'",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Reranking is a second-stage retrieval step that takes the top-k candidates from an initial fast retriever (vector or keyword search) and reorders them using a more expensive but more accurate cross-encoder model that jointly scores the query and each document. It trades additional latency for significantly better relevance and is a standard component of production RAG pipelines.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","candidates = vector_db.search(query_embedding, top_k=50)\nreranked = reranker.rank(\n    query=user_query,\n    documents=[c.text for c in candidates]\n)\ntop_chunks = reranked[:5]  # feed only these into the prompt\n","python","",[38,39,40,48,54,60,66,72],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,47],{},"candidates = vector_db.search(query_embedding, top_k=50)\n",[41,49,51],{"class":43,"line":50},2,[41,52,53],{},"reranked = reranker.rank(\n",[41,55,57],{"class":43,"line":56},3,[41,58,59],{},"    query=user_query,\n",[41,61,63],{"class":43,"line":62},4,[41,64,65],{},"    documents=[c.text for c in candidates]\n",[41,67,69],{"class":43,"line":68},5,[41,70,71],{},")\n",[41,73,75],{"class":43,"line":74},6,[41,76,77],{},"top_chunks = reranked[:5]  # feed only these into the prompt\n",[11,79,81],{"id":80},"when-youll-hear-this","When You'll Hear This",[16,83,84],{},"\"Adding a reranker on top of vector search fixed most of our bad RAG answers.\" \u002F \"Retrieval brings back 50 chunks, reranking narrows it to the 5 that matter.\"",[86,87,88],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":50,"depth":50,"links":90},[91,92,93,94],{"id":13,"depth":50,"text":14},{"id":21,"depth":50,"text":22},{"id":28,"depth":50,"text":29},{"id":80,"depth":50,"text":81},"ai","Reranking is the second opinion after your search engine hands you 50 maybe-relevant results.","intermediate","md","r",{},true,"\u002Fterms\u002Fr\u002Freranking",[104,105,106,107,108],"RAG","Vector Database","Hybrid Search","Embedding","Semantic Search",{"title":5,"description":96},{"changefreq":111,"priority":112},"weekly",0.7,"terms\u002Fr\u002Freranking","sVciqa_PVacdlK3d30sLIV3G3N5K5K0POM2sID-flHk",[116,119,122,126,129],{"title":107,"path":117,"acronym":6,"category":95,"difficulty":97,"description":118},"\u002Fterms\u002Fe\u002Fembedding","An embedding is turning words, sentences, or entire documents into lists of numbers (vectors) that capture their meaning.",{"title":106,"path":120,"acronym":6,"category":95,"difficulty":97,"description":121},"\u002Fterms\u002Fh\u002Fhybrid-search","Vector search is great at understanding meaning but can miss an exact product code or acronym because it's thinking in vibes, not letters.",{"title":104,"path":123,"acronym":124,"category":95,"difficulty":97,"description":125},"\u002Fterms\u002Fr\u002Frag","Retrieval Augmented Generation","RAG is how you give an AI access to your private documents without retraining it.",{"title":108,"path":127,"acronym":6,"category":95,"difficulty":97,"description":128},"\u002Fterms\u002Fs\u002Fsemantic-search","Semantic search finds results based on meaning, not just keyword matching.",{"title":105,"path":130,"acronym":6,"category":95,"difficulty":97,"description":131},"\u002Fterms\u002Fv\u002Fvector-database","A vector database is a special database built to store and search embeddings.",1792528117520]