What you will be able to do
- Create a serving endpoint for a Unity Catalog model through the Serving UI, the REST API or the MLflow Deployments SDK
- Explain how the endpoint's recorded creator governs its access to Unity Catalog
- Choose the workload type, concurrency and scale-to-zero settings for a custom model endpoint
- Query an endpoint with the REST API or the MLflow Deployments SDK, using the right authentication and input format
1.Three ways to create the same endpoint
Deploying a custom model follows a fixed path. You log the model in MLflow format, register it (Unity Catalog is recommended), create a serving endpoint, and then query it. Model Serving offers three ways to create the endpoint: the Serving UI, the REST API and the MLflow Deployments SDK. The Databricks Workspace Client SDK is also documented. All of them produce the same thing: an endpoint whose served entity points at a model version.
Checkpoint 1 of 7· Put it in order
Put the steps for deploying a custom model in order
- 1.Register the logged model in Unity Catalog
- 2.Create a model serving endpoint for the registered model version
- 3.Query the endpoint
- 4.Log the model or code in MLflow format, with a built-in flavor or pyfunc
Databricks defines this sequence: log, register, then create the endpoint, which you can then query.
“After the model is logged, register it in the Unity Catalog (recommended) or the workspace registry.”Source: docs.databricks.com
Serving UI. Click Serving in the sidebar, then Create serving endpoint. Name the endpoint; names can't start with the reserved databricks- prefix. Under Served entities, choose *My models - Unity Catalog* and pick the model and version. Then set the traffic percentage, the compute size and whether the endpoint scales to zero. You can add more served entities to split traffic between models or versions. When you click Create, the endpoint first shows as *Not Ready* while it builds.
REST API. Send a POST to /api/2.0/serving-endpoints. For a Unity Catalog model, entity_name must be the full three-level name.
POST /api/2.0/serving-endpoints
{
"name": "uc-model-endpoint",
"config":
{
"served_entities": [
{
"name": "ads-entity",
"entity_name": "catalog.schema.my-ads-model",
"entity_version": "3",
"min_provisioned_concurrency": 4,
"max_provisioned_concurrency": 12,
"scale_to_zero_enabled": false
}
]
}
}MLflow Deployments SDK. Get a client with get_deploy_client("databricks") after calling mlflow.set_registry_uri("databricks-uc"). Its create, update and delete methods take the same parameters as the REST API, so the config dictionary matches the JSON body above. To roll out a new version, call update_endpoint_config with new served_entities and a traffic_config.
endpoint = client.create_endpoint(
name="unity-catalog-model-endpoint",
config={
"served_entities": [
{
"name": "ads-entity",
"entity_name": "catalog.schema.my-ads-model",
"entity_version": "3",
"min_provisioned_concurrency": 4,
"max_provisioned_concurrency": 12,
"scale_to_zero_enabled": False
}
]
}
)The MLflow Deployments create, update and delete APIs accept the same parameters as the REST API for serving endpoints. Learn the shape of the served_entities fields once and it applies to both.
Sources1
2.The recorded creator and Unity Catalog grants
When an endpoint is created, Databricks records the calling identity as its creator. This is typically a service principal. The endpoint uses that identity for all Unity Catalog access, and it can't be changed later. The caller and the recorded creator must both be workspace members with the workspace-access entitlement.
For a Unity Catalog model, the recorded creator needs USE CATALOG on the catalog, USE SCHEMA on the schema and EXECUTE on the model. These grants are checked when the endpoint is created or updated, and a missing grant fails the request with PERMISSION_DENIED. If the model declares transitive function dependencies, the creator also needs EXECUTE on those functions. Some grants are needed only at query time. Those are not checked in advance, so a missing one shows up as a runtime error.
Every configuration update checks the recorded creator again. If the creator has left the workspace, updates fail even when the caller has valid permissions. The only fix is to delete the endpoint and recreate it under a current service principal that holds the grants.
Checkpoint 2 of 7· Check yourself
An endpoint's recorded creator was removed from the workspace. An admin with full permissions tries to update the served model version. What happens?
Updates check the recorded creator, not just the caller. The creator can't be changed, so the endpoint has to be recreated.
“Updates fail with PERMISSION_DENIED if the recorded creator is no longer a workspace member, even when the caller has valid permissions.”Source: docs.databricks.com
Checkpoint 3 of 7· Exam question
A custom pyfunc model needs a fitted tokenizer file that was saved separately from the model object during training. The team wants the tokenizer loaded once when the serving container starts, not on every scoring request. Which pattern accomplishes this?
Correct answer: A — Pass the tokenizer file path in the `artifacts` dictionary at log time, then load it from `context.artifacts` inside `load_context`, caching it on `self`.
- A. Artifacts declared at log time are copied alongside the model, and `load_context` runs exactly once when the model is loaded into the serving container, making it the correct place to load and cache the tokenizer for reuse across requests.
- B. `load_context` runs whenever the model is loaded, including inside the deployed serving container, so reloading the tokenizer on every request is unnecessary overhead and misunderstands when the hook fires.
- C. Embedding a fitted tokenizer's binary state as literal source code is impractical and not how MLflow expects trained artifacts to be packaged with a pyfunc model.
- D. Reading a fresh copy from an environment-variable path on every request repeats the same unnecessary disk I/O per call and does not use the artifact-tracking mechanism MLflow provides for this purpose.
Sources1
3.Compute, concurrency and how the endpoint behaves
Size a served entity by concurrency, the number of requests it can handle in parallel. Databricks gives the estimate *QPS × model execution time*. Custom min_provisioned_concurrency and max_provisioned_concurrency values must be multiples of 4. Endpoints scale up almost immediately when traffic rises and scale down every five minutes. Scale to zero takes an idle endpoint to zero after 30 minutes. The next request then hits a cold start, usually 10–20 seconds and sometimes minutes, with no SLA. Databricks therefore doesn't recommend scale to zero for production. For CPU workloads that need more memory, choose a larger workload type instead of a GPU.
| workload_type | Hardware | Memory |
|---|---|---|
| CPU | CPU | 4GB per concurrency |
| CPU_MEDIUM | CPU | 8GB per concurrency |
| CPU_LARGE | CPU | 16GB per concurrency |
| GPU_SMALL | 1xT4 | 16GB per concurrency |
| GPU_MEDIUM | 1xA10G | 24GB per concurrency |
Three more behaviours matter for a custom model. First, updates have no downtime: the old configuration keeps serving until the new one is ready, and you're billed for both during the switch. Second, a request times out if model computation takes longer than 597 seconds. Third, during maintenance Databricks reloads models. If a reload fails, the existing configuration keeps serving, so your load_context must be able to run again at any time.
Checkpoint 4 of 7· Check yourself
A model averages 0.5 s per prediction and must handle 40 QPS. Which min_provisioned_concurrency is a valid starting point?
40 × 0.5 = 20, which is also a multiple of 4. 10 has the wrong magnitude and isn't a multiple of 4.
“provisioned concurrency = queries per second (QPS) * model execution time (s)”Source: docs.databricks.com
4.Querying the endpoint
A REST or SDK call needs a Databricks API token. For production, Databricks recommends machine-to-machine OAuth tokens. For testing and development, it recommends a personal access token that belongs to a service principal rather than to a workspace user. The SDK route needs MLflow 2.9 or above. Endpoints with route optimization are different: they accept only OAuth tokens and use a dedicated URL, so the flow below doesn't apply to them.
| Method | How |
|---|---|
| Serving UI | Query endpoint on the endpoint page; paste JSON and send. Show Example loads a logged input example |
| REST API | POST /serving-endpoints/{name}/invocations |
| MLflow Deployments SDK | client.predict(endpoint=..., inputs=...) |
| SQL function | ai_query |
client = mlflow.deployments.get_deploy_client("databricks")
response = client.predict(
endpoint="test-model-endpoint",
inputs={"dataframe_split": {
"index": [0, 1],
"columns": ["sepal length (cm)", "sepal width (cm)", "petal length (cm)", "petal width (cm)"],
"data": [[5.1, 3.5, 1.4, 0.2], [4.9, 3.0, 1.4, 0.2]]
}
}
)Custom models accept a JSON-serialized pandas DataFrame or tensor input. dataframe_split is the recommended DataFrame key. dataframe_records also works, but it doesn't guarantee column order. Tensor models use instances (row format, where every tensor has the same 0th dimension) or inputs (columnar format). Whatever the input format, the model's output comes back as JSON under a predictions key:
{
"predictions": [0, 1, 1, 1, 0]
}Checkpoint 5 of 7· Match them up
Match each request key to what it describes
Tap a term, then the definition that fits it.
Use dataframe_split for DataFrame input because records orientation can reorder columns. For tensors, instances is row-based and inputs is columnar.
“This format does not guarantee the preservation of column ordering, and the split format is preferred over the records format.”Source: docs.databricks.com
Checkpoint 6 of 7· Check yourself
A scheduled production job queries a custom model endpoint with a data scientist's personal access token. What does Databricks recommend instead?
For production, Databricks recommends M2M OAuth. Service-principal PATs are recommended only for testing and development.
“Databricks recommends that you use machine-to-machine OAuth tokens for authentication during production.”Source: docs.databricks.com
Checkpoint 7 of 7· Exam question
During `mlflow.pyfunc.log_model()`, a data scientist wants to bundle a JSON-formatted feature-scaling config file with the model so the packaged model directory can be inspected or reused independently of the code that produced it. Which parameter should hold this file?
Correct answer: A — The `artifacts` parameter, mapping a logical name to the config file's local path so MLflow copies the file into the model directory.
- A. The `artifacts` dictionary maps a name to a local file or directory path, and MLflow copies it into the packaged model so it travels with the model and is retrievable through `context.artifacts` at inference time.
- B. `pip_requirements` only accepts pip-installable package specifiers, not arbitrary file paths, so a JSON config file placed there would not be copied or resolved correctly.
- C. The `signature` parameter describes the shape and types of model inputs and outputs; it has no mechanism for embedding an unrelated configuration file's contents.
- D. `registered_model_name` is a plain string identifying where the model is registered; appending a file path to it does not attach or copy any file into the model package.
Sources3
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.If an endpoint's creator loses access, an admin can update the endpoint and take over as its owner.Why is that wrong?
The recorded creator can't be changed. If it lacks grants or has left the workspace, you must delete the endpoint and recreate it under a current service principal.
2.dataframe_records and dataframe_split are interchangeable for any model.Why is that wrong?
Records orientation doesn't guarantee column order, so split is the recommended format.
Covered in Querying the endpoint
3.Turning on scale to zero is a free cost saving for production endpoints.Why is that wrong?
Capacity isn't guaranteed at zero, and the first request pays for a cold start, so Databricks doesn't recommend it for production.
Covered in Compute, concurrency and how the endpoint behaves
Practise it for real
Deploy a registered Unity Catalog custom model with the MLflow Deployments SDK and score it
1.Call mlflow.set_registry_uri("databricks-uc") and create a client with get_deploy_client("databricks")
Why: The SDK resolves the served entity against the Unity Catalog registry
You should see: A deployment client object with no errors
2.Call client.create_endpoint with a served_entities entry whose entity_name is your catalog.schema.model and whose entity_version is your version. Leave scale_to_zero_enabled as False
Why: Unity Catalog models must be referenced by their full three-level name
You should see: The endpoint appears on the Serving page as Not Ready while the container builds, which can take about 10 minutes
3.Wait until the endpoint state is READY with config_update NOT_UPDATING
Why: Requests can only be scored once the served entity reaches DEPLOYMENT_READY
You should see: The served entity state shows DEPLOYMENT_READY
4.Call client.predict(endpoint=..., inputs={"dataframe_split": {...}}) using your model's signature columns
Why: dataframe_split is the recommended format and preserves column order
You should see: A JSON response whose output is under the predictions key
Stuck? Get a nudge
If creation fails with PERMISSION_DENIED, check that the identity calling create has USE CATALOG, USE SCHEMA and EXECUTE on the model.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/machine-learning/model-serving/create-manage-serving-endpointsOfficial docs
“The APIs for these tasks accept the same parameters as the REST API for serving endpoints.”
↩︎ Three ways to create the same endpoint“Endpoint names cannot use the databricks- prefix.”
↩︎ Three ways to create the same endpoint“The Serving endpoints page appears with Serving endpoint state shown as Not Ready.”
↩︎ Three ways to create the same endpoint“USE CATALOG on the catalog, USE SCHEMA on the schema, EXECUTE on the model”
↩︎ The recorded creator and Unity Catalog grants“is used to access Unity Catalog resources on behalf of the endpoint and cannot be changed after creation”
↩︎ The recorded creator and Unity Catalog grants“Concurrency values must be multiples of 4.”
↩︎ Compute, concurrency and how the endpoint behaves“you must delete the endpoint and recreate it under a service principal that has the required permissions and is a current workspace member.”
↩︎ Exam trap 1“Scale to zero is not recommended for production endpoints, as capacity is not guaranteed when scaled to zero.”
↩︎ Exam trap 3“Updates fail with PERMISSION_DENIED if the recorded creator is no longer a workspace member, even when the caller has valid permissions.”
↩︎ Checkpoint - 2.
“Scale to zero is an optional feature for endpoints that allows them to scale down to zero after 30 minutes of inactivity.”
↩︎ Compute, concurrency and how the endpoint behaves“Make sure your customized models are robust and are able to reload at any time.”
↩︎ Compute, concurrency and how the endpoint behaves“After the model is logged, register it in the Unity Catalog (recommended) or the workspace registry.”
↩︎ Checkpoint“provisioned concurrency = queries per second (QPS) * model execution time (s)”
↩︎ Checkpoint - 3.https://docs.databricks.com/aws/en/machine-learning/model-serving/score-custom-model-endpointsOfficial docs
“The response from the endpoint contains the output from your model, serialized with JSON, wrapped in a predictions key.”
↩︎ Querying the endpoint“For testing and development, Databricks recommends using a personal access token belonging to service principals instead of workspace users.”
↩︎ Querying the endpoint“For the MLflow Deployment SDK, MLflow 2.9 or above is required.”
↩︎ Querying the endpoint“This format does not guarantee the preservation of column ordering, and the split format is preferred over the records format.”
↩︎ Exam trap 2“This format does not guarantee the preservation of column ordering, and the split format is preferred over the records format.”
↩︎ Checkpoint“Databricks recommends that you use machine-to-machine OAuth tokens for authentication during production.”
↩︎ Checkpoint