Courseiva

Databricks Certified Machine Learning Associate (Databricks-ML-Assoc) — Questions 301–319

319 questions total · 5 pages · All types, answers revealed

Page 4

Page 5 of 5

301
Multi-Selectmedium

Which TWO actions should be taken to ensure reproducibility of a Databricks ML model experiment?

Select 2 answers
A.Hardcode the data file paths to local desktop directories.
B.Log the Git commit hash along with experiment metadata in MLflow.
C.Only log the model artifact and ignore the environment dependencies.
D.Utilize Delta Time Travel to query the data as it existed during training.
E.Manually delete all previous MLflow runs to keep the tracking server clean.
AnswersB, D

Logging the Git commit hash allows developers to link the model artifact to the exact version of the source code that produced it. This is essential for auditing and reproducing experiments months later, as it provides a clear record of the code changes that led to specific model performance.

Why this answer

Reproducibility in Databricks is achieved by capturing the state of the code, the environment, and the data. By utilizing Git integration and MLflow tracking, data scientists can point to the exact version of the code and environment used for an experiment. Using versioned Delta tables ensures that the data state can also be reconstructed, preventing 'data drift' from invalidating the results of historical experiments as underlying data tables change.

Exam trap

Candidates often forget that code and environment versioning are insufficient without capturing the exact historical state of the underlying data.

302
MCQmedium

A data scientist has registered a scikit-learn model in Unity Catalog as `ml_team.prod.churn_model` and wants it served by a Databricks Model Serving endpoint that performs online inference for a web app. The endpoint must automatically pick up new model versions as they are promoted, without the data scientist editing the endpoint each time. Which approach should the data scientist use to configure the served entity?

A.Serve the model by name with the version set to the alias `champion`, so the endpoint resolves the alias to whatever version it currently points to.
B.Create a Databricks job that runs every five minutes, downloads the latest model version, and calls the Model Serving REST API to overwrite the endpoint configuration with the new numeric version.
C.Serve the model by name with the version pinned to the numeric version that is currently in production, then re-create the endpoint whenever a new version is registered.
D.Export the MLflow model to a local directory, upload the artifacts to DBFS, and configure the endpoint to load the model from that DBFS path.
AnswerA

Serving a model by name plus an alias lets Model Serving resolve the alias at request time, so promoting a new version to `champion` updates the served model without endpoint edits. This matches the requirement of automatic pickup on promotion and works with Unity Catalog-registered models, provided the endpoint's identity has EXECUTE on the model and its versions.

Why this answer

Serving by model name with an alias makes the endpoint follow promotions automatically: when a new version is assigned the `champion` alias, subsequent requests resolve to that version. Pinning a numeric version, copying artifacts to DBFS, or polling with a job all require manual or scheduled intervention and cannot deliver the immediate, configuration-free update the scenario demands.

Exam trap

The trap here is assuming that any serving configuration referencing a registered model will automatically follow the newest version, when in fact only an alias or version reference determines what is actually served.

303
MCQhard

An ML engineer is using Databricks Jobs to orchestrate a pipeline that includes a notebook for feature engineering and a notebook for model training. The training notebook must run only after the feature engineering notebook completes successfully, and both must run on a schedule. Which configuration in Databricks Jobs achieves this dependency?

A.Use a single notebook that calls the feature engineering notebook and then the training notebook using %run.
B.Set the training notebook to run on a schedule that starts after the expected completion time of the feature engineering notebook.
C.Create a multi-task job where the training task has a depends_on condition referencing the feature engineering task.
D.Create two separate jobs and configure the training job to be triggered by the completion of the feature engineering job using a job run trigger.
AnswerC

Databricks Jobs supports multi-task workflows with dependencies. By setting depends_on for the training task to the feature engineering task, the training task runs only after the feature engineering task succeeds. This is the native, supported way to express task dependencies within a job, and the job can be scheduled.

Why this answer

Databricks Jobs multi-task workflows allow defining tasks with dependencies using depends_on. This ensures the training task starts only after the feature engineering task succeeds, and the entire job can be scheduled. Separate jobs with triggers, %run, or time-based scheduling do not provide the same reliable dependency semantics.

Exam trap

The trap here is thinking that separate jobs or time-based scheduling can enforce a dependency, when only a multi-task job with depends_on guarantees sequential execution on success.

304
MCQhard

A team has registered a model in Unity Catalog and wants to serve it with Databricks Model Serving. Their security policy requires that the endpoint access the model without embedding long-lived credentials, and they want the endpoint to use a dedicated service principal for accessing downstream feature tables. Which configuration should they apply to meet these requirements?

A.Mount the feature tables as a DBFS path and configure the model to read them using a cluster-scoped credential passthrough token.
B.Enable token-based authentication on the endpoint and pass the token in each inference request header from the calling application.
C.Configure the Serving endpoint with a personal access token stored in the endpoint's environment variables.
D.Grant the endpoint's service principal access to the model and feature tables via Unity Catalog privileges, and configure the endpoint to use that service principal.
AnswerD

Databricks Model Serving integrates with Unity Catalog so that an endpoint can run under a service principal identity. By granting that principal `EXECUTE` on the model and `SELECT` on feature tables, the endpoint accesses resources without embedding credentials. This satisfies both the no-long-lived-credentials policy and the need for a dedicated identity. The service principal's Unity Catalog privileges govern all access at runtime.

Why this answer

Unity Catalog allows Databricks Model Serving endpoints to run under a service principal identity, with access governed by Unity Catalog privileges on models and tables. Granting the service principal `EXECUTE` on the registered model and `SELECT` on feature tables enables secure, credential-free access. This design avoids embedding long-lived tokens and provides auditable, least-privilege access for production inference workloads.

Exam trap

The trap here is confusing inbound authentication to the endpoint with the outbound identity the endpoint uses to reach models and data.

305
MCQmedium

Which approach is most efficient for tracking hyperparameter tuning metrics across thousands of runs on Databricks?

A.Logging results to a text file.
B.Using MLflow Experiments UI.
C.Printing metrics to the notebook logs.
D.Manually updating a spreadsheet.
AnswerB

The MLflow Experiments UI is designed specifically for this use case. It allows users to group, sort, and filter runs based on metrics and parameters, making it easy to compare thousands of runs. It is the most effective way to gain insights and find the optimal model configuration quickly.

Why this answer

Using the MLflow Search API or the Experiments UI is the standard approach to manage and analyze large volumes of experiment results. These tools provide filtering, sorting, and visualization capabilities that allow data scientists to quickly identify the best performing models from thousands of candidates. This efficiency is necessary for iterative machine learning, where the ability to derive insights from vast amounts of experiment data drives faster and more accurate model development.

Exam trap

Candidates often choose manual logging inspection or flat file exports instead of leveraging the built-in filtering and visualization capabilities of the MLflow UI and Search API.

306
MCQmedium

A model has been trained on a dataset containing categorical features with high cardinality. Which technique is most effective for preparing these features for a linear model in a Databricks environment?

A.One-hot encode all categorical variables.
B.Use Target Encoding to map categories to their mean target value.
C.Drop the categorical features entirely.
D.Convert all features into a single string representation.
AnswerB

Target encoding is highly effective for high-cardinality features, as it transforms categorical levels into a continuous numerical representation based on the target variable. This reduces dimensionality while retaining meaningful information, which is ideal for linear models that perform best when features are appropriately scaled and numeric.

Why this answer

Linear models require numeric inputs and are sensitive to the scale and representation of categorical variables. One-hot encoding high-cardinality features results in sparse, high-dimensional matrices that degrade performance. Target encoding or using specialized embeddings is more efficient.

Choosing the right encoding strategy is a critical model development decision that directly impacts training speed, convergence, and the overall predictive accuracy of the final model deployed into production.

Exam trap

Candidates often default to One-Hot Encoding, ignoring that high-cardinality categorical features cause dimensionality explosion, making Target Encoding the more scalable and performant choice for linear models.

307
MCQeasy

A team has just registered a new version of a fraud detection model in the workspace Model Registry. Before routing production traffic to it, they want to send a small percentage of live requests to the new version and compare its predictions against the current production model. Which Databricks Model Serving feature should they use?

A.Inference tables
B.Provisioned throughput
C.Traffic splitting between served entities
D.Model aliases
AnswerC

Databricks Model Serving supports configuring multiple served entities on one endpoint and assigning each a percentage of traffic. By giving the new model version a small percentage and the current production model the remainder, the team can perform a canary-style rollout and compare live behavior before a full switch. This is exactly the built-in mechanism for gradual, controlled deployment of a new model version.

Why this answer

Traffic splitting on a Databricks Model Serving endpoint allows multiple served entities, each pointing to a different model version, to share incoming requests by percentage. This makes it possible to route a small fraction of live traffic to a new version and compare its behavior against the existing production model before promoting it fully. Other listed features address logging, capacity, or naming, not request routing.

Exam trap

The trap here is conflating logging with routing: inference tables record what happened, but only traffic splitting actually sends a percentage of requests to the new model version.

308
MCQmedium

A team wants to monitor a production Model Serving endpoint for data drift and to capture the exact request payloads and responses for later auditing. They want this logging to happen automatically without adding code to the client application. What should they configure on the endpoint?

A.Enable inference tables on the endpoint so requests and responses are automatically logged to a Delta table for monitoring and auditing.
B.Attach an MLflow experiment to the endpoint so each prediction is recorded as a run with parameters and metrics.
C.Add client-side logging middleware in the application that writes each request and response to a Delta table before and after calling the endpoint.
D.Configure the endpoint to write its container stdout and stderr to a log delivery location in cloud storage.
AnswerA

Inference tables capture the request and response payloads of a serving endpoint into a Delta table automatically, with no client changes. Teams can then join those logs against training data to compute drift metrics and retain an audit trail. Enabling the feature is a configuration step on the endpoint, matching the requirement for automatic, code-free logging.

Why this answer

Inference tables are the native Model Serving feature that logs request and response payloads to a Delta table automatically, enabling drift monitoring and auditing without touching client code. Client middleware, container logs, and MLflow experiments either require application changes, lack payload structure, or are not built for high-volume inference logging.

Exam trap

The trap here is assuming that operational logs or MLflow tracking can substitute for inference tables, when only inference tables capture structured request and response payloads at the endpoint.

309
MCQmedium

A data scientist is performing hyperparameter tuning for a scikit-learn model using MLflow on a Databricks cluster. They want to parallelize the tuning to reduce total runtime. Which Databricks-supported method allows them to run multiple trials concurrently with minimal code changes?

A.Use Databricks Jobs to schedule multiple notebook runs with different parameters.
B.Use MLflow's `mlflow.sklearn.autolog()` with a single run.
C.Use MLflow Projects to package the training code and run it via `mlflow run`.
D.Use Hyperopt with `SparkTrials`.
AnswerD

Hyperopt's `SparkTrials` integrates with Apache Spark to distribute hyperparameter trials across the cluster. It runs multiple trials in parallel, leveraging Spark executors, and works seamlessly with MLflow for tracking. This approach requires minimal code changes: replacing `Trials` with `SparkTrials` in the `fmin` call enables parallel tuning.

Why this answer

Hyperopt's `SparkTrials` is the Databricks-recommended way to parallelize hyperparameter tuning. It distributes trials across Spark executors, integrates with MLflow for automatic logging, and requires only a small change to the tuning code. Other options either do not provide parallelism or require manual orchestration, making them less efficient.

Exam trap

The trap here is assuming that MLflow autologging or Projects provide built-in parallelism for hyperparameter tuning, when they actually only handle logging or packaging.

310
MCQhard

An ML engineer is using Databricks Jobs to orchestrate a multi-step ML pipeline. The pipeline includes a task that trains a model and logs it to MLflow, followed by a task that registers the model in the Model Registry. The engineer wants to ensure that the model is only registered if its accuracy exceeds a threshold. Which approach best implements this conditional logic?

A.Configure the Model Registry to automatically register models only if they meet a performance threshold set in the model's metadata.
B.In the training task, evaluate the model and if accuracy exceeds the threshold, call the MLflow Model Registry API to register the model.
C.Use a Databricks Job with a conditional task that checks a metric value stored in a Delta table and then triggers registration.
D.Use a Databricks Job with multiple tasks and define a dependency that runs the registration task only if the training task succeeds.
AnswerB

Embedding the evaluation and conditional registration within the training task allows the logic to check accuracy and only register if the threshold is met. This is a common pattern in Databricks Jobs, where a single task can contain multiple steps. It ensures that registration is gated by the metric, avoiding unnecessary separate tasks.

Why this answer

The most straightforward way to conditionally register a model based on accuracy is to perform the evaluation within the training task and call the Model Registry API only if the threshold is met. This keeps the logic in one place and avoids unnecessary task dependencies. Other approaches either do not enforce the metric condition or require additional complexity.

Exam trap

The trap here is assuming that task dependencies or Model Registry settings can enforce metric-based conditions, but they only handle success/failure or metadata, not dynamic thresholds.

311
MCQeasy

An ML engineer is using MLflow Tracking to compare multiple runs of a hyperparameter tuning experiment. The engineer wants to quickly identify the run that achieved the best validation accuracy and then promote that run's model to the Model Registry. Which MLflow feature allows the engineer to view and compare runs in a centralized UI?

A.MLflow Model Registry
B.MLflow Projects
C.MLflow Tracking UI
D.MLflow Models
AnswerC

The MLflow Tracking UI provides a centralized interface to view experiments, runs, metrics, parameters, and artifacts. It allows sorting and filtering runs by metrics, making it easy to identify the best run. From the UI, you can also register a model directly to the Model Registry. This directly addresses the engineer's need to compare and promote.

Why this answer

The MLflow Tracking UI is designed to log and compare runs, displaying metrics, parameters, and artifacts in a sortable table. It allows the engineer to identify the best run and then register its model to the Model Registry with a few clicks, streamlining the workflow.

Exam trap

The trap here is confusing the Model Registry with the Tracking UI; the Registry manages model versions, while the Tracking UI compares runs.

312
MCQmedium

A machine learning engineer is training a scikit-learn model on a Databricks cluster and wants every hyperparameter, evaluation metric, and the fitted estimator itself to be captured automatically without writing custom logging code. The engineer uses MLflow with autologging enabled. Which statement best describes what MLflow autologging records for this scikit-learn run?

A.It logs the environment dependencies only, allowing reproduction but not artifact capture.
B.It logs hyperparameters, training metrics, the model signature, and the fitted model artifact automatically.
C.It logs only the hyperparameters passed to the estimator constructor and nothing else.
D.It logs metrics and artifacts but requires a separate call to register the model in Unity Catalog.
AnswerB

MLflow scikit-learn autologging instruments the fit call and captures the estimator's hyperparameters, evaluation metrics computed during fitting, the inferred model signature, and serializes the fitted model as an artifact. This satisfies the engineer's goal of capturing everything without manual logging code, because the integration hooks into the training call itself rather than requiring explicit log_param or log_metric invocations.

Why this answer

Scikit-learn autologging hooks into the training call and records hyperparameters, metrics, the inferred signature, and the fitted model artifact. Because the integration operates at the estimator level, the engineer does not need to add explicit logging calls to capture the model or its evaluation results, which directly fulfills the requirement of automatic capture during training.

Exam trap

The trap here is assuming autologging only captures parameters, when it also serializes the fitted model and metrics automatically.

313
MCQeasy

A machine learning engineer has a registered model and wants to expose it as a REST endpoint that their application can call for real-time predictions. They need the endpoint to be created and managed natively within Databricks, with the ability to enable scale-to-zero during idle periods. Which Databricks capability should they use?

A.MLflow Model Registry webhooks that notify an external service whenever a model version is registered, letting that service host the model.
B.A Databricks job that runs a Python script loading the model and starting a Flask web server on a driver node, exposed via a public URL.
C.Databricks Model Serving, creating an endpoint that serves the registered model and configuring the served entity with scale-to-zero enabled.
D.A SQL warehouse with a user-defined function that loads the model artifact and returns predictions for incoming queries.
AnswerC

Databricks Model Serving provides managed REST endpoints for registered models and supports scale-to-zero, which shuts down compute when there is no traffic and cold-starts on the next request. This satisfies both the native management and idle-cost requirements. The endpoint exposes a standard REST interface and integrates with Unity Catalog for permissions and lineage.

Why this answer

Databricks Model Serving is the native mechanism for deploying registered models as REST endpoints with managed lifecycle, authentication, and optional scale-to-zero. A Flask process on a job cluster, registry webhooks, or a SQL warehouse cannot provide a stable, secure, autoscaling prediction API, so they fail the scenario's requirements for native management and idle shutdown.

Exam trap

The trap here is assuming that any Databricks compute that can run Python can also host a production-grade model endpoint, when only Model Serving provides managed REST inference.

314
MCQmedium

Refer to the exhibit. Why is providing an 'input_example' highly recommended during the model logging process?

A.It automatically generates unit tests for the training pipeline.
B.It enables automatic schema validation and documentation in the model registry.
C.It increases the accuracy of the model during inference.
D.It forces the model to use a faster serializing algorithm.
AnswerB

The input example allows the system to verify that the model's expected inputs match the actual provided data. This is a key feature of Unity Catalog, which uses this example to document the model, making it discoverable and ensuring that consumers have a clear understanding of the expected input format.

Why this answer

Providing an input example allows MLflow to infer the model's input schema and provides a test case for downstream deployment. This example is critical for Databricks to validate the model's interface, allowing automated tests to run against the model immediately upon deployment. It also serves as a form of self-documentation, helping other team members understand how to interact with the model's API without needing to look at complex training code.

Exam trap

Candidates often view 'input_example' as optional documentation, failing to realize it is a functional requirement for MLflow to infer schemas and perform automated validation during deployment.

315
MCQhard

A machine learning engineer is orchestrating a multi-step training workflow with Databricks Jobs. The workflow must retrain a model, evaluate it, and only register it if a quality threshold is met, otherwise stop without registering. Which approach best implements this conditional logic within the job?

A.Rely on the job's automatic retry policy to skip registration when evaluation fails.
B.Set a job timeout so that registration never runs if evaluation takes too long.
C.Use task dependencies with a condition task that branches based on the evaluation result.
D.Configure the cluster's autoscaling to pause the job when metrics drop below the threshold.
AnswerC

Databricks Jobs support condition tasks that evaluate a boolean expression and route execution down one of two branches. By placing evaluation before the condition, the job can proceed to the registration task only when the threshold is met and otherwise take a terminating branch. This encodes the conditional gating directly in the workflow without external orchestration.

Why this answer

Condition tasks in Databricks Jobs evaluate an expression and branch execution, enabling a workflow to proceed to registration only when the evaluation metric meets the threshold. This places the quality gate inside the job, so a failing model follows a terminating branch instead of triggering registration.

Exam trap

The trap here is assuming retries or timeouts can enforce a quality gate, when only condition tasks provide branching control flow.

316
MCQhard

A machine learning engineer is using MLflow to log a model trained with XGBoost. They want to ensure that the model can be loaded and used for inference in a different environment without requiring the original training environment. Which MLflow feature allows the model to capture its dependencies and environment?

A.MLmodel file with conda_env and requirements.txt
B.Run ID
C.Model signature
D.Model version
AnswerA

When logging a model, MLflow automatically creates an MLmodel file that includes a conda environment specification and a requirements.txt file. These files list the dependencies needed to recreate the environment. This allows the model to be loaded in a different environment by installing the specified packages, ensuring reproducibility.

Why this answer

The MLmodel file, along with conda_env and requirements.txt, captures the dependencies required to load and run the model. When logging a model, MLflow automatically generates these files based on the current environment. This enables the model to be deployed in a different environment by recreating the necessary dependencies, ensuring consistent behavior.

Exam trap

The trap here is thinking that the model signature or version handles environment portability; only the MLmodel file with dependency specifications does that.

317
MCQeasy

When preparing data for machine learning in Databricks, which feature of Delta Lake is most beneficial for managing large-scale datasets during the training process?

A.Compaction (Auto Optimize) for improved query speed during data reading.
B.Time Travel (versioning) to access previous snapshots of training data.
C.Schema enforcement to prevent corrupted data from entering the training set.
D.Z-Ordering to speed up filtering on specific columns in the dataset.
AnswerB

Time Travel enables access to specific versions of the data, which is critical for model reproducibility. By referencing a specific timestamp or version, data scientists can guarantee that their training experiments are conducted on the exact same data state, facilitating auditability and consistency across different model training iterations.

Why this answer

Delta Lake's Time Travel (versioning) feature allows data scientists to query data as it existed at a specific point in time. This is essential for ensuring reproducibility in machine learning experiments, as it ensures that the training data remains consistent across different runs, even if the underlying table is updated or modified by other processes in the production pipeline.

Exam trap

Candidates often confuse Delta Lake Time Travel with standard git-like code versioning or MLflow model versioning, mistakenly thinking it tracks model code rather than the underlying dataset snapshots.

318
MCQmedium

A machine learning engineer is deploying a model to a Databricks Model Serving endpoint and needs to send feature values that are computed by a separate upstream pipeline. The engineer wants the endpoint to accept a JSON payload describing a single record with named fields. Which approach correctly describes how the client should format the request?

A.Send a JSON body containing a base64-encoded serialized pandas DataFrame along with a pickle content type.
B.Send the record as form-encoded key-value pairs in the request body with a content type of application/x-www-form-urlencoded.
C.Send a JSON body with a dataframe_records or dataframe_split field containing the named columns matching the model signature.
D.Send a JSON body with an inputs field containing a nested array of numeric values in the exact column order of training.
AnswerC

Databricks Model Serving accepts pandas DataFrame inputs in JSON using the dataframe_records or dataframe_split format, where each record maps column names to values. This aligns with the signature logged for a scikit-learn or similar model and lets the endpoint validate and score the record without custom parsing.

Why this answer

For models logged with a pandas DataFrame signature, Databricks Model Serving accepts JSON using dataframe_records or dataframe_split, where each record is an object of column names to values. This preserves the named-column contract and allows signature validation. Positional array formats and non-JSON encodings do not match the DataFrame interface and would either fail validation or misalign features.

Exam trap

The trap here is assuming any JSON structure works, when the endpoint expects the specific dataframe_records or dataframe_split format for DataFrame-signature models.

319
MCQeasy

A data scientist is preparing a dataset for training a model on Databricks. They want to split the data into training and testing sets, and they need to ensure that the split is reproducible across different runs. Which PySpark method should they use to split the DataFrame with a fixed random seed?

A.df.randomSplit([0.8, 0.2], seed=42)
B.df.repartition(2)
C.df.sample(fraction=0.8, seed=42)
D.df.cache()
AnswerA

randomSplit splits a DataFrame into multiple DataFrames according to the provided weights, and the seed parameter ensures reproducibility. Using seed=42 guarantees that the same split is generated each time the code runs, which is essential for consistent model evaluation. This method is the standard PySpark approach for train-test splitting with a fixed random seed.

Why this answer

randomSplit is the PySpark method designed to split a DataFrame into multiple parts based on weights, and it accepts a seed for reproducibility. This allows the data scientist to obtain consistent training and testing sets across runs. Other methods like sample, repartition, or cache do not provide a reproducible train-test split.

Exam trap

The trap here is confusing sampling with splitting, when randomSplit is specifically built to return multiple disjoint DataFrames with a seed for reproducibility.

Page 4

Page 5 of 5

All pages

Practice Databricks-ML-Assoc by domain

Target a specific domain to shore up weak areas.

See all domains with question counts →