---
title: Create custom models
description: How to create and assemble a custom model in the model workshop.
section_name: NextGen Registry
maturity: open-public-preview

---

# Create custom models {: #create-custom-models }

Custom models are user-created, pretrained models that you can upload to DataRobot (as a collection of files) via the **Model workshop**. You can assemble custom models in either of the following ways:

* Create a custom model _without_ the environment requirements and a `start_server.sh` file on the **Assemble** tab. This type of custom model **must** use a drop-in environment. Drop-in environments contain the requirements and `start_server.sh` file used by the model. They are [provided by DataRobot](#drop-in-environments) in the workshop.

* Create a custom model _with_ the environment requirements and a `start_server.sh` file on the **Assemble** tab. This type of custom model can be paired with a [custom](custom-environments#create-a-custom-environment){ target=_blank } or [drop-in](#drop-in-environments) environment.

Be sure to review the guidelines for [assembling a custom model](custom-model-assembly/index){ target=_blank } before proceeding. If any files overlap between the custom model and the environment folders, the model's files will take priority.

!!! note "Testing custom models"
     Once a custom model's file contents are assembled, you can [test the contents locally](custom-local-test){ target=_blank } for development purposes before uploading it to DataRobot. After you create a custom model in the model workshop, you can run a [testing suite](nxt-test-custom-model) from the **Test** tab.

## Create a new custom model {: #create-a-new-custom-model }

To create a custom model in preparation for [assembly](#assemble-the-custom-model): 

1. Click **Registry > Model workshop**. This tab lists the models you have created:

    ![](images/nxt-model-workshop-tab.png)

2. Click **+ Add model** (or the <span style="color:#297cb9">:material-plus-box:{.lg}</span> button when the custom model panel is open):

    ![](images/nxt-model-workshop-add-button.png)

3. On the **Add a model** page, enter the fields under **Configure the model**:

    ![](images/nxt-model-workshop-configure.png)

    | Field | Description |
    |-------|-------------|
    | Model name  | A descriptive name for the custom model. |
    | Target type | The type of prediction the model makes. Depending on the prediction type, you must configure additional settings:<ul><li>[**Binary**](glossary/index#classification){ target=_blank }: For a binary classification model, enter the **Positive class label** and the **Negative class label**.</li><li>[**Regression**](glossary/index#regression){ target=_blank }: No additional settings.</li><li>[**Multiclass**](glossary/index#multiclass){ target=_blank }: For a multiclass classification model, enter or upload (`.csv`, `.txt`) the **Target classes** for your target, one class per line. To ensure that the classes are applied correctly to your model's predictions, enter classes in the same order as your model's predicted class probabilities.</li><li>[**Text Generation**](generative-model-monitoring){ target=_blank }: *Premium feature*. No additional settings.</li><li>[**Anomaly Detection**](#anomaly-detection): No additional settings.</li><li>[**Unstructured**](unstructured-custom-models){ target=_blank }: No additional settings. Unstructured models do not need to conform to a specific input/output schema and may use a different request format. Prediction drift, accuracy tracking, challengers, and humility are disabled for deployments with a "Unstructured" target type. Service health, deployment activity, and governance remain available.</li></ul> |
    | Target name | The dataset's column name that the model will predict on. This field isn't available for multiclass or anomaly detection models. |
    | **Advanced configuration** | :~~: |
    | Language    | The programming language used to build the model. |
    | Description | A description of the model's contents and purpose.|

    ??? "Anomaly Detection target type"
        You can create custom models that support <span id="anomaly-detection">anomaly detection</span> problems. If you choose to build one, reference the [DRUM template](https://github.com/datarobot/datarobot-user-models/tree/master/model_templates/python3_sklearn_anomaly){ target=_blank }. ({% include 'includes/github-sign-in.md' %}) When deploying custom anomaly detection models, note that the following functionality is not supported:

        * Data drift
        * Accuracy and association IDs
        * Challenger models
        * Humility rules
        * Prediction intervals

4. After completing the fields, click **Add model**.

    The custom model opens to the **Assemble** tab.

## Assemble the custom model {: #assemble-the-custom-model }

After you [create a custom model](#create-a-new-custom-model), you can provide the required environment, dependencies, and files:

1. In the model you want to assemble, on the **Assemble** tab, navigate to the **Environment** section and select a model environment from the **Base Environment** dropdown menu.

    ![](images/nxt-model-workshop-environment.png)

    !!! note "Model environments"
        The model environment is used for [testing](nxt-test-custom-model){ target=_blank } and deploying the custom model. The **Base Environment** drop-down list includes [drop-in model environments](#drop-in-environments) and any [custom environments](custom-environments#create-a-custom-environment){ target=_blank } that you can create.

2. To populate the **Dependencies** section, you can upload a `requirements.txt` file in the **Files** section, allowing DataRobot to build the optimal image.

3. In the **Files** section, add the required custom model files. If you aren't pairing the model with a [drop-in environment](#drop-in-environments), this includes the custom model environment requirements and a `start_server.sh` file:

    ![](images/nxt-model-workshop-files.png)

    * Drag files into the **Files** box.
    
    * Click **Choose from source** to browse for **Local Files** or a **Local Folder**.
    
    * Click **Upload** to browse for **Local Files** or a **Local Folder** or to connect to a [remote repository](custom-model-repos){ target=_blank }.

    !!! important "Model file location"
        If you add files from a **Local Folder**, make sure the model file is already at the root of the custom model. Uploaded folders are for dependent files and additional assets required by your model, not the model itself. Even if the model file is included in the folder, it will not be accessible to DataRobot unless the file exists at the root level. The root file can then point to the dependencies in the folder.

If you incorrectly add one or more files or folders to the **Assemble** tab, in the **Files** section, you can click the delete (:fontawesome-solid-trash-can:{.lg}) icon next to each file or folder to remove it from the custom model.

![](images/nxt-model-workshop-files-delete.png)

### Drop-in environments {: #drop-in-environments }

DataRobot provides drop-in environments in the model workshop, defining the required libraries and providing a `start_server.sh` file. The following table details the drop-in environments provided by DataRobot and links to the template in the DRUM repository. Each environment is prefaced with **[DataRobot]** in the **Environment** section of the **Model workshop**'s **Assemble** tab.

| Environment name & example | Model compatibility & artifact file extension |
|----------------------------|-----------------------------------------------|
| [Python 3 ONNX Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_onnx){ target=_blank } | ONNX models (`.onnx`) |
| [Python 3 PMML Drop-In ](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_pmml){ target=_blank } | PMML models (`.pmml`) |
| [Python 3 PyTorch Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_pytorch){ target=_blank } | PyTorch models (`.pth`) |
| [Python 3 Scikit-Learn Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_sklearn){ target=_blank } | Scikit-Learn models (`.pkl`) |
| [Python 3 XGBoost Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_xgboost){ target=_blank } | Native XGBoost models (`.pkl`) |
| [Python 3 Keras Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/python3_keras){ target=_blank } | Keras models backed by tensorflow (`.h5`) |
| [Java Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/java_codegen){ target=_blank } | DataRobot Scoring Code models (`.jar`) |
| [R Drop-in Environment](https://github.com/datarobot/datarobot-user-models/blob/master/public_dropin_environments/r_lang){ target=_blank } | R models trained using CARET (`.rds`) <br> Due to the time required to install all libraries recommended by CARET, only model types that are also package names are installed (e.g., `brnn`, `glmnet`). Make a copy of this environment and modify the Dockerfile to install the additional, required packages. To decrease build times when you customize this environment, you can also remove unnecessary lines in the `# Install caret models` section, installing only what you need. Review the [CARET documentation](http://topepo.github.io/caret/available-models.html){ target=_blank } to check if your model's method matches its package name. ({% include 'includes/github-sign-in.md' %}) |
| [Julia Drop-In](https://github.com/datarobot/datarobot-user-models/blob/master/example_dropin_environments/julia_mlj){ target=_blank }<em>*</em> | Julia models (`.jlso`) <br> <em>* The Julia drop-in environment isn't officially supported; it is provided as an example.</em> |

!!! note
     All Python environments contain Scikit-Learn to help with preprocessing (if necessary), but only Scikit-Learn can make predictions on sklearn models.

## Define connected deployments {: #define-connected-deployments }

!!! info "Availability information"
    Connected deployments are off by default. Contact your DataRobot representative or administrator for information on enabling this feature.

    <b>Feature flags:</b> Enable Connecting Deployments

Connected deployments report predictions and statistics to a central text generation model deployment. To use connected deployments, first, create and deploy audit models to make predictions on an LLM's prompts or outputs; for example, an audit model could identify prompt injection or toxic responses. Then, when you create a custom model with the **Text Generation** target type, define one or more connected deployments to generate predictions and report them to the central model. The connected deployment predictions can be combined into the prediction output of the central, text generation model deployment.  

To define connected deployments, upload or create a `model-metadata.yaml` file with one or more `deployment`-type runtime parameters. If you click **Create > Create model-metadata.yaml** the template includes an example:

``` yaml
runtimeParameterDefinitions:
- fieldName: DEPLOYMENT_PARAMETER
    type: deployment
    description: An example of a deployment parameter (for various purposes, such as connected deployments)
    defaultValue: null
```

In the example above replace `null` with the deployment ID of the deployment you want to connect, or, after saving the `model-metadata.yaml` file, click the **Edit** icon (:material-pencil:{.lg}) to enter the deployment ID:

![](images/nxt-connected-deploy-model-workshop.png)

To use connected deployments, ensure that the custom model has the **Text Generation** target type. The target type can be defined in the `model-metadata.yaml` file as follows:

``` yaml
targetType: textgeneration
```

After you assemble and register a custom model, you can view the connected deployments in the [registered model version's **Related Items** section](nxt-view-manage-reg-models#view-version-info):

![](images/nxt-connected-deployment-related-item.png)

## Manage runtime parameters {: #manage-runtime-parameters }

If you defined any runtime parameters, through `runtimeParameterDefinitions` in the `model-metadata.yaml` file, you can manage them in the **Runtime Parameters** section:

![](images/nxt-model-workshop-manage-runtime-params.png)

| Icon                                 | Setting          | Description |
|--------------------------------------|------------------|-------------|
| :material-pencil:{.lg}               | Edit             | Open the **Edit a Key** dialog box to edit the runtime parameter's **Value**. |
| :fontawesome-solid-rotate-left:{.lg} | Reset to default | Reset the runtime parameter's Value to the `defaultValue` set in the  `model-metadata.yaml` file. |

## Assign custom model datasets {: #assign-custom-model-datasets }

To enable feature drift tracking for a model deployment, you must add training data. To do this, assign training data to a model version. The method for providing training and holdout datasets for [_unstructured_ custom inference models](unstructured-custom-models){ target=_blank } requires you to upload the training and holdout datasets separately. Additionally, these datasets cannot include a partition column.

!!! warning "File size warning"
    When adding training data to a custom model, the training data can be subject to a [frozen run](frozen-run){ target=_blank } to conserve RAM and CPU resources, limiting the file size of the training dataset to 1.5GB.

To assign training data to a custom model after you [define the **Environment** and **Files**](#assemble-the-custom-model):

1. On the **Assemble** tab, in the **Settings** section, under **Datasets**: 
    
    * If the model version _doesn't_ have training data assigned, click **Assign**.

        ![](images/nxt-model-workshop-datasets.png)
    
    * If the model version _does_ have training data assigned, click (:material-pencil:{.lg}) **Change**, and then, under **Training Data**, click the delete (:fontawesome-solid-trash-can:{.lg}) icon to remove the existing training data.

        ![](images/nxt-model-workshop-datasets-change.png)

2. In the **Training Data** section, click **+ Select dataset** and do either of the following:

    ![](images/nxt-model-workshop-select-dataset.png)

    * To add a new dataset to the **Data Registry**, click **Upload**, select a file from your local storage, and then click **Open**.

    * To select an existing dataset from the Data Registry, in the **Data Registry** list, locate and click the training dataset you previously uploaded to DataRobot, and then click **Select dataset**.

    !!! important "Include features required for scoring"
        The columns in a custom model's training data indicate which features are included in scoring requests to the deployed custom model. Therefore, once training data is available, any features not included in the training dataset aren't sent to the model. This requirement does not apply to predictions made while [testing a custom model](nxt-test-custom-model){ target=_blank }.

3. _Optional_. In the **Partition column** section, specify the column name (from the provided training dataset) containing partitioning information for your data (based on training/validation/holdout partitioning). If you plan to deploy the custom model and monitor its [data drift](data-drift){ target=_blank } and [accuracy](deploy-accuracy){ target=_blank }, specify the holdout partition in the column to establish an accuracy baseline.

    ![](images/nxt-model-workshop-datasets-partition.png)

    !!! important "Specify partition column"
        You can track data drift and accuracy without specifying a partition column; however, in that scenario, DataRobot won't have baseline values. The selected partition column should only include the values `T`, `V`, or `H`.

4. Click **Assign**.

    ??? note "Training data assignment error"
        If the training data assignment fails, an error message appears in the new custom model version under **Datasets**. While this error is active, you can't create a model package to deploy the affected version. To resolve the error and deploy the model package, reassign training data to create a new version, or create a new version and _then_ assign training data.

## Configure custom model resource settings {: #configure-custom-model-resource-settings }

After creating a custom inference model, you can configure the resources the model consumes to facilitate smooth deployment and minimize potential environment errors in production.

To configure the resource allocation and access settings:

1. On the **Assemble** tab, in the **Settings** section, next to **Resources**, click (:material-pencil:{.lg}) **Edit**:

    ![](images/nxt-model-workshop-resources-edit.png)    

2. In the **Update resource settings** dialog box, configure the following settings:

    ![](images/nxt-model-workshop-resources.png)

    !!! important "Resource settings access"
        Users can determine the maximum memory allocated for a model, but only [organization admins](manage-users#set-admin-permissions-for-users){ target=_blank } can configure additional resource settings.

	| Setting        | Description |
	|----------------|--------------|
	| Memory         | Determines the maximum amount of memory that can be allocated for a custom inference model. If a model is allocated more than the configured maximum memory value, it is evicted by the system. If this occurs during testing, the test is marked as a failure. If this occurs when the model is deployed, the model is automatically launched again by Kubernetes. |
	| Replicas       | Sets the number of replicas executed in parallel to balance workloads when a custom model is running. Increasing the number of replicas may not result in better performance, depending on the custom model's speed.
	| Network access | _Premium feature_. Configures the egress traffic of the custom model: <ul><li>**Public**: The default setting. The custom model can access any fully qualified domain name (FQDN) in a public network to leverage third-party services.</li><li>**None**: The custom model is isolated from the public network and cannot access third-party services.</li></ul> For more information, see [Premium feature: Network access](#public-network-access).|
	
	??? warning "Imbalanced memory settings"
		DataRobot recommends configuring resource settings only when necessary. When you configure the **Memory** setting below, you set the Kubernetes memory "limit" (the maximum allowed memory allocation); however, you can't set the memory "request" (the minimum guaranteed memory allocation). For this reason, it is possible to set the "limit" value too far above the default "request" value. An imbalance between the memory "request" and the memory usage allowed by the increased "limit" can result in the custom model exceeding the memory consumption limit. As a result, you may experience unstable custom model execution due to frequent eviction and relaunching of the custom model. If you require an increased **Memory** setting, you can mitigate this issue by increasing the "request" at the Organization level; for more information, contact DataRobot Support.

    ??? important "Premium feature: Network access"
        Every _new_ custom model you create has <span id="public-network-access">public network access</span> by default; however, when you create new versions of any custom model created before October 2023, those new versions remain isolated from public networks (access set to **None**) until you enable public access for a new version (access set to **Public**). From this point on, each subsequent version inherits the public access definition from the previous version.

3. Once you have configured the resource settings for the custom model, click **Save**. 

	This creates a new version of the custom model with edited resource settings applied.

	!!! important "Frozen versions"
		You can only update resource settings in the most recent model version. Additionally, if the most recent model version was registered or deployed, you cannot apply the updated resource settings, and you'll encounter a "frozen version" warning if you try to save the changes. If you encounter this warning, create a new custom model version, update the resource settings, and then register and deploy the model with the correct settings.