SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Databricks GenAI practice

Databricks GenAI sample questions — 25 answered and explained

25 Databricks GenAI sample questions written to the official Databricks Certified Generative AI Engineer Associate exam guide, grouped by exam domain and weighted like the real exam. Each shows the correct answer, why every other option is wrong, and the lesson that teaches it. None of them repeat the examples on the other Databricks GenAI practice pages.

On this page
25
answers included
Full bank
599
on the practice page
Domains
6
weighted like the exam
Free, no account
5/day
a free account allows 30 a day

Domain 1: Design Applications

14% of the Databricks GenAI exam, so 4 of the 25 questions on this page.

Question 1Design Applications

A Generative AI Engineer must map 300,000 free-text job titles to a standard taxonomy of about 3,000 occupation codes, each with a short description. Listing every code in one prompt would far exceed the context budget per request. Accuracy matters more than speed, and the engineer wants an LLM to make the final choice of code. Which design fits?

Choose one.

  • a
    Embed titles and code descriptions and assign each title the single nearest code by cosine similarity alone

    Nearest-neighbour matching is cheap and often right, but the requirement asks for an LLM to make the final choice for accuracy.

  • b
    Split the taxonomy into batches of codes and ask an LLM to classify each title against each batch in turn

    This works around the context limit but multiplies calls per title and leaves the engineer to reconcile one winner per batch.

  • c
    Embed titles and code descriptions, retrieve top candidate codes per title, then let an LLM pick one Correct

    Embedding retrieval narrows thousands of codes to a short list that fits in the prompt, and the LLM then makes the final choice with the descriptions in view.

  • d
    Fine-tune a classification model on the code descriptions and let it predict one code directly for each title

    Training on one description per code gives very few examples per class, and it replaces the LLM choice the requirement asks for.

The concept

When a label set is too large to put in a prompt, use embeddings to retrieve a few candidate labels, then let a generative model classify against that short list.

Why that’s the answer

Two facts decide this. First, 3,000 labels cannot be listed in one prompt, so the LLM must see only a subset. Second, the requirement wants an LLM to make the final decision. Embedding retrieval (top-k candidate codes per title) solves the first, and an LLM choosing among the retrieved candidates satisfies the second. Pure nearest-neighbour skips the LLM, batching the taxonomy multiplies cost and needs reconciliation, and fine-tuning on one description per code has too little data.

How to reason it out
  1. Note the constraint: the full label set does not fit in a prompt.
  2. Use embeddings to shortlist the most similar codes for each title.
  3. Pass only the shortlist, with descriptions, to the LLM for the final choice.
  4. Check that the design keeps the LLM as the decision-maker.

Exam tip: Too many labels for a prompt: retrieve candidates with embeddings, then classify with an LLM.

Databricks GenAI: Prompt Design, Output Formats and Model Task Selection — the lesson that teaches this.

Question 2Design Applications

A Generative AI Engineer is automating responses to warranty claim emails. The pipeline must identify the product model and purchase date in each email, apply the company's fixed eligibility rule (models in a published list, bought within 24 months), and draft a reply stating the outcome. Legal requires the eligibility decision to be reproducible and auditable. Which set of tasks should the engineer design?

Choose one.

  • a
    Field extraction of model and date, a rule check written in SQL or Python, then text generation of the reply Correct

    Extraction gets the inputs, a code check applies the fixed rule the same way every time for audit, and generation writes the reply from the known outcome.

  • b
    Field extraction of model and date, an LLM prompt that applies the rule, then text generation of the reply

    This works most of the time, but an LLM applying a date-and-list rule is not guaranteed to be reproducible, which legal requires.

  • c
    Text classification of each email as eligible or not eligible, then text generation of a reply for each of the classes

    Classifying eligibility straight from the email skips the explicit rule and gives auditors nothing to check the decision against.

  • d
    A single LLM prompt that reads the email, decides eligibility and drafts the reply in one generation step

    One prompt is simple to build, but the decision would be buried in generated text and could differ between runs.

The concept

Decompose a requirement into steps and give each step to the right tool: models for language tasks, plain code for fixed business rules.

Why that’s the answer

The requirement mixes language tasks (reading the email, writing a reply) with a deterministic business rule that must be auditable. Extraction supplies the model and date, code applies the rule exactly, and generation drafts the reply around a decided outcome. Letting an LLM apply the rule, classify eligibility directly, or do everything in one prompt would usually give a plausible answer, but none is reproducible or auditable.

How to reason it out
  1. Split the requirement into its steps: read inputs, decide, respond.
  2. Mark which steps need language understanding and which are fixed rules.
  3. Give the fixed, auditable rule to deterministic code, not a model.
  4. Order the steps: extract, check, generate.

Exam tip: Use models for language and code for rules; an auditable decision belongs in deterministic logic.

Databricks GenAI: Prompt Design, Output Formats and Model Task Selection — the lesson that teaches this.

Question 3Design Applications

A Generative AI Engineer at a software vendor processes recorded sales calls that have already been transcribed to text. Sales managers want two things for each call in the CRM: a list of any competitor product names mentioned, including products launched since the team last updated its competitor list, and a one-paragraph recap of the call. Which TWO model tasks should the engineer include? (Select TWO.)

Choose TWO.

  • a
    Sentiment analysis that scores how the prospect felt about each competitor product

    Prospect sentiment can be useful, but managers did not ask for it, and it produces neither the names nor the recap.

  • b
    Entity extraction that returns the competitor product names found in each transcript Correct

    Competitor names are specific spans in the transcript, so they are extracted as entities into a list.

  • c
    Multi-label classification of each call transcript against the team's list of competitor product names

    Classification can only return labels from the fixed list, so competitor products launched since the list was last updated are missed.

  • d
    Summarization that condenses each transcript into a one-paragraph recap of the call Correct

    A one-paragraph recap of a long transcript is summarization.

  • e
    Text generation that drafts a one-paragraph follow-up email recapping the call for the prospect

    A follow-up email is a message to the prospect, not the internal recap managers asked for, and it produces no list of names.

The concept

Map each requested output to its own model task; one business requirement often needs more than one task.

Why that’s the answer

The managers asked for two outputs. Competitor names are spans copied from the text, and some are not on any list yet, so they must be extracted as entities rather than classified against a fixed list. The recap is a condensed version of the transcript, which is summarization. Sentiment is not requested, and a follow-up email is a different deliverable with a different audience.

How to reason it out
  1. List each output the business asked for.
  2. Match each output to a task: names to extraction, recap to summarization.
  3. Check whether a fixed label list can cover the values: new products mean it cannot.
  4. Drop tasks that produce something nobody asked for.

Exam tip: One task per required output; don't add tasks nobody asked for.

Databricks GenAI: Prompt Design, Output Formats and Model Task Selection — the lesson that teaches this.

Question 4Design Applications

A Generative AI Engineer works with an analyst who uses Databricks SQL. A Delta table holds customer call transcripts that must be shared with an outside research partner, but people's names and email addresses must first be replaced with placeholders. The analyst wants a single built-in SQL function with no custom prompt. Which function should the engineer recommend?

Choose one.

  • a
    ai_extract on the transcript column with person and email as the entity labels

    ai_extract returns the names and emails as fields; it does not remove them from the transcript text that will be shared.

  • b
    ai_mask on the transcript column with person and email as the entity labels Correct

    ai_mask replaces the named entity types in text with masks, which is exactly the de-identification step required.

  • c
    ai_classify on the transcript column with contains personal data as a label

    Classification would only flag which transcripts contain personal data; the data would still be in the text.

  • d
    ai_summarize on the transcript column with a small maximum word count set

    A short summary may still contain names, and it throws away the transcript the partner wanted.

The concept

Databricks AI Functions include task-specific functions such as ai_mask, ai_extract, ai_classify and ai_summarize; each one maps to a single model task.

Why that’s the answer

The requirement is to keep the transcript but hide specific entity types, which is masking. ai_mask does that with a list of labels. ai_extract is its near-twin but returns the entities instead of hiding them, ai_classify only flags rows, and ai_summarize changes the content without guaranteeing removal.

How to reason it out
  1. Identify the transformation: keep the text, hide named entity types.
  2. Match it to the task-specific function that masks entities.
  3. Reject functions that extract, flag or condense instead.

Exam tip: Hide entities in place: ai_mask. Pull them out as fields: ai_extract.

Databricks GenAI: Prompt Design, Output Formats and Model Task Selection — the lesson that teaches this.

Domain 2: Data Preparation

14% of the Databricks GenAI exam, so 4 of the 25 questions on this page.

Question 5Data Preparation

A Generative AI Engineer parses 2,000 internal PDF reports for a RAG application. Every page carries the company name in a header and "Confidential - page N of M" in a footer. For questions about confidentiality rules, retrieval keeps returning chunks whose closest match is just that footer text. What should the engineer do first to improve retrieval quality?

Choose one.

  • a
    Strip the repeated page headers and footers out before chunking Correct

    Removing boilerplate that repeats on every page stops it from dominating chunk embeddings and from matching queries that share its words.

  • b
    Add a report-type metadata filter when querying the index of page text

    A filter narrows which reports are searched, but every report has the same footer, so the noisy matches remain inside the filtered set.

  • c
    Double the chunk size so header and footer text is a smaller share of each chunk

    Diluting the footer reduces its weight a little but keeps it in every chunk, and larger chunks bring their own precision and context costs.

  • d
    Add a re-ranking step that rescores the top results after vector search

    Re-ranking reorders the retrieved candidates; it does not remove the boilerplate that keeps pulling the wrong chunks into the candidate set.

The concept

Repeated page furniture (headers, footers, page numbers) is extraneous content that degrades embeddings and should be filtered before chunking.

Why that’s the answer

The noise is in the data, so the first fix is in the data: remove text that repeats on every page. Metadata filters, bigger chunks and re-ranking all leave the boilerplate in place and only work around it later in the pipeline.

How to reason it out
  1. Identify content that repeats on every page and carries no answer.
  2. Remove it at parse time, before chunking and embedding.
  3. Treat retrieval-side tweaks as secondary to clean input.

Exam tip: Clean before you chunk: strip repeated headers, footers and page numbers.

Databricks GenAI Engineer: Document Extraction, Filtering and Chunking into Delta Tables — the lesson that teaches this.

Question 6Data Preparation

A Generative AI Engineer builds a knowledge base by crawling an intranet. Many pages include the same navigation menu, cookie banner and footer, and the crawl captured the same page under several URLs with only tracking parameters differing. Retrieval returns repeated and off-topic chunks. Which preprocessing steps will improve retrieval quality? (Select TWO.)

Choose TWO.

  • a
    Lowercase each page and strip out its punctuation before chunking

    Dense embedding models are trained on natural text; stripping punctuation and case removes meaning without removing any noise.

  • b
    Remove stop words from each page before the text is embedded

    Stop-word removal helps old keyword indexes, but dense embeddings rely on full sentences, so it tends to degrade retrieval.

  • c
    Strip the site-wide boilerplate out of the HTML before chunking Correct

    This text repeats across the site and answers nothing; removing it keeps chunks focused on each page's own content.

  • d
    Drop the HTML tables from each page so that just paragraph text remains

    Tables often hold the facts users ask about; dropping them removes knowledge rather than noise.

  • e
    Deduplicate exact and near-duplicate pages, for example with MinHash Correct

    The same page under several URLs produces identical chunks that crowd out other results. Deduplication keeps one copy.

The concept

Extraneous content includes site boilerplate and duplicate copies; both should be filtered before chunking.

Why that’s the answer

The symptoms name two problems: shared page furniture (navigation, banners, footers) and duplicate pages. Removing boilerplate and deduplicating fix them directly. Lowercasing, stripping punctuation and stop words are keyword-search habits that hurt dense embeddings, and dropping tables throws away content.

How to reason it out
  1. Match each symptom to its cause: repeated boilerplate and duplicate pages.
  2. Pick the filter that removes each cause.
  3. Reject normalisation steps that remove meaning rather than noise.

Exam tip: Filter boilerplate and duplicates; don't strip text that embedding models need.

Databricks GenAI Engineer: Document Extraction, Filtering and Chunking into Delta Tables — the lesson that teaches this.

Question 7Data Preparation

A Generative AI Engineer finds that an HR assistant sometimes quotes last year's parental-leave allowance. The source volume holds three versions of the leave policy, each a separate PDF, and the retriever returns whichever version scores highest for a question. The engineer must fix this in the data rather than in the prompt. What should the engineer do?

Choose one.

  • a
    Merge the three PDFs into one file so the newest wording comes last before chunking

    Merging keeps all three allowances in the indexed chunks; where text sits in a file has no effect on which chunk scores highest.

  • b
    Add a version column to the chunks table but keep every version searchable

    The column records which version a chunk came from, but without excluding superseded chunks the old allowance can still be retrieved.

  • c
    Ingest all three versions and add a re-ranker to reorder the results

    A re-ranker scores relevance to the question, not recency; old and new versions are equally relevant, so the stale one can still win.

  • d
    Ingest only the current version of each policy, recording its effective date Correct

    Excluding superseded versions removes the stale facts from the index, and the effective-date column documents which version is live.

The concept

Outdated versions are extraneous content: filter superseded documents out of the knowledge base.

Why that’s the answer

The problem is that the index holds contradictory facts. The data-level fix is to keep only the current version, using effective-date or status metadata to decide. Merging files leaves every allowance in the chunks, a version column that nothing filters on still lets old chunks win, and a re-ranker measures relevance, not currency. A prompt instruction is ruled out by the stem and would not remove the conflicting facts from the index either.

How to reason it out
  1. Recognise conflicting versions of the same document in the source.
  2. Decide at ingestion which version is authoritative.
  3. Exclude superseded versions instead of hoping retrieval picks correctly.

Exam tip: Stale versions in the index produce stale answers: ingest only the current one.

Databricks GenAI Engineer: Document Extraction, Filtering and Chunking into Delta Tables — the lesson that teaches this.

Question 8Data Preparation

A Generative AI Engineer is choosing documents for a RAG assistant that answers customer questions about a software product as it ships today. Candidate sources are listed below. Which source should form the core of the knowledge base?

Choose one.

  • a
    The official user guides and reference manuals for the shipping release Correct

    They are authoritative, written for customers and match the release the assistant supports, so answers drawn from them are accurate and current.

  • b
    Resolved support tickets from the past year, with the agents' internal notes

    Tickets are useful evidence of what customers ask, but they are noisy, mix releases, may contain personal data and internal notes not meant for customers, and are not authoritative.

  • c
    Community forum threads with accepted answers, spanning several versions

    Forum answers are unofficial, may be wrong, and mix advice for old and new versions, so they cannot be the authoritative core.

  • d
    The archived user guides and reference manuals for earlier releases

    Earlier-release guides describe behaviour that may no longer apply and would compete with current documentation at retrieval time.

The concept

Source selection: choose authoritative, current and audience-appropriate documents that contain the knowledge the use case needs.

Why that’s the answer

Retrieval cannot improve on its sources. The official guides for the shipping release are accurate, scoped to what customers run and safe to show them. Support tickets and forum threads are tempting because they reflect real questions, but they are unofficial, version-mixed and may expose personal or internal information; they can supplement a knowledge base after cleaning, not form its core. Archived guides for earlier releases introduce outdated answers.

How to reason it out
  1. State what the assistant must answer and for whom.
  2. Prefer sources that are authoritative, current and appropriate for that audience.
  3. Treat noisy, unofficial, sensitive or outdated sources as supplements at most, never the core.

Exam tip: Garbage in, garbage out: pick authoritative, current sources for the audience you serve.

Databricks GenAI Engineer: Document Extraction, Filtering and Chunking into Delta Tables — the lesson that teaches this.

Domain 3: Application Development

30% of the Databricks GenAI exam, so 7 of the 25 questions on this page.

Question 9Application Development

A Generative AI Engineer has a Unity Catalog function, main.sales.get_order_status, that returns an order's status for a given order ID. A LangChain agent must be able to call this function as a tool, and the engineer does not want to rewrite its logic in Python. Which databricks-langchain class should the engineer use?

Choose one.

  • a
    DatabricksVectorSearch, indexing the order table that the function reads

    A vector index retrieves similar text. It would not run the function or return an exact status for an order ID.

  • b
    UCFunctionToolkit, listing the function's full name in function_names Correct

    UCFunctionToolkit converts Unity Catalog functions into LangChain tools that the agent can call, reusing the governed function as it is.

  • c
    ChatDatabricks, naming the function as the chat model's endpoint

    ChatDatabricks calls a model serving endpoint. A Unity Catalog function is not a serving endpoint.

  • d
    DatabricksEmbeddings, passing the function's output into the agent prompt

    DatabricksEmbeddings produces vectors from text; it does not expose a function as a callable tool.

The concept

UCFunctionToolkit exposes governed Unity Catalog functions to LangChain agents as tools.

Why that’s the answer

The function already exists and is governed in Unity Catalog; the agent only needs to call it. UCFunctionToolkit wraps named functions as LangChain tools, so the logic stays where it is. The other classes target vector indexes, chat endpoints and embeddings.

How to reason it out
  1. Identify the asset: an existing Unity Catalog function.
  2. Identify the need: the agent calls it as a tool.
  3. Pick the class that converts UC functions into tools.

Exam tip: UC function to LangChain tool: UCFunctionToolkit.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 10Application Development

A Generative AI Engineer registers a prompt in the MLflow Prompt Registry with the template "Using {context}, answer: {question}". In the app, prompt.format(context=docs, question=q) returns the template with the words {context} and {question} still in it, and the model replies to the placeholders. What is the cause?

Choose one.

  • a
    Registry variables use double braces, so the single-brace text was left as written Correct

    Prompt Registry variables use {{variable}} syntax. Single-brace placeholders are not recognised, so format() leaves them as literal text.

  • b
    Registry templates fill variables when loaded by alias, and this one was loaded by version

    format() substitutes variables whether a prompt was loaded by version or alias; the load URI is not the issue.

  • c
    Registry templates need to_single_brace_format() applied before format() can fill them

    to_single_brace_format() is for handing templates to LangChain or LlamaIndex. The registry's own format() expects double braces.

  • d
    Registry templates take variables as one dictionary, so keyword arguments are skipped

    format() takes the variables as keyword arguments, so the call style is correct.

The concept

MLflow Prompt Registry templates use {{double-brace}} variables.

Why that’s the answer

The registry recognises variables written as {{context}} and {{question}}. A template written with single braces has no variables as far as the registry is concerned, so format() returns it unchanged. The load method and argument style are fine, and to_single_brace_format() solves the opposite problem.

How to reason it out
  1. Read the symptom: placeholders survive format().
  2. Recall the registry's variable syntax: double braces.
  3. Fix the template, not the load call or arguments.

Exam tip: Prompt Registry variables are {{name}}; single braces stay literal.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 11Application Development

A Generative AI Engineer loads a registered prompt whose template is "Summarize {{ticket}} for {{audience}}". Two batch jobs fill it with prompt.format(). A new LangChain chain must use the same prompt as a ChatPromptTemplate so the variables are filled when the chain is invoked. How should the engineer give the chain the template without breaking the batch jobs?

Choose one.

  • a
    Pass prompt.template unchanged to ChatPromptTemplate.from_template() in the chain

    LangChain reads doubled braces as escaped literal braces, so the variables would not be filled at invoke time.

  • b
    Register a new version written with single braces and point both consumers at it

    The registry's format() only fills double-brace variables, so the batch jobs would start sending literal placeholders.

  • c
    Pass prompt.to_single_brace_format() to ChatPromptTemplate.from_template() in the chain Correct

    The conversion produces a single-brace copy for LangChain while the registered double-brace template stays as the batch jobs expect.

  • d
    Pass prompt.format(ticket=t, audience=a) to ChatPromptTemplate.from_template() in the chain

    This fills the variables once, before the chain exists, so the template has nothing left to fill when the chain is invoked.

The concept

Registry templates use double braces; LangChain needs single braces, so convert a copy with to_single_brace_format().

Why that’s the answer

Two facts combine. The registry's syntax is {{var}}, which the batch jobs depend on. LangChain's f-string templates treat {{ }} as an escaped literal brace, so the raw template would not bind variables. to_single_brace_format() returns a LangChain-ready copy without changing the registered version. Re-registering with single braces breaks format(), and pre-formatting defeats invoke-time filling.

How to reason it out
  1. Note the two consumers and their syntaxes.
  2. Recall what doubled braces mean to LangChain.
  3. Convert for the new consumer rather than change the shared template.

Exam tip: One registered prompt, two syntaxes: keep {{ }} in the registry and convert with to_single_brace_format() for LangChain.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 12Application Development

A Generative AI Engineer's team keeps prompts as string constants in notebook code. They want every prompt stored centrally with a version history, access governed through Unity Catalog, and the ability to change the prompt an app uses without editing its code. Which Databricks capability meets these needs with the least custom work?

Choose one.

  • a
    A Unity Catalog Delta table storing prompts with a version column that apps query

    This can work, but versioning, aliasing and lookup logic would all be custom code that the registry already provides.

  • b
    MLflow Prompt Registry, with prompts named catalog.schema.name and loaded by alias Correct

    The registry stores prompts as Unity Catalog entities with immutable versions and movable aliases, so apps can follow an alias instead of embedding text.

  • c
    A Git folder of prompt files, with each app reading its own file from the repository

    Git gives history, but changing an app's prompt still means changing a file the app is built from, and access is not governed through Unity Catalog.

  • d
    MLflow experiment runs, with each prompt version saved as a text artifact of a run

    Run artifacts record what was used in a run; they offer no alias for an app to follow or Unity Catalog governance of the prompt.

The concept

MLflow Prompt Registry versions prompts in Unity Catalog and lets apps load them by alias.

Why that’s the answer

All three needs map to registry features: prompts are Unity Catalog entities (governance), each register_prompt() call adds an immutable version (history), and aliases let an app load prompts:/catalog.schema.name@alias so the version can change without a code edit. The other options can be built into something similar but only with custom work.

How to reason it out
  1. List the needs: central versions, UC governance, swap without code changes.
  2. Match each need to a registry feature.
  3. Prefer the managed feature over a custom store.

Exam tip: Versioned, governed, swappable prompts: MLflow Prompt Registry with aliases.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 13Application Development

A Generative AI Engineer's serving app loads prompts:/main.support.answer@production on each request, and that reference currently resolves to version 4. Version 5 has passed evaluation. The engineer must make the app use version 5 without changing or redeploying the app's code. What should the engineer do?

Choose one.

  • a
    Call set_prompt_alias() to move the production alias so it points to version 5 Correct

    Aliases are mutable pointers. Moving production to version 5 changes what the app loads, with no code change.

  • b
    Call register_prompt() again with version 5's template and a production tag

    This would create a version 6 with a tag; tags do not move the alias the app loads.

  • c
    Edit the template of version 4 so its text matches version 5's template

    Prompt versions are immutable snapshots, so version 4's text cannot be edited.

  • d
    Change the app to load prompts:/main.support.answer/5 and redeploy it

    This works, but it changes and redeploys the app, which the requirement rules out.

The concept

Aliases are mutable pointers to immutable prompt versions; promotion moves the alias.

Why that’s the answer

The app follows the production alias, so promoting means repointing that alias with set_prompt_alias(). Versions cannot be edited, tags are metadata, and switching to a version URI requires the code change the scenario forbids.

How to reason it out
  1. See how the app loads the prompt: by alias.
  2. Recall that versions are immutable and aliases move.
  3. Move the alias rather than touching code or versions.

Exam tip: Promote or roll back a prompt by moving its alias, not by editing versions or code.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 14Application Development

A Generative AI Engineer moved the production alias of main.support.answer from version 3 to version 5, but the deployed app still behaves like version 3. The app contains: prompt = mlflow.genai.load_prompt("prompts:/main.support.answer/3"). Versions 6 and 7 are drafts still being tested. What change makes future alias moves reach the app?

Choose one.

  • a
    Load prompts:/main.support.answer@latest so the app follows the newest version

    latest resolves to the newest version, which is draft version 7, so untested prompts would go live.

  • b
    Delete version 3 so the pinned load resolves to the production alias instead

    Deleting a version does not redirect a version URI to an alias; the load would simply fail.

  • c
    Register version 5's template again so it becomes the newest prompt version

    The app still requests version 3 explicitly, so adding another version changes nothing for it.

  • d
    Load prompts:/main.support.answer@production so the app follows that alias Correct

    The app is pinned to an immutable version. Loading the production alias makes it follow each promotion and never picks up untested drafts.

The concept

A version URI pins an immutable snapshot; only an alias URI follows promotions.

Why that’s the answer

Two facts decide. A prompts:/name/3 URI always returns version 3, whatever any alias says. Of the alias URIs, @latest tracks the newest version, including drafts, whereas a named alias such as production tracks exactly what was promoted. So the app should load @production.

How to reason it out
  1. Read the load URI: it pins a version.
  2. Recall that versions never change, so alias moves cannot reach a pinned load.
  3. Choose between alias URIs by what each resolves to: production versus newest draft.

Exam tip: Load by a named alias to follow promotions; a version number pins, and @latest follows drafts.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Question 15Application Development

A Generative AI Engineer is building an order-help assistant. Users type messages such as "Where is order 88123?". The answer depends on that order's status and carrier, stored in a Delta table keyed by order ID. Responses must state the exact current status. How should the engineer augment the prompt?

Choose one.

  • a
    Embed the order table into a Vector Search index and add the top five similar rows

    Similarity search over IDs and statuses can return neighbouring orders; an exact key needs an exact lookup.

  • b
    Fine-tune the model on the order table so it learns each order's status and carrier

    Fine-tuning bakes in a snapshot. Statuses change constantly, so the model would state stale values.

  • c
    Extract the order ID, query that row and add its status and carrier to the prompt Correct

    The key field identifies one exact record. A direct lookup returns its current values, which the prompt then supplies as explicit context.

  • d
    Add the full order table to the system prompt so the model can find the matching row

    The table is far too large for a prompt, and pasting all rows wastes tokens and invites the model to pick the wrong order.

The concept

Key fields in the user's input should drive an exact lookup whose results are injected into the prompt.

Why that’s the answer

The order ID is a key field: it names one record whose current values the answer must state. Extract it, query the row, and add the status and carrier to the prompt as labeled context. Vector similarity is for meaning, not exact keys; fine-tuning freezes changing data; and pasting the whole table does not scale.

How to reason it out
  1. Identify the key field in the user's input.
  2. Fetch the exact, current record for that key.
  3. Inject the needed fields into the prompt as labeled context.

Exam tip: An exact key in the question deserves an exact lookup, injected into the prompt.

Databricks GenAI Engineer: LangChain, Prompt Augmentation and Prompt Engineering — the lesson that teaches this.

Domain 4: Assembling and Deploying Applications

22% of the Databricks GenAI exam, so 5 of the 25 questions on this page.

Question 16Assembling and Deploying Applications

A Generative AI Engineer's support chain is called by a web app, a Slack bot and SQL users through ai_query(). Every caller must receive JSON with an answer field and a sources field, and internal chunk IDs must never appear in the answer text. The prompt already asks the LLM for this, but some responses still break the format. Where should the engineer enforce the requirement?

Choose one.

  • a
    In the prompt, by adding a JSON example and a stronger instruction to omit chunk IDs

    The prompt already asks for the format and still fails sometimes; an instruction raises compliance but cannot guarantee it.

  • b
    In each calling application, by parsing the response and removing chunk IDs before display

    Every client would need its own copy of the logic, and SQL users calling ai_query() would still see raw output.

  • c
    In an AI Gateway guardrail on the serving endpoint, by blocking responses that contain chunk IDs

    Guardrails filter unsafe content or sensitive data and can block a response, but they do not restructure output into the required JSON fields.

  • d
    In the pyfunc predict method, by validating and reshaping the LLM output after the call Correct

    Post-processing inside the model runs for every caller and every request, so the format and the ID removal are guaranteed, not just requested.

The concept

Post-processing in a pyfunc model enforces output rules for every consumer.

Why that’s the answer

Pre- and post-processing coded in predict travel with the model, so every caller of the endpoint, including ai_query(), gets the same validated output. Prompt instructions are the cheaper option, but they only raise the chance the LLM complies. Doing it in each client duplicates logic and misses SQL callers, and a gateway guardrail can block or filter a response but cannot reshape it into the answer and sources fields.

How to reason it out
  1. Note the requirement is a guarantee for all callers.
  2. Rule out measures that only ask the LLM nicely.
  3. Put deterministic checks in the model's post-processing.

Exam tip: If every caller must get it, enforce it in the model's post-processing, not the prompt or the client.

Databricks GenAI Engineer: Coding pyfunc Chains and Registering Them to Unity Catalog — the lesson that teaches this.

Question 17Assembling and Deploying Applications

A Generative AI Engineer is coding a pyfunc chain for a bank. Before any user question reaches the hosted LLM, account numbers in it must be replaced with a placeholder. The method skeleton is:class BankChain(mlflow.pyfunc.PythonModel): def load_context(self, context): self.client = get_deploy_client("databricks") def predict(self, context, model_input, params=None): question = model_input["question"][0] # (1) reply = self.client.predict(endpoint=EP, inputs=build(question)) # (2) return replyWhere should the masking step go?

Choose one.

  • a
    At marker (1), inside predict before the endpoint call Correct

    Pre-processing must run on each request before the LLM sees the question, which is exactly marker (1).

  • b
    At marker (2), inside predict after the endpoint call

    Masking here only cleans the reply; the account number has already been sent to the LLM.

  • c
    In load_context, right after the deploy client is created

    load_context runs once when the model is loaded and never sees an individual user question.

  • d
    In the input_example passed to log_model for the chain

    The input example is sample data for the signature; it does not transform live requests.

The concept

Pre-processing runs in predict before the model call; post-processing runs after it.

Why that’s the answer

Anything that depends on the incoming request belongs in predict. Masking must happen before the endpoint call so the sensitive value never leaves the chain, which is marker (1). Marker (2) is post-processing and is too late. load_context runs once per load and has no request to work on.

How to reason it out
  1. Decide whether the step depends on the request (predict) or not (load_context).
  2. Decide whether it must run before or after the LLM call.
  3. Sensitive input must be cleaned before it is sent.

Exam tip: Clean inputs before the LLM call, shape outputs after it, both inside predict.

Databricks GenAI Engineer: Coding pyfunc Chains and Registering Them to Unity Catalog — the lesson that teaches this.

Question 18Assembling and Deploying Applications

A Generative AI Engineer needs a simple LangChain chain: fill a prompt template that has a {question} variable, send it to the Foundation Model APIs endpoint databricks-meta-llama-3-3-70b-instruct, and return the reply as a plain string. The prompt variable and the imports are already defined. Which line builds this chain?

Choose one.

  • a
    chain = ChatDatabricks(endpoint=EP) | prompt | StrOutputParser()

    The model would receive the raw input dictionary before the template runs, so the order is reversed.

  • b
    chain = prompt | StrOutputParser() | ChatDatabricks(endpoint=EP)

    The parser would run before the model, and the chain would end with a chat message instead of a string.

  • c
    chain = prompt | ChatDatabricks(endpoint=EP) | StrOutputParser() Correct

    The template formats the input, the chat model generates the reply, and the output parser turns the message into a string, in that order.

  • d
    chain = prompt | DatabricksEmbeddings(endpoint=EP) | StrOutputParser()

    An embeddings class returns vectors rather than generating text, so it cannot answer the question.

The concept

An LCEL chain pipes template, chat model and output parser in that order.

Why that’s the answer

LangChain Expression Language runs each step on the previous step's output. The prompt template turns {question} into messages, ChatDatabricks calls the Databricks serving endpoint, and StrOutputParser extracts the text. Swapping the order breaks the data flow, and an embeddings class has no generation step.

How to reason it out
  1. Trace what each step receives and returns.
  2. The template must run first, the parser last.
  3. Use a chat model class, not an embeddings class, to generate text.

Exam tip: prompt | chat model | output parser: format, generate, parse.

Databricks GenAI Engineer: Coding pyfunc Chains and Registering Them to Unity Catalog — the lesson that teaches this.

Question 19Assembling and Deploying Applications

A Generative AI Engineer is coding a RAG chain whose prompt template has {context} and {question} variables. The chain receives the user's question as a plain string, retriever returns LangChain Document objects, and format_docs joins their page_content into one string. Which chain definition meets the requirement?

Choose one.

  • a
    {"context": retriever | format_docs, "question": RunnablePassthrough()} | prompt | llm | StrOutputParser() Correct

    The question is passed to the retriever for context and passed through unchanged as the question, so both template variables are filled with strings.

  • b
    {"context": RunnablePassthrough(), "question": retriever | format_docs} | prompt | llm | StrOutputParser()

    The variables are swapped: the template would get the raw question as context and the retrieved text as the question.

  • c
    {"context": retriever | format_docs} | prompt | llm | StrOutputParser()

    The template needs a question variable too; with only context supplied, formatting the prompt fails on the missing input.

  • d
    retriever | format_docs | prompt | llm | StrOutputParser()

    The prompt would receive one string instead of a dictionary, so it cannot fill both context and question.

The concept

A RAG chain fans the question out to the retriever and to the prompt at the same time.

Why that’s the answer

The dictionary at the start of the chain runs each value on the same input. retriever | format_docs turns the question into a context string, and RunnablePassthrough forwards the question as-is, so the template gets both variables. Dropping the question key or skipping the dictionary leaves the template without one of its inputs, and swapping the keys fills the right variables with the wrong values.

How to reason it out
  1. List the variables the template expects.
  2. Check each one is filled with the right value.
  3. Use RunnablePassthrough to forward the original input.

Exam tip: Every template variable needs its own branch: retriever for context, passthrough for the question.

Databricks GenAI Engineer: Coding pyfunc Chains and Registering Them to Unity Catalog — the lesson that teaches this.

Question 20Assembling and Deploying Applications

A Generative AI Engineer tries to log a LangChain RAG chain by passing the chain object to mlflow.langchain.log_model. Logging fails while serialising a client the chain holds, and the team wants the logged model to contain readable source code that reviewers can inspect. What is the approach Databricks recommends for logging this chain?

Choose one.

  • a
    Keep passing the chain object, and add the chain's file to code_paths so MLflow can import it

    MLflow would still try to serialise the object it was given, so the client error remains.

  • b
    Put the chain in a Python file that calls mlflow.models.set_model(chain), and log that file path Correct

    Models from code saves the Python file instead of serialising objects, so no client is pickled and the logged code stays readable.

  • c
    Keep passing the chain object, and enable mlflow.langchain.autolog() before logging the model

    Autologging records traces and runs automatically, but it does not change how the chain object is serialised.

  • d
    Wrap the chain in a PythonModel instance, and pass that instance to mlflow.pyfunc.log_model

    A PythonModel instance is also serialised with cloudpickle, so the same client would have to be pickled.

The concept

Models from code logs a chain as a Python file plus set_model(), avoiding object serialisation.

Why that’s the answer

Databricks recommends code-based logging (Models from Code) for agents and chains: the chain lives in a .py file that ends with mlflow.models.set_model(...), and log_model receives the file path. MLflow stores the source and rebuilds the chain on load, so unpicklable clients are never serialised and the logged code can be read. Passing any object, wrapped or not, still serialises it.

How to reason it out
  1. Spot that the failure is object serialisation.
  2. Choose the logging style that stores code, not objects.
  3. Remember the file must call set_model on the chain.

Exam tip: Log chains from code: a .py file that calls set_model, passed as a path.

Databricks GenAI Engineer: Coding pyfunc Chains and Registering Them to Unity Catalog — the lesson that teaches this.

Domain 5: Governance

8% of the Databricks GenAI exam, so 2 of the 25 questions on this page.

Question 21Governance

A Generative AI Engineer finds that a sales assistant's system prompt contains a partner API key, so the model can build authenticated request URLs. Red-teamers recovered the whole system prompt with role-play requests. The assistant must keep calling the partner API. Which change removes the exposure most reliably?

Choose one.

  • a
    Add a system prompt rule forbidding repetition of instructions

    A prompt rule is the kind of instruction the red-teamers already bypassed; the key would still be in the context.

  • b
    Enable the Safety guardrail on the endpoint inputs and outputs

    The Safety guardrail screens harmful content categories and is not designed to recognise an API key in a reply.

  • c
    Set output PII detection to Mask on the endpoint's AI Gateway

    PII detection targets personal data such as names, addresses and card numbers, not a partner's API credentials.

  • d
    Store the key in a Databricks secret that the tool code reads Correct

    The key never enters the model's context, so no prompt, however crafted, can make the model reveal it.

The concept

Anything in the model's context can be extracted by prompt injection, so secrets must stay out of prompts.

Why that’s the answer

No prompt rule or output filter reliably stops a model from disclosing text it was given. The robust guardrail is to never give it the secret: the tool code reads the key from a Databricks secret and makes the call, and the model only decides when to call the tool. The Safety and PII guardrails target other kinds of content.

How to reason it out
  1. Assume the system prompt can be extracted, because it already was.
  2. Ask what the model actually needs: the ability to call the API, not the key.
  3. Move the credential into a secret used by tool code.

Exam tip: If a secret is in the prompt, assume it will leak; keep credentials in tool code via secrets.

Databricks GenAI Engineer: Guardrails, PII Masking and Data Licensing — the lesson that teaches this.

Question 22Governance

A Generative AI Engineer's agent reads inbound customer emails, drafts replies and can forward messages with a send tool. A tester's email contained hidden text telling the agent to forward all recent invoices to an outside address, and the agent did. Drafting must stay automatic. Security wants controls that hold even when the model obeys injected text. Which TWO controls should the engineer add? (Select TWO.)

Choose TWO.

  • a
    Add a system prompt rule to ignore instructions found inside emails

    Worth having, but it is itself an instruction the model can be talked out of, so it does not hold when the model obeys the injection.

  • b
    Screen each inbound email with an LLM classifier for hidden instructions

    A classifier lowers the risk, but it is itself a model's judgement that a cleverly worded injection can get past, so it does not hold when the agent is fooled.

  • c
    Require a person to approve each send tool call before it runs Correct

    An approval step stops the forward even if the model has been tricked into calling the tool, and drafting stays automatic.

  • d
    Restrict the send tool to recipients in the company's own domain Correct

    With the tool unable to reach outside addresses, an injected instruction cannot exfiltrate invoices whatever the model decides.

  • e
    Log each tool call to the endpoint's inference table for review

    Logging helps investigate after the fact, but the invoices would already have been sent.

The concept

Indirect prompt injection arrives in content the agent processes; the controls that hold are those outside the model, on the tool itself.

Why that’s the answer

The email text is untrusted data that the model may treat as instructions. Prompt rules and LLM-based classifiers lower the chance of that, but both depend on a model judging correctly, and security asked for controls that hold even when the model is fooled. The defence must limit what the tool can do: an approval step before sending and a recipient allowlist both cap the damage regardless of the model's decision. Logging is detection, not prevention.

How to reason it out
  1. Identify the attack path: instructions hidden in an email the agent reads.
  2. Apply the stated constraint: the control must work even if the model complies.
  3. That excludes anything that relies on the model's judgement.
  4. Choose controls on the tool: human approval and a restricted recipient scope.

Exam tip: Assume the model can be fooled; constrain the tools so a fooled model can do little harm.

Databricks GenAI Engineer: Guardrails, PII Masking and Data Licensing — the lesson that teaches this.

Domain 6: Evaluation and Monitoring

12% of the Databricks GenAI exam, so 3 of the 25 questions on this page.

Question 23Evaluation and Monitoring

A Generative AI Engineer ran mlflow.genai.evaluate on a tool-calling agent. Correctness failed on 30 of 200 records. The engineer must find out, for each failed record, whether the agent called the wrong tool, received bad tool output or wrote a poor final answer. Where should the engineer look first?

Choose one.

  • a
    The Correctness mean in the evaluation run's metrics, split by record type

    Aggregate metrics show how often the agent failed, not which step failed in a given record.

  • b
    The inference table of the agent's serving endpoint, filtered to the same 30 failing questions

    Inference tables log production endpoint traffic, not the requests made during this offline evaluation.

  • c
    The Correctness rationale on each failed record, read without opening the trace

    The rationale explains why the answer is judged wrong, but not which intermediate step caused it.

  • d
    The trace of each failed record in the evaluation run, step by step through its spans Correct

    Evaluation records a trace per record, and its spans show each tool call, its inputs and outputs, and the final LLM call.

The concept

Each evaluated record produces an MLflow trace whose spans show every intermediate step.

Why that’s the answer

mlflow.genai.evaluate traces the agent on every record and attaches the scorers' assessments to those traces. Opening the trace of a failed record shows each span, such as the tool chosen, its arguments, its output and the final generation, so the failing step can be located. Aggregate metrics and judge rationales describe the outcome, and inference tables cover production traffic.

How to reason it out
  1. Failures are known; the failing step is not.
  2. Each evaluated record has a trace with one span per step.
  3. Inspect the spans of the failed records.

Exam tip: Scores say what failed; traces show where.

Databricks GenAI Engineer: Evaluating LLMs and Agents with MLflow Scorers and Judges — the lesson that teaches this.

Question 24Evaluation and Monitoring

A Generative AI Engineer evaluated agent versions 3 and 4 in separate MLflow runs on the same evaluation dataset with the same scorers. Version 4's overall RelevanceToQuery mean is slightly higher, but a reviewer suspects it got worse on some specific questions. How can the engineer identify exactly which requests regressed?

Choose one.

  • a
    Fetch each run's traces with mlflow.search_traces, match them on inputs, and compare each judge's value Correct

    Per-trace assessments matched by request show which individual questions scored worse in version 4.

  • b
    Compare the two runs' RelevanceToQuery mean metrics side by side in the experiment's run table

    The means are aggregates; they can rise even while individual questions get worse.

  • c
    Rerun version 4 with mlflow.genai.evaluate and a larger sample of the evaluation dataset

    A larger sample changes the aggregate but still does not show which specific requests regressed.

  • d
    Fetch each run's traces with mlflow.search_traces, match them on trace ID, and compare each judge's value

    Each run creates its own traces with new IDs, so the two runs' traces match on inputs, not on trace ID.

The concept

Per-request regressions are found by comparing assessments on matched traces, not by comparing run-level means.

Why that’s the answer

Each evaluation run stores one trace per record with the judges' assessments attached. Retrieving both runs' traces with mlflow.search_traces(run_id=...) and pairing them by their inputs lets the engineer compare each judge's value per request and list the regressions. Run-level means hide offsetting changes, and trace IDs differ between runs, so they cannot pair the records.

How to reason it out
  1. The question is per request, not overall.
  2. Assessments live on each run's traces.
  3. Pair traces across runs by their inputs and compare the values.

Exam tip: Regressions hide in means; compare matched traces' assessments.

Databricks GenAI Engineer: Evaluating LLMs and Agents with MLflow Scorers and Judges — the lesson that teaches this.

Question 25Evaluation and Monitoring

A Generative AI Engineer's agent must return valid JSON with an order_id field, because a downstream system parses every response. The team wants the evaluation to check this exactly on each record, with no judge model costs and the same result every run. Which scorer should the engineer add?

Choose one.

  • a
    A Guidelines judge with the rule that each output is JSON containing order_id

    An LLM judge costs model calls and can vary between runs on a check that code does exactly.

  • b
    A Python function decorated with @scorer that loads each output as JSON Correct

    A Python scorer can parse the JSON and check the field deterministically, without calling a model.

  • c
    A make_judge judge whose instructions ask it to parse the output as JSON

    make_judge creates an LLM judge, which adds model cost and is not deterministic.

  • d
    The built-in Correctness judge, given the expected JSON as the expected response

    Correctness is an LLM judge of factual agreement and needs a reference answer per record.

The concept

Deterministic, rule-based checks belong in code-based scorers.

Why that’s the answer

A function decorated with @scorer receives the output and can parse it as JSON and confirm the field exists, returning True or False with no model call. LLM judges, whether Guidelines, make_judge or Correctness, cost tokens and can vary on borderline cases, which the requirement excludes.

How to reason it out
  1. The check is mechanical: parse JSON, look for a field.
  2. The constraints are no model cost and repeatable results.
  3. Use a code-based @scorer.

Exam tip: Exact, mechanical checks: write a @scorer function, not an LLM judge.

Databricks GenAI Engineer: Evaluating LLMs and Agents with MLflow Scorers and Judges — the lesson that teaches this.

Keep going with Databricks GenAI

Databricks GenAI practice by domain

Databricks GenAI sample questions: your questions

No. Real exam questions are confidential. These are original questions written to the skills in the official Databricks GenAI exam guide, so they test the same knowledge in the same style without being copies of the exam.

Source

The domains and weights on this page come from the official Databricks GenAI exam guide.