Stack Overflow for Teams: cross-encoder reranking of the top 10 search results

19 Sep 2024

Problem

Stack Overflow for Teams Enterprise already had hybrid search, but results were not ordered well enough. Click data show that 88% of clicks fall in the first 10 results and that customers click about the 6th result on average. The OverflowAI features take their input from the top three results, so a weak order hurts both manual search and the AI features. The team wanted a better order at a serving cost that stays manageable at scale.

Example from the article: a customer searches from the search bar, the API or Slack/Microsoft Teams and clicks around the 6th result.

Solution in brief

Keep the hybrid retrieval as is and rescore only its top 10 results with a pretrained cross-encoder reranker, cross-encoder/ms-marco-MiniLM-L-6-v2. The model is checked offline on an internal query set, sped up with ONNX Runtime, and then tested in a gradual A/B rollout on a part of Enterprise traffic. The post gives offline results only.

Questions this case answers
  • How to improve the order of results from a hybrid retrieval system without retraining the retriever
  • How to validate a pretrained ranking model offline and then roll it out gradually under an online experiment
  • How to put the most relevant results higher in an enterprise search that already uses hybrid retrieval?
  • How to choose how many results to rerank and justify it from click data?

Tools and methods

  • Cross-encoder reranking — rescoring the top 10 hybrid results
  • Hybrid search — the first-stage retrieval whose top 10 get reranked
  • BM25 — the lexical baseline in the public MS MARCO benchmark
  • ONNX Runtime — serving the model with about half the latency
  • A/B test with phased rollout — online check on part of Enterprise traffic
Continue reading — it's free

Google or a one-time email code. No password.