CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 2 · Lesson 14/56

    Configuring and verifying the AI Search reranker

    Explain the role of re-ranking in the information retrieval process

    10 min read
    1.75% of exam
    4 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Enable the Databricks reranker in an AI Search similarity_search query
    • Choose and order the metadata columns passed in columns_to_rerank
    • Confirm from debug_info that reranking ran, and measure its gain with retrieval quality evaluation
    • State the prerequisites for finetuning a reranker and query an index with the finetuned model

    1.Turning on the reranker in a query

    In AI Search, the reranker is a per-query option. You do not set it on the index. A reranker is a second-stage model that re-scores retrieved candidates against the query before the top results are returned. You enable it by passing a reranker argument to similarity_search. The query below uses hybrid retrieval and then reranks the results. Use Databricks SDK version 0.57 or above, because earlier versions cannot use the reranker.

    Hybrid query with the built-in Databricks reranker (Python SDK)python
    from databricks.ai_search.reranker import DatabricksReranker
    
    results = index.similarity_search(
        query_text = "How to create an AI Search index",
        columns = ["id", "text", "parent_doc_summary", "date"],
        num_results = 10,
        query_type = "hybrid",
        reranker=DatabricksReranker(columns_to_rerank=["text", "parent_doc_summary", "other_column"])
        )

    Three arguments control different things, and they are easy to mix up. In the REST API, the same option is a reranker object with "model": "databricks_reranker" and a parameters map that holds columns_to_rerank.

    Query arguments when reranking
    ArgumentControls
    columnsWhich columns come back in each result
    columns_to_rerankWhich columns the reranker reads, in order, when it scores relevance
    num_resultsHow many results are returned after reranking; it does not change how many candidates are reranked

    Data residency can also block the reranker. It is a Databricks Designated Service that relies on Databricks Geos. A workspace outside the US, EU, and Australia and New Zealand may need cross-Geo processing enabled before the reranker will run.

    Checkpoint 1 of 4· Fill the gap

    This hybrid query should return the id, text, parent_doc_summary and date columns in each result. The reranker should judge relevance from the text and summary content. Which argument belongs in the blank?

    from databricks.ai_search.reranker import DatabricksReranker
    
    results = index.similarity_search(
        query_text = "How to create an AI Search index",
        columns = ["id", "text", "parent_doc_summary", "date"],
        num_results = 10,
        query_type = "hybrid",
        reranker=DatabricksReranker( ? =["text", "parent_doc_summary", "other_column"])
        )

    Sources1

    2.Giving the reranker metadata to score with

    The reranker scores whatever text you hand it. Metadata columns give it context that a bare chunk does not have. In the context-enriched chunks pattern, a document title, summary or section header is attached to each chunk. If you store that metadata in separate columns instead of prepending it to the chunk text, the reranker only sees it when those columns are listed in columns_to_rerank. Take a chunk that says "tighten to the specified torque". On its own it is ambiguous. With a section value of "Emergency brake adjustment procedures" next to it, the reranker can tell that it answers a brake-adjustment question. Keyword-only metadata works differently, because hybrid or full-text search matches against it directly.

    Order matters, because the reranker has a budget. It reads the columns in the order you list them and stops after the first 2,000 characters. If a long text column comes first, it can use up the whole budget, and the summary listed after it is never read. Put the most informative short columns early, such as a summary or a section title. Put long chunk text where truncating it costs the least.

    Checkpoint 2 of 4· Check yourself

    A team stores each document's summary and section title in separate short columns. Their chunk text often runs past 2,000 characters. They query with columns_to_rerank=["text", "doc_summary", "section"], but the reranked order hardly changes when the metadata changes. Which change is most likely to let the metadata affect the reranking?

    Sources21

    3.Confirming the reranker ran and measuring what it gained

    A reranker failure is silent unless you check for it. If the reranker is temporarily unavailable, the query still succeeds. It returns results that have not been reranked and adds a warning to the debug output. To see that output, set debug_level to at least 1. The response then includes debug_info, which splits the time into ann_time and reranker_time. A run where reranking succeeded looks like this:

    debug_info from a successful reranked query (times in msec)python
    'debug_info': {'response_time': 693.0, 'ann_time': 29.0, 'reranker_time': 619.0}

    These numbers show the trade-off for a single query: 29 msec of retrieval followed by 619 msec of reranking. When the reranker fails, debug_info contains a warnings entry with the status code RERANKER_TEMPORARILY_UNAVAILABLE. A pipeline that logs that warning can tell degraded answers apart from real retrieval regressions.

    Whether the reranker helps your data is something you measure, not assume. Built-in retrieval quality evaluation runs each generated query through ANN, hybrid and full-text search, once with the reranker and once without. An LLM judge then scores the results. The results dashboard shows DCG@10 for every query type with and without the reranker, and a table that compares the base and reranked results. Use the graded relevance and ranking metrics to read those numbers. If DCG@10 for a strategy with the reranker is higher than without it, and the confidence intervals do not overlap, the gain is real and you can decide whether it is worth the reranker_time. A small synthetic evaluation set is enough to show a change of 15%.

    Checkpoint 3 of 4· Check yourself

    Your RAG agent sends every query to AI Search with the built-in reranker enabled. Now and then the answers get noticeably worse for a short time. Every query still returns its full set of results, and the application logs no errors. What is the most likely cause, and how should the pipeline detect it?

    Sources132

    4.Finetuning a reranker on your own corpus

    When the general-purpose reranker does not understand your domain well enough, you can finetune one on your own index. This feature is in Beta, and a workspace admin must turn on Reranker Finetuning from the Previews page. Databricks then does the rest: it generates training data from your documents, trains the model, registers it in Unity Catalog, and deploys it to a Model Serving endpoint.

    Your setup has to meet these requirements before a job will start:

    • The index must be a Delta Sync index with Databricks-managed embeddings. Direct-access indexes and indexes with self-managed embeddings are not supported.
    • The workspace must be in us-west-2, us-west-1, us-east-1 or us-east-2.
    • You need SELECT on the index, CREATE VOLUME and CREATE TABLE on the index's catalog and schema, and CREATE MODEL on the schema where the model is registered.

    If you are missing a privilege, the request is rejected at the start. You do not get a job that fails partway through. The status moves from Starting to Running finetuning to Completed, and at Completed the model is registered, deployed and ready to query.

    Querying an index with the finetuned rerankerpython
    from databricks.ai_search.client import AISearchClient
    from databricks.ai_search.reranker import ExperimentalDatabricksFinetunedReranker
    
    client = AISearchClient()
    index = client.get_index(
        endpoint_name="my-endpoint",
        index_name="catalog.schema.my_index",
    )
    
    results = index.similarity_search(
        query_text="How do I create an AI Search index?",
        columns=["id", "text"],
        num_results=10,
        reranker=ExperimentalDatabricksFinetunedReranker(
            columns_to_rerank=["text"],  # must be exactly the embedding source column
        ),
    )

    The finetuned reranker gives up the flexibility of the built-in one. Its columns_to_rerank must be a one-element list that contains the index's embedding source column, so it cannot read extra metadata columns. The serving endpoint is found automatically from the index. Use the finetuned reranker when its gain on your evaluation set is larger than what metadata columns add to the built-in reranker.

    Checkpoint 4 of 4· Check yourself

    Four teams want to finetune a reranker on their own corpus. Reranker Finetuning is turned on in every workspace, and every user holds the required Unity Catalog privileges. Which team can start a finetuning job?

    Sources4

    Practise it for real

    Enable the built-in reranker on an existing AI Search index, confirm that it ran, and measure what it adds.

    1. 1.Install databricks-ai-search (SDK 0.57 or above) and run a hybrid similarity_search with reranker=DatabricksReranker(columns_to_rerank=[...]), listing a short summary column before the chunk text.

      Why: The reranker is turned on per query, and the column order decides what fits in its 2,000-character budget.

      You should see: num_results reranked rows, returned with the columns you asked for.

    2. 2.Run the same query with debug_level set to at least 1.

      Why: debug_info is the only place that shows whether reranking ran and how long it took.

      You should see: debug_info with ann_time and reranker_time, and no warnings entry.

    3. 3.Check debug_info for a warnings entry with status_code RERANKER_TEMPORARILY_UNAVAILABLE, and log it if it appears.

      Why: When the reranker fails, the query still returns results that have not been reranked.

      You should see: Your pipeline can tell reranked responses apart from fallback responses.

    4. 4.On the index page, click Evaluate search quality, and when the run finishes, click View results.

      Why: The evaluation runs each strategy with and without the reranker on the same queries.

      You should see: DCG@10 for each query type with and without the reranker, with 95% confidence intervals.

    Stuck? Get a nudge

    If reranker_time takes up most of your latency budget, compare the gain in DCG@10 with that cost before you keep the reranker on.

    Sources

    (4)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “you set the columns to return (columns) and the metadata columns to use for reranking (columns_to_rerank) separately.”
      ↩︎ Turning on the reranker in a query
      “Databricks SDK version 0.57 or above is required to use the reranker.”
      ↩︎ Turning on the reranker in a query
      “Customers outside the US, EU, and Australia and New Zealand might need to enable cross-Geo processing to use the reranker.”
      ↩︎ Turning on the reranker in a query
      “The reranking calculation takes the columns in the order they are listed, and considers only the first 2000 characters it finds.”
      ↩︎ Giving the reranker metadata to score with
      “To ensure that you get latency information, set debug_level to at least 1.”
      ↩︎ Confirming the reranker ran and measuring what it gained
      “Results returned have not been processed by the reranker.”
      ↩︎ Confirming the reranker ran and measuring what it gained
      “The reranking calculation takes the columns in the order they are listed, and considers only the first 2000 characters it finds.”
      ↩︎ Exam trap 1
      “Results returned have not been processed by the reranker.”
      ↩︎ Exam trap 2
      “The reranker is temporarily unavailable. Results returned have not been processed by the reranker.”
      ↩︎ Checkpoint
    2. 2.
      “Gives rerankers more context for scoring.”
      ↩︎ Giving the reranker metadata to score with
      “For semantic metadata: Use reranking with columns_to_rerank parameter to consider these columns.”
      ↩︎ Giving the reranker metadata to score with
      “Even a small synthetic dataset can tell you if reranking improves quality by 15% or if hybrid search helps your specific use case.”
      ↩︎ Confirming the reranker ran and measuring what it gained
    3. 3.
      “Each strategy is also evaluated with and without the reranker.”
      ↩︎ Confirming the reranker ran and measuring what it gained
      “compares DCG@10 scores for each query type, with and without using the reranker.”
      ↩︎ Confirming the reranker ran and measuring what it gained
    4. 4.
      “Databricks handles training data generation, model training, registration to Unity Catalog, and deployment to a Model Serving endpoint for you.”
      ↩︎ Finetuning a reranker on your own corpus
      “To use it, a workspace admin must turn on Reranker Finetuning from the Previews page.”
      ↩︎ Finetuning a reranker on your own corpus
      “Databricks rejects the request with a permission error instead of starting a job that later fails.”
      ↩︎ Finetuning a reranker on your own corpus
      “columns_to_rerank: Must be exactly the index's embedding source column, as a single-element list.”
      ↩︎ Finetuning a reranker on your own corpus
      “Direct-access indexes and indexes with self-managed embeddings are not supported.”
      ↩︎ Exam trap 3
      “A Delta Sync AI Search index with Databricks-managed embeddings. Direct-access indexes and indexes with self-managed embeddings are not supported.”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.