codebaobab
Python workspace

FDE interview labAI Agents & RAG

Hybrid Catalog Search

Find and fix why a hybrid keyword and vector search misses products.

Python60 minutesAI Agents & RAG

Challenge brief

Read before you begin

Your mission · Search quality debugging

Fix hybrid search and its eval so the recall number can be trusted.

Voltbay shoppers searching for products that are in stock often cannot find them, and more searches end with no click. Merchandising also approves ranking changes using a recall number that looks better than reality. The holiday campaign starts December 1.

  • Target · all public checks
  • Labels · 15 queries
Skip to round setup

Your assignment

  1. Check the eval number by hand.
  2. Fix the causes one at a time.
  3. Keep both retrievers, depth 6 and request shapes.
  4. Handle the new requirement when it arrives.
  5. Record recall after each fix in NOTES.md.

The problem

The eval number is inflated

The dashboard shows recall at 3 above 93%, but counted honestly the starter finds 10 of 15.

Impact: Merchandising approves ranking changes on a number it cannot trust.

In-stock products go missing

A search for "monitor" shows one product when several are in stock.

Impact: Shoppers cannot find products, and no-click searches rose to 31%.

Context

Searches a day
1.2M
No-click searches, up from 22%
31%
Holiday campaign
Dec 1

Requirements

  • Filter first; filtered products never come back.
  • Return k results when k products pass.
  • Keyword: 5 per title word, 2 per tag word.
  • Each ranking keeps its best 6, ties by id.
  • Fuse with 1 / (60 + rank), ties by id.
  • Recall counts only the labeled product.
  • Reject bad k, vec, filters or op.
  • The arguments are never changed.

System overview

Edit the components marked “Your work”. The other components show where your changes fit.

Search boxQuery and filters
Query embedderTurns queries into vectors
Hybrid search(Your work)Blends keyword and vector results
Catalog indexSearchable products
Labeled queriesQueries with right answers
Quality dashboardNightly search quality
Read the connections
  • Search box → Query embedder: text
  • Query embedder → Hybrid search: text + vec
  • Catalog index → Hybrid search: products
  • Labeled queries → Hybrid search: nightly eval
  • Hybrid search → Quality dashboard: recall at 3
  • Search box: Query text plus filters for category and stock.
  • Query embedder: Turns query text into a vec offline for labeled queries; precomputed here.
  • Hybrid search: run(catalog, request) in search/hybrid.py: filters, keyword and vector rankings, fusion, eval.
  • Catalog index: Products with title, tags, category, in_stock and vec.
  • Labeled queries: Queries with the one product a person judged relevant.
  • Quality dashboard: Nightly recall at 3 and the missed queries.

Details

Full requirements

Functional

  1. Filters come first: a product that fails a filter is not ranked by either retriever and is never returned. A search for k results should still return k when k products pass.
  2. Keyword ranking: 5 points per query word in the title, 2 per word in the tags, products with 0 points left out. Vector ranking: cosine similarity. Each keeps its best 6, ties by id.
  3. Fuse with reciprocal rank fusion: 1 / (60 + rank) from each ranking a product appears in, summed, ties by id, cut to k. Keyword points and cosines are on different scales, so the fused order must not depend on either raw score.
  4. recall: a run is a hit only when its labeled product id is in its results. recall is hits / total rounded to 4 places, and missed lists the run ids that were not hits. eval searches every labeled query and scores it the same way.
  5. Errors: k a positive integer (k), vec the catalog's size (vec), filters only category and in_stock (filters), unknown op (op). Do not change the arguments.

Non-functional

  • Latency: p95 under 80 ms for a search over 42,000 products; each retriever returns at most 6 candidates, so fusion is tiny and the cost is in retrieval.
  • Eval honesty: recall must count only the labeled product. The dashboard number is what Merchandising uses to approve ranking changes.
  • Determinism: ties break by id everywhere, so the same request returns the same list on every replica and in every eval run.
  • Scale of the eval: 15 labeled queries in this slice, 1,800 in production; the eval runs nightly in under 4 minutes.

Out of scope

  • Computing embeddings. Every vec is precomputed data; no model runs here.
  • Changing the ranking depth of 6, the weights 5 and 2, or the RRF constant 60.
  • Adding labeled queries or relabeling them. Whether one label per query is enough is a debrief question.
Data model

Product

FieldTypeNotes
idstringp01 to p18 in data/catalog.json.
skustring
title, tagsstring, string[]What the keyword ranking reads.
categorystringaudio, keyboards, mice, monitors, accessories, kitchen.
in_stockboolean
vecnumber[4]Axes: audio, typing and pointing, screens, kitchen.

Labeled query

FieldTypeNotes
idstringq01 to q15.
text, vec, filters?The query as search receives it.
relevantstringThe one product id a person judged right.

Recall report

FieldTypeNotes
recallnumberhits / total, 4 places.
hits, totalinteger
missedstring[]Run ids that were not hits, in run order.
Files you are given · 5
  • samples/recall-runs.json A recall request with three runs copied from last night's eval of q01 to q03.
    {
      "op": "recall",
      "runs": [
        {
          "id": "q01",
          "relevant": "p01",
          "results": [
            "p01",
            "p14",
            "p06"
          ]
        },
        {
          "id": "q02",
          "relevant": "p05",
          "results": [
            "p05",
            "p07",
            "p06"
          ]
        },
        {
          "id": "q03",
          "relevant": "p02",
          "results": [
            "p01",
            "p14",
            "p17"
          ]
        }
      ]
    }
  • samples/recall-report.json What recall must return for those runs: q03's labeled product p02 is not in its results.
    {
      "recall": 0.6667,
      "hits": 2,
      "total": 3,
      "missed": [
        "q03"
      ]
    }
  • samples/search-monitor.json The "monitor" search shoppers complain about, with only in-stock monitors, and the answer under the contract.
    {
      "request": {
        "op": "search",
        "query": {
          "text": "monitor",
          "vec": [
            0.05,
            0.1,
            0.9,
            0
          ],
          "filters": {
            "category": "monitors",
            "in_stock": true
          }
        },
        "k": 3
      },
      "expected": {
        "results": [
          "p10",
          "p12"
        ]
      }
    }
  • samples/rankings-headset.json Both rankings for q11 (in stock only) under the contract: no out-of-stock product appears in either.
    {
      "request": {
        "op": "rankings",
        "query": {
          "text": "wireless gaming headset",
          "vec": [
            0.8,
            0.3,
            0.1,
            0
          ],
          "filters": {
            "in_stock": true
          }
        }
      },
      "expected": {
        "keyword": [
          [
            "p04",
            10
          ],
          [
            "p01",
            5
          ],
          [
            "p06",
            5
          ],
          [
            "p08",
            5
          ],
          [
            "p09",
            5
          ],
          [
            "p14",
            5
          ]
        ],
        "vector": [
          [
            "p04",
            1
          ],
          [
            "p01",
            0.9518
          ],
          [
            "p02",
            0.9243
          ],
          [
            "p14",
            0.7909
          ],
          [
            "p09",
            0.4686
          ],
          [
            "p05",
            0.4071
          ]
        ]
      }
    }
  • metrics/search-quality-2026-11.csv Weekly searches, no-click rate and the dashboard's recall since hybrid search launched on November 3.
    week,searches,no_click_rate,dashboard_recall_at_3,labeled_queries
    2026-10-27,8105220,0.221,,1800
    2026-11-03,8290114,0.287,0.9339,1800
    2026-11-10,8402771,0.304,0.9344,1800
    2026-11-17,8516093,0.312,0.9333,1800
Tickets · 3
  • BUG-101 The recall dashboard says 93 percent, but shoppers cannot find wireless running headphones Reported by Marco (QA)

    Expected samples/recall-report.json: recall 0.6667, missed ["q03"], because p02 is not among q03's results.

    Actual recall 1.0 with nothing missed, and the full eval reports 0.9333 at k 3.

  • BUG-102 A search for "monitor" returns only one in-stock monitor Reported by Dana (Merchandising)

    Expected "monitor" returns ["p10", "p12"], and q03 returns p02 in its top 3.

    Actual "monitor" returns ["p10"] alone, and q03 returns ["p01", "p14", "p17"].

  • BUG-103 Out-of-stock products take places in the rankings Reported by Ifeoma (search infra)

    Expected The rankings in that file: 6 entries each, no out-of-stock product, cosines to 4 places.

    Actual Out-of-stock products (p11 in the keyword ranking, p03 in the vector ranking) take two of the six places.

What you hand in
  • A fix under search/ that passes every public check, and the follow-up when it arrives.
  • NOTES.md: a table of recall and missed queries after each fix, starting from the honest starter number, with one line per cause.
  • Your answers to the interviewer's follow-up and the debrief questions.
How the work is judged
Breaking down the work
Fixes the eval first, so every later fix is measured by an honest number, then fusion and filtering as separate steps.
Directing the assistant
Gives the assistant the RRF formula and the worked example from docs/search.md, and says which constants must not change.
Checking the work
Checks recall on samples/recall-runs.json by hand and records recall and missed after every change.
Judging the assistant
Rejects tuning the weights, raising the depth or normalizing scores to chase a number, and says why the eval would no longer compare with last week.
Correct result
All checks pass, including the follow-up, with ties by id and rounding exactly as specified.
Explaining the work
Explains to Merchandising why recall went down before it went up, and what the new number measures.
Trade-offs to discuss
  • Reciprocal rank fusion ignores how confident each retriever is; a weighted score uses it but needs calibrated scales.
  • Filtering before retrieval costs a filtered index or more candidates; filtering after is cheaper and returns short lists.
  • One labeled product per query undercounts queries with several right answers; graded labels cost more to collect.
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

Search over our product catalog combines keyword and vector scores. Customers say it misses products they can describe. Find out why and fix it. Change one thing at a time and give me a number for each change. Use the AI assistant however you like. At the end I will ask you to defend each decision.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
Debrief · 8 questions
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • In what order did you make your changes, and what was recall after each one? Which queries moved?
  • Why did you combine the two rankings the way you did? What would make you choose a different method?
  • One labeled query may still be missed. What would you do about it, and what would you not do?
  • Which suggestion from the assistant did you turn down, and what evidence did you use?