First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Model Development
A data scientist wants to log a scikit-learn model to the MLflow Model Registry so it can be served with the built-in pyfunc flavor. Which MLflow API call records the model together with its signature and input example in a single step?
- mlflow.log_artifact(pickle.dumps(sk_model))
- mlflow.sklearn.log_model(sk_model, artifact_path, signature=..., input_example=...) Correct answer.
- mlflow.pyfunc.save_model(path, python_model=sk_model)
- mlflow.register_model(model_uri, name)
Explanation
The flavor-specific log_model function persists the estimator in MLflow's native format, records flavor metadata, and optionally captures a signature and input example used later for schema validation at serving time. register_model only creates a registry entry from an already logged artifact URI.
Question 2Model Development
In an MLflow run, which artifact is required for the Model Registry to display a human-readable input/output schema for a logged model?
- The run's metrics history file
- The source notebook revision hash
- The MLflow model signature stored in MLmodel metadata Correct answer.
- The conda.yaml environment file
Explanation
The model signature is serialized into the MLmodel metadata file and describes expected inputs and outputs, which the Registry surfaces as the model schema. Environment and source files describe reproducibility, not data schema.
Question 3Model Development
A team needs a custom transformation that is not available in any built-in MLflow flavor, and the model must be loadable by mlflow.pyfunc.load_model. What is the correct approach?
- Export the model to ONNX and register it without a flavor
- Subclass mlflow.pyfunc.PythonModel and implement predict, then log with mlflow.pyfunc.log_model Correct answer.
- Use mlflow.tracking.MlflowClient().create_registered_model with a pickle file
- Log the model with mlflow.log_artifact and load it with joblib
Explanation
The pyfunc flavor allows arbitrary Python logic when you implement a PythonModel subclass with a predict method and log it through the pyfunc log_model API. This produces a standard MLflow model loadable by the generic pyfunc loader.
Question 4Model Development
When calling mlflow.evaluate with model_type="classifier", which metric set is produced by default for a binary target?
- Accuracy, F1, precision, recall, and ROC AUC Correct answer.
- Only RMSE and MAE
- Silhouette score and Davies-Bouldin index
- Perplexity and BLEU
Explanation
For classifier evaluation MLflow computes classification metrics such as accuracy, F1, precision, recall, and ROC AUC by default. Regression and clustering metric sets are used for other model types.
Question 5Model Development
A practitioner wants MLflow to automatically capture feature importance plots during evaluation. Which argument to mlflow.evaluate enables this?
- evaluators="default" Correct answer.
- feature_importance=True
- model_type="regressor"
- log_explainer=True
Explanation
Passing the default evaluator set enables the built-in evaluators, which generate artifacts such as feature importance and SHAP plots for supported model types. The evaluator configuration controls which diagnostic artifacts are produced.
Question 6Model Development
Which statement correctly describes how MLflow autologging behaves for scikit-learn when mlflow.sklearn.autolog() is enabled before fitting?
- It requires manual mlflow.start_run around each fit call to record anything
- It only logs the final model artifact and nothing else
- It logs parameters, metrics, and the fitted model automatically without explicit log calls Correct answer.
- It disables the Model Registry for the resulting runs
Explanation
Autologging instruments supported libraries so that parameters, metrics, and the trained model are recorded automatically when fit is called. It creates or reuses runs without requiring explicit logging calls.
Question 7Model Development
A model served through a Databricks Model Serving endpoint receives requests whose payload no longer matches the logged signature. What is the expected behavior?
- The request is queued until an operator updates the signature
- The request is rejected with a schema validation error Correct answer.
- The endpoint silently coerces any input to the expected types
- The endpoint retrains the model on the new schema
Explanation
When a signature is present, serving enforces it and rejects payloads that violate the declared schema, returning a validation error. This protects downstream predictions from malformed input.
Question 8Model Development
Which Unity Catalog object is used to store and govern a registered model along with its versions and aliases?
- A model in the Unity Catalog metastore with a three-level namespace Correct answer.
- A secret scope entry
- A Delta table in the hive_metastore
- A notebook in a workspace folder
Explanation
Unity Catalog registers models under a catalog.schema.model namespace, giving centralized governance, lineage, and alias support across versions. The legacy workspace registry lacked this three-level namespace.
Question 9Model Development
A data scientist wants to promote the best-performing version of a registered model to production without changing client code that references a fixed name. Which registry feature supports this?
- Artifact URI hardcoding
- Model aliases such as "Champion" Correct answer.
- Experiment descriptions
- Run tags on the training run
Explanation
Aliases let you point a stable name at a specific model version, so clients load by alias and promotion means reassigning the alias. This decouples consumers from version numbers.
Question 10Model Development
Which approach best implements feature engineering that must be identical at training and inference time for a model logged with MLflow?
- Document the transformation in a README
- Embed the transformation in a pyfunc model or a pipeline so it is part of the logged model Correct answer.
- Recompute features in a separate notebook at serving time
- Store the transformation code in a run tag
Explanation
Packaging transformations inside the model artifact, for example via a scikit-learn Pipeline or a custom pyfunc wrapper, guarantees the same logic runs in training and serving. External documentation or separate code risks train-serve skew.
Question 11Model Development
A practitioner needs distributed training of an XGBoost model on a large Spark DataFrame inside a Databricks notebook. Which library provides the wrapper that integrates with Spark for this purpose?
- pyspark.ml.regression.LinearRegression
- xgboost.spark.SparkXGBRegressor Correct answer.
- mlflow.pyfunc.PythonModel
- sklearn.ensemble.GradientBoostingRegressor
Explanation
The xgboost.spark module offers Spark estimators such as SparkXGBRegressor that distribute training across Spark workers. The plain scikit-learn estimator runs on a single node.
Question 12Model Development
Which hyperparameter optimization tool is natively integrated with MLflow tracking and supports early stopping via a pruning callback in Databricks?
- Random search written by hand
- Grid search implemented with nested for loops
- Optuna with MLflowCallback and pruning Correct answer.
- Manual trial and error recorded in a spreadsheet
Explanation
Optuna integrates with MLflow through callbacks that log trials, and its pruning mechanism can terminate unpromising trials early. Hand-rolled loops lack native tracking and pruning integration.
Question 13Model Development
A team wants reproducible experiments where each run records the exact library versions used. Which MLflow capability addresses this directly?
- Increasing the artifact retention period
- Logging the conda environment and pip requirements as part of the model Correct answer.
- Setting a random run name
- Using a larger cluster
Explanation
MLflow captures the environment, including conda and pip dependencies, in the model artifact so the runtime can be reconstructed. This is the mechanism for version reproducibility.
Question 14Model Development
When evaluating a model with mlflow.evaluate, a practitioner supplies a static dataset plus a model URI. What does MLflow use to generate predictions for the metrics?
- It queries the Model Registry for cached metrics
- It requires precomputed predictions in a separate column
- It loads the model from the URI and calls its predict on the dataset Correct answer.
- It retrains the model on the dataset first
Explanation
mlflow.evaluate loads the referenced model and invokes prediction over the provided dataset before computing metrics. Precomputed predictions can be evaluated separately, but with a model URI MLflow generates them.
Question 15Model Development
Which statement about the difference between mlflow.log_model and mlflow.save_model is accurate?
- log_model writes to the active run's artifact location, while save_model writes to a local path Correct answer.
- log_model cannot accept a signature
- log_model only works with pyfunc, while save_model works with all flavors
- save_model automatically registers the model
Explanation
log_model persists the model into the tracking server artifact store associated with a run, whereas save_model writes the model to a filesystem path you specify. Both support signatures and multiple flavors.
Question 16Model Development
A model must expose a custom preprocessing step and also be deployable through Databricks Model Serving. Which logging choice keeps the model servable while supporting custom logic?
- Log with mlflow.pyfunc.log_model using a PythonModel that wraps preprocessing and prediction Correct answer.
- Register the training notebook as the model
- Save only the raw pickle to DBFS
- Log metrics without a model artifact
Explanation
A pyfunc PythonModel can encapsulate preprocessing and prediction logic while remaining a standard MLflow model that Model Serving can deploy. Raw pickles and notebooks are not servable model formats.
Question 17Model Development
Which metric would mlflow.evaluate report for a regression model to quantify average squared deviation?
- mean_squared_error Correct answer.
- silhouette_score
- f1_score
- ROC AUC
Explanation
For regressor model types, MLflow reports regression metrics including mean squared error. ROC AUC and F1 are classification metrics, and silhouette is a clustering metric.
Question 18Model Development
A practitioner wants to compare multiple runs and identify the one with the lowest validation loss. Which MLflow UI or API feature supports this directly?
- The runs table with metric sorting and filtering in the experiment view Correct answer.
- The conda environment viewer
- The artifact browser only
- The model signature editor
Explanation
The experiment runs table allows sorting and filtering by metrics, making it straightforward to rank runs by validation loss. Other views focus on artifacts or metadata rather than comparative metric ranking.
Question 19Model Development
A team notices that a registered model version's metrics in the Registry differ from the latest run's metrics after retraining. What is the most likely cause?
- The Registry version points to an earlier run than the latest training run Correct answer.
- The signature was updated
- Metrics are randomly reassigned on each load
- The Registry recomputes metrics independently of runs
Explanation
Each model version is linked to the run that produced it, so its metrics reflect that run. If retraining produced a new run but the version was not updated, the displayed metrics lag behind.
Question 20Model Development
Which practice best mitigates overfitting when tuning a gradient boosted tree model during experimentation tracked in MLflow?
- Removing all regularization parameters
- Maximizing training accuracy alone
- Evaluating on a held-out validation set and monitoring the gap between training and validation metrics Correct answer.
- Increasing tree depth without limit
Explanation
Tracking both training and validation metrics reveals generalization gaps, and selecting on held-out data reduces overfitting. Maximizing training fit or removing regularization increases overfitting risk.
Question 21Model Development
A data scientist needs to log a custom metric computed outside of any library autolog during an active run. Which call accomplishes this?
- mlflow.log_artifact("custom_score")
- mlflow.log_param("custom_score", value)
- mlflow.log_metric("custom_score", value) Correct answer.
- mlflow.set_tag("custom_score", value)
Explanation
log_metric records numeric time-series values that can be charted and compared across runs. Tags and params store metadata strings, and log_artifact expects a file path.
Question 22Model Development
When registering a model in Unity Catalog, which privilege is required on the schema to create a new model?
- SELECT on a Delta table
- CREATE MODEL on the schema Correct answer.
- EXECUTE on a function
- USE SCHEMA only
Explanation
Creating a registered model in Unity Catalog requires the CREATE MODEL privilege on the target schema, in addition to usage rights on parent objects. USE SCHEMA alone permits navigation but not model creation.
Question 23Model Development
A team wants to serve a model with a low-latency REST endpoint and enable automatic scaling based on traffic within Databricks. Which feature provides this?
- A scheduled notebook job
- Databricks Model Serving endpoints with scale-to-zero and concurrency configuration Correct answer.
- A SQL warehouse
- A Delta Live Tables pipeline
Explanation
Model Serving endpoints expose REST APIs and support scaling behavior including scale-to-zero and concurrency settings for latency-sensitive workloads. Jobs, pipelines, and warehouses are not model inference endpoints.
Question 24Model Development
Which statement accurately characterizes how MLflow handles model flavors when a model is logged with multiple flavors?
- Flavors are mutually exclusive and cause logging to fail
- Only the first flavor logged is retained
- The MLmodel file records each flavor and its loader, allowing loading through any supported flavor Correct answer.
- Flavors are stored only in the run tags
Explanation
A logged model can carry several flavors, each described in the MLmodel metadata with its own loader, so consumers can load via the most convenient supported flavor. This enables interoperability across tools.
Question 25Model Development
A practitioner wants to detect data drift for a deployed model by comparing incoming inference payloads to the training distribution. Which MLflow-related capability supports this analysis?
- Changing the model alias
- Increasing the model version number
- Deleting old runs
- Logging an input example and signature, then using Lakehouse Monitoring on inference tables Correct answer.
Explanation
An input example and signature establish the baseline schema and distribution, and Lakehouse Monitoring can profile inference tables against it to detect drift. Version bumps, alias changes, and run deletion do not perform drift analysis.
Question 26Model Development
A data scientist trains a scikit-learn pipeline and wants MLflow to capture the estimator's parameters and default evaluation metrics without writing explicit logging calls. Which single call enables this behavior for the training code that follows?
- mlflow.register_model()
- mlflow.set_tracking_uri()
- mlflow.start_run()
- mlflow.sklearn.autolog() Correct answer.
Explanation
Autologging is enabled per flavor by calling the flavor-specific autolog function before training; for scikit-learn that is mlflow.sklearn.autolog(), which instruments fit calls and records params, metrics, and the model artifact automatically. The other calls manage runs, tracking location, or registry promotion and do not instrument estimators.
Question 27Model Development
A practitioner calls mlflow.log_artifact("confusion.png") inside an active run. Where does the file end up relative to the run's artifact location?
- In a subdirectory named after the file's parent folder
- In the root of the run's artifact directory Correct answer.
- In the run's metrics store as a binary value
- In the model registry alongside the run
Explanation
log_artifact copies a local file into the run's artifact URI; when no artifact_path argument is supplied the file lands at the root of that run's artifact directory. Supplying artifact_path would place it in a named subdirectory instead.
Question 28Model Development
A team wants each MLflow run to record the git commit hash and source notebook path so results can be traced back to code. Which built-in mechanism provides this with no custom code?
- A manually logged JSON file containing the commit hash
- The experiment description field
- The run's metric history keyed by step number
- MLflow run tags populated automatically from the source context Correct answer.
Explanation
MLflow automatically captures source information such as the git commit, repository URL, and source file path as run tags when a run starts from a tracked project or notebook context. These tags require no manual logging and are visible in the run detail page.
Question 29Model Development
During a run, a data scientist calls mlflow.log_metric("auc", 0.91) and later in the same run calls mlflow.log_metric("auc", 0.93). What does MLflow record for the run's auc metric?
- Only the first value, ignoring the second call
- An error, because a metric key may be logged once per run
- The average of the two values
- Both values as a history, with the latest value shown as the current metric Correct answer.
Explanation
MLflow metrics are time-series; repeated logging of the same key appends to the metric history, and the most recent value becomes the displayed current value. This is how step-wise training curves are captured.
Question 30Model Development
Which MLflow concept groups related runs so their metrics can be compared side by side in the experiment UI?
- Registered model
- Model version
- Experiment Correct answer.
- Run tag
Explanation
An experiment is the container that groups runs; the experiment page lets you compare runs and their metrics in a table and chart view. Registered models and versions belong to the model registry rather than experiment comparison.
Question 31Model Development
A data scientist wants to log a pandas DataFrame as a Delta table so it can be queried later with SQL. Which MLflow dataset logging approach fits?
- mlflow.log_artifact on the DataFrame's pickle file
- mlflow.log_metric on the row count
- mlflow.log_input with a Delta table dataset and its context Correct answer.
- mlflow.set_tag with the table name
Explanation
mlflow.log_input records dataset metadata and lineage for a run, and Delta tables are a supported dataset source, enabling later tracking of which data produced a model. Logging a pickle or a tag loses queryable lineage and schema information.
Question 32Model Development
A practitioner wants to register a logged model into Unity Catalog from a notebook. Which function performs the registration using a three-level name such as catalog.schema.model?
- mlflow.log_model
- mlflow.evaluate
- mlflow.register_model Correct answer.
- mlflow.create_experiment
Explanation
mlflow.register_model takes a model URI and a target name; when the name is a three-level Unity Catalog path, the model is created or a new version is added under that catalog and schema. The other functions handle evaluation, logging, and experiment creation.
Question 33Model Development
A team needs a logged model to carry a human-readable description and a custom key-value annotation that can be searched later. Which pair of MLflow calls accomplishes this on the run?
- mlflow.set_tag for the annotation and the run's note field for the description Correct answer.
- mlflow.set_experiment for both values
- mlflow.log_artifact for both values
- mlflow.log_metric for both values
Explanation
Run tags are searchable key-value pairs, and the run note holds free-text description; both are visible in the run detail view. Metrics and artifacts are not searchable annotations, and set_experiment selects the experiment container.
Question 34Model Development
A model is logged with mlflow.sklearn.log_model and the signature is inferred from a training DataFrame. What does the signature primarily enable at serving time?
- Validation of incoming column names and types against the training schema Correct answer.
- Selection of the best flavor among several
- Automatic retraining when input distribution shifts
- Compression of the model artifact for faster loading
Explanation
A model signature records input and output schema, so serving and scoring can validate that requests match the expected columns and types. It does not retrain, compress, or choose flavors.
Question 35Model Development
A practitioner wants to log a model whose predict method requires a custom Python class wrapper, and the model must later be loaded with mlflow.pyfunc.load_model. Which logging approach satisfies this?
- Log the raw class with mlflow.log_artifact and load it manually
- Log the class source with mlflow.set_tag
- Log only the model weights with mlflow.log_dict
- Subclass mlflow.pyfunc.PythonModel and log it with mlflow.pyfunc.log_model Correct answer.
Explanation
A custom pyfunc model is created by subclassing PythonModel and implementing predict, then logging with mlflow.pyfunc.log_model so it can be loaded through the pyfunc flavor. Artifacts, dicts, and tags do not produce a loadable pyfunc model.
Question 36Model Development
A team needs to compare several runs of the same experiment and programmatically retrieve the run with the best F1 score. Which API returns runs sorted by a metric so the top run can be selected?
- mlflow.get_artifact_uri
- mlflow.list_experiments
- mlflow.search_runs with order_by on the metric column Correct answer.
- mlflow.get_run on the experiment ID
Explanation
mlflow.search_runs queries runs across experiments and supports filter_string and order_by, so ordering by metrics.f1 descending returns the best run first. get_run needs a specific run ID, and the other calls do not search or sort runs by metric.
Question 37Model Development
A data scientist logs a model with a signature and then registers it. Later, a request arrives with an extra unexpected column. What is the signature's role in this scenario?
- It allows schema enforcement so the extra column can be rejected or flagged before scoring Correct answer.
- It converts the extra column to a string and proceeds
- It retrains the model to accept the new column
- It automatically drops any column not present at training time
Explanation
The signature captures the expected input schema, enabling enforcement that detects mismatched columns; enforcement behavior depends on configuration but the signature is what makes detection possible. It does not silently transform, retrain, or coerce columns.
Question 38Model Development
A practitioner wants to evaluate a logged regression model on a held-out Spark DataFrame and get RMSE plus SHAP-based feature importance in one call. Which MLflow function produces this?
- mlflow.score_model
- mlflow.evaluate Correct answer.
- mlflow.log_metrics
- mlflow.predict
Explanation
mlflow.evaluate accepts a model URI, data, and model_type such as regressor, then computes default metrics including RMSE and can produce feature importance artifacts like SHAP. The other functions log or predict but do not run a full evaluation suite.
Question 39Model Development
A team wants to promote a model version by moving a Unity Catalog alias named champion to a new version. Which action accomplishes this without changing the model name used by consumers?
- Delete the old version so the alias falls through
- Create a second registered model with the same name
- Rename the registered model to the new version number
- Set the champion alias on the new version, which moves the alias from the old version Correct answer.
Explanation
A Unity Catalog alias is a mutable pointer to a single model version; setting the alias on a new version moves it, and consumers referencing catalog.schema.model@champion pick up the change. Renaming, deleting, or duplicating models breaks the stable reference.
Question 40Model Development
A data scientist needs to log hyperparameters generated by a tuning loop where keys are created dynamically. Which call records them as searchable run parameters?
- mlflow.log_metric with the dictionary
- mlflow.log_param called once with the whole dictionary
- mlflow.log_text with the dictionary
- mlflow.log_params with a dictionary of key-value pairs Correct answer.
Explanation
mlflow.log_params accepts a dictionary and logs each entry as a separate searchable parameter. log_param takes a single key and value, and metrics or text logging do not create searchable parameter entries.
Question 41Model Development
A practitioner wants to log a model so that both the native sklearn flavor and the generic pyfunc flavor are available for loading. What does MLflow do when the model is logged with mlflow.sklearn.log_model?
- It stores only the sklearn flavor with no pyfunc support
- It stores the sklearn flavor plus a pyfunc wrapper so either flavor can load the model Correct answer.
- It stores only the pyfunc flavor
- It stores a TensorFlow SavedModel alongside sklearn
Explanation
Logging with a library flavor typically persists that native flavor and also adds a pyfunc flavor that wraps it, so consumers can load natively or generically. Only the native flavor alone would limit deployment options.
Question 42Model Development
A team wants to track which Delta table version was used to train each model version. Which MLflow feature records this lineage automatically when the dataset is logged as input?
- Dataset tracking through mlflow.log_input with a Delta table source Correct answer.
- The model signature's output schema
- Run tags containing the table name only
- The experiment's artifact location
Explanation
Logging a Delta table as a run input records dataset metadata including the table version and schema, creating lineage between data and model. A plain tag or signature does not capture the table version.
Question 43Model Development
A data scientist wants to run a nested hyperparameter sweep where each trial is its own MLflow run under a parent run. Which API structure supports parent-child run relationships?
- Log all trials as metrics in a single run
- Start a parent run and start nested runs with nested=True inside it Correct answer.
- Create a separate experiment for each trial
- Use run tags to simulate parent-child links
Explanation
mlflow.start_run(nested=True) creates child runs whose parent_run_id points at the enclosing run, so trials are grouped under one parent. A single run or separate experiments lose the explicit parent-child hierarchy.
Question 44Model Development
A practitioner logs a model with mlflow.pyfunc.log_model and supplies a requirements list. Why is this important for later serving?
- It encrypts the model artifact at rest
- It lets the serving environment recreate the Python dependencies needed to load and run the model Correct answer.
- It compiles the model into a native binary
- It selects the model registry stage automatically
Explanation
The logged requirements capture the Python packages and versions the model needs, so a serving or scoring environment can rebuild a compatible environment. It does not encrypt, stage, or compile the model.
Question 45Model Development
A team wants to capture a sample of model inputs and predictions for monitoring after deployment. Which MLflow capability records this during evaluation?
- The model signature input schema
- Run tags containing accuracy only
- The experiment's description field
- Model evaluation with a saved evaluation dataset and output artifacts Correct answer.
Explanation
mlflow.evaluate can persist evaluation outputs, including per-row predictions and input data, as artifacts that support later monitoring and drift analysis. Tags, signatures, and descriptions do not store per-row inputs and predictions.
Question 46Model Development
A data scientist needs to load a specific model version from Unity Catalog by version number rather than by alias. Which URI form should be used?
- catalog.schema.model#3
- models:/catalog.schema.model/3 Correct answer.
- models:/catalog.schema.model@champion
- runs:/catalog.schema.model/3
Explanation
Unity Catalog model URIs use models:/ with a three-level name and a version number after a slash, or an alias after @. The runs:/ scheme refers to a run artifact path, and the hash form is not a valid model URI.
Question 47Model Development
A team notices that a model logged with autologging recorded a metric named training_score that is not comparable across runs because a custom scorer was swapped mid-experiment. What is the best remediation for future comparisons?
- Rename the metric after the fact in the UI
- Log a consistently named custom metric with an explicit scorer and record the scorer configuration as a tag Correct answer.
- Delete runs that used the old scorer
- Ignore the metric and compare only run duration
Explanation
Comparable experiments require a stable metric definition, so logging an explicitly named metric with a fixed scorer and tagging the scorer configuration preserves interpretability. Deleting runs, renaming metrics, or comparing duration does not fix metric definition drift.
Question 48Model Development
A practitioner wants to detect whether a newly trained model's predictions are systematically shifted relative to the currently served version using logged evaluation outputs. Which analysis is most appropriate?
- Compare the two models' training run durations
- Compare the distribution of predicted values between the two model versions on the same evaluation dataset Correct answer.
- Compare the number of artifacts logged by each run
- Compare the registered model descriptions
Explanation
Holding the evaluation dataset fixed and comparing prediction distributions isolates model behavior differences such as systematic shift. Run duration, artifact counts, and descriptions carry no information about prediction behavior.
Question 49Model Development
A team logs models with signatures inferred from a pandas DataFrame where an integer column contains nulls. Why might inference produce an unexpected signature type, and what is the robust fix?
- Nulls are silently dropped, so re-add them after logging
- Inference ignores pandas dtypes entirely, so no fix is needed
- Nulls convert the column to a string, so cast after loading
- Nulls can force a type promotion such as long to double, so provide an explicit schema in the signature Correct answer.
Explanation
Signature inference maps pandas dtypes to MLflow types, and nullable integer columns can be promoted to a floating type to represent missing values. Supplying an explicit Schema avoids ambiguous inference and keeps serving validation predictable.
Question 50Model Development
A data scientist wants a custom pyfunc model to load a scikit-learn artifact and a lookup table at inference time. Which mechanism should be used inside the PythonModel to access both?
- Hardcode absolute local paths in predict
- Store them as run tags and parse them in predict
- Embed the lookup table in the model signature
- Declare them in the context artifacts map and load them in load_context Correct answer.
Explanation
PythonModel.load_context receives a context whose artifacts dictionary maps declared artifact names to resolved paths, which works across environments. Hardcoded paths break on serving nodes, and tags or signatures cannot carry loadable artifacts.