The Cross-Encoder. Fixing the mistakes of the vector store.
Standard Vector Search uses Bi-Encoders. It encodes the Query independently. It encodes the Document independently. Then it measures the angle. Pros: Fast (millions of docs). Cons: Lossy. It misses subtle interactions between query and doc.
A Cross-Encoder takes both the query and the document as a single input: Model(Query, Doc).
It outputs a score (0 to 1) of "How relevant is this?"
Pros: Extremely accurate.
Cons: Slow. Expensive. You cannot index this ahead of time.
We combine them.
"Apple" means fruit. "Apple" means company. A Vector store puts them close. A Cross-Encoder sees the full sentence "I want to buy a Granny Smith Apple" and pushes the "Company" documents to the bottom.
Re-ranking is the single most effective way to boost precision in a RAG pipeline. It acts as a "Quality Filter" before the expensive LLM generation step.
Key Intuition: "Index fast. Rank slow."