Generative AI Engineer Associate · Domain 4: Assembling and Deploying Applications · 22% of the exam
Task 4.3: Control access to resources from model serving endpoints; Identify how to serve an LLM application that leverages Foundation Model APIs; Identify batch inference workloads and apply ai_query() appropriately
Secrets-based environment variables, endpoint permissions, pay-per-token and provisioned throughput Foundation Model APIs, and batch inference over tables with ai_query.
Study it
Secrets, endpoint permissions and Foundation Model APIs
Lesson coming
Batch inference with ai_query
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.
Question 1 · choose 2
A pyfunc chain served on Model Serving calls a third-party API whose key must not appear in code or plain-text configuration. Which TWO steps are required? (Choose TWO.)
AStore the key as a plain-text environment variable
BReference the key as {{secrets/scope/key}} in an environment variable
CLog the key as an artifact with the model version
DGive the endpoint creator READ access on the referenced secret
EEnable route optimization on the endpoint
Show the answer and why
AStore the key as a plain-text environment variable
Incorrect
Plain-text variables are for values that do not need to be hidden.
BReference the key as {{secrets/scope/key}} in an environment variable
Correct
Secrets-based environment variables use this syntax; anything else is treated as plain text.
CLog the key as an artifact with the model version
Incorrect
Artifacts are stored with the model, which puts the credential in the package itself.
DGive the endpoint creator READ access on the referenced secret
Correct
The endpoint creator must have READ access to the Databricks secrets referenced in the configuration.
EEnable route optimization on the endpoint
Incorrect
Route optimization lowers latency and raises throughput; it does not handle credentials.
Model Serving fetches secrets from Databricks secret scopes at serving time and populates secrets-based environment variables for the model code.
A healthcare chatbot will serve a fine-tuned variant of a supported base architecture to clinicians all day. The compliance team requires an offering with HIPAA certification, and response times must hold during traffic peaks. Which Foundation Model APIs mode fits?
AStandard pay-per-token on the preconfigured endpoint
BPriority pay-per-token with service_tier set to priority
CAI Functions batch inference with ai_query from a job
DProvisioned throughput, on demand or reserved
Show the answer and why
AStandard pay-per-token on the preconfigured endpoint
Incorrect
Standard pay-per-token serves Databricks-hosted base models on shared capacity, not the team's fine-tuned variant.
BPriority pay-per-token with service_tier set to priority
Incorrect
Priority mode keeps availability more consistent for hosted pay-per-token models, but it still does not serve a fine-tuned variant.
CAI Functions batch inference with ai_query from a job
Incorrect
AI Functions mode is recommended for batch workloads, not an interactive chatbot used all day.
DProvisioned throughput, on demand or reserved
Correct
Provisioned throughput is recommended for production, supports fine-tuned variants and performance guarantees, and is available with compliance certifications such as HIPAA.
Foundation Model APIs come in pay-per-token (with priority mode), provisioned throughput (on-demand or reserved) and AI Functions optimized modes. Provisioned throughput serves base, fine-tuned and custom-weight models of supported architectures.
A nightly job summarizes 40 million rows by looping in Python over 1,000-row batches and calling a provisioned throughput endpoint. One malformed row fails the whole run, and the job overruns its window. Which redesign follows Databricks guidance for batch inference?
AKeep the loop and halve the batch size so failures affect fewer rows
BOne ai_query over the whole table, a batch-optimized system.ai model, failOnError => false
CRun ai_query in 1,000-row slices against the same provisioned throughput endpoint, one slice per task
DMove the loop to a real-time chat endpoint with scale to zero
Show the answer and why
AKeep the loop and halve the batch size so failures affect fewer rows
Incorrect
Manual splitting into small batches reduces throughput, so the overrun gets worse.
BOne ai_query over the whole table, a batch-optimized system.ai model, failOnError => false
Correct
AI Functions handle parallelization, retries and scaling across the whole dataset, batch-optimized models give the best throughput, and failOnError false keeps successful rows while recording errors.
CRun ai_query in 1,000-row slices against the same provisioned throughput endpoint, one slice per task
Incorrect
Slicing defeats the automatic parallelism, and system.ai model services are recommended over provisioned throughput endpoints for this.
DMove the loop to a real-time chat endpoint with scale to zero
Incorrect
A real-time endpoint is not built for 40 million rows, and cold starts add delay.
For batch inference, use ai_query with Databricks-hosted system.ai models optimized for batch, submit the full dataset in a single query, and set failOnError to false for large workloads.
A SQL function wraps ai_query against a custom model serving endpoint. Which permission must the function's definer have on the endpoint?
ACAN VIEW
BSELECT on the endpoint
CNo permission is needed
DCAN QUERY
Show the answer and why
ACAN VIEW
Incorrect
CAN VIEW lets a user get and list the endpoint but not query it.
BSELECT on the endpoint
Incorrect
SELECT is a table privilege, not an endpoint permission.
CNo permission is needed
Incorrect
Endpoint access is permission-controlled.
DCAN QUERY
Correct
The definer of ai_query must have CAN QUERY permission on the endpoint it invokes.
ai_query invokes an existing Model Serving endpoint in the same workspace; the definer needs CAN QUERY on it. Wrapping ai_query in a function and granting EXECUTE shares it.