Databricks-ML-Assoc ML Workflows Practice Question
A data scientist trains a scikit-learn model with MLflow tracking in a Databricks notebook. They call mlflow.sklearn.log_model(model, 'model') but later find that the Registered Model's schema shows no input signature, preventing automatic schema enforcement during serving. What should they have done to capture the model signature?
⚠ Common exam trap
The trap here is assuming that autologging or the Model Registry UI can add a signature after the fact, when signatures must be captured at log time.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Call mlflow.sklearn.log_model(model, 'model', signature=mlflow.models.infer_signature(X_train, model.predict(X_train)))
The model signature is created and attached during logging, not afterward. mlflow.models.infer_signature derives input and output schema from sample data and predictions, and passing it to log_model stores it in the MLmodel file. This enables schema enforcement and automatic serving input validation. Other options either do not create a signature or attempt unsupported post-hoc edits.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Register the model in the workspace Model Registry and then edit the signature in the UI
Why it's wrong here
The Model Registry UI does not provide an editor for model signatures; signatures are part of the logged MLmodel artifact and are immutable after logging. Registration simply creates a catalog entry pointing to a model version. Editing signature would require re-logging the model with a signature, so this approach cannot work.
- ✓
Call mlflow.sklearn.log_model(model, 'model', signature=mlflow.models.infer_signature(X_train, model.predict(X_train)))
Why this is correct
mlflow.models.infer_signature(X_train, model.predict(X_train)) examines the training DataFrame and the model's predictions to build an MLflow ModelSignature containing input and output column types. Passing it to log_model persists the signature in MLmodel, enabling schema validation and automatic enforcement by Model Serving. It is the documented, lightweight way to capture schema without manual specification.
- ✗
Log the training DataFrame as an artifact and add a signature manually in the MLmodel file after training
Why it's wrong here
Manually editing the MLmodel file is error-prone and not supported by MLflow APIs; the file is generated during logging and may be overwritten. Logging the DataFrame as an artifact does not create a signature. The correct, supported method is to compute and pass a signature at log time using mlflow.models.infer_signature.
- ✗
Enable autologging with mlflow.sklearn.autolog() before training and logging
Why it's wrong here
Autologging captures parameters, metrics, and the model artifact but does not automatically infer and attach a model signature unless a training dataset is passed and supported; even then, it does not retroactively fix a model already logged without a signature. It is useful for convenience but does not reliably solve the specific missing-signature problem described.
About these practice questions
Courseiva writes every Databricks-ML-Assoc question from scratch — 319 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-ML-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Assoc exam.