<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLParameterKey",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:objc(cs)MLParameterKey"
  },
  "title" : "MLParameterKey"
}
-->

# MLParameterKey

The keys for the parameter dictionary in a model configuration or a model update context.

```
class MLParameterKey
```

## Overview

Use an [`MLParameterKey`](/documentation/CoreML/MLParameterKey) to retrieve a model’s parameter value using:

- The model’s [`parameterValue(for:)`](/documentation/CoreML/MLModel/parameterValue(for:)) method
- The [`parameters`](/documentation/CoreML/MLModelConfiguration/parameters) dictionary of an [`MLModelConfiguration`](/documentation/CoreML/MLModelConfiguration)
- The [`parameters`](/documentation/CoreML/MLUpdateContext/parameters) dictionary of an [`MLUpdateContext`](/documentation/CoreML/MLUpdateContext)

> Note:
> To access the parameter of a specific model within a pipeline model, use the parameter key’s ``doc://com.apple.coreml/documentation/CoreML/MLParameterKey/scoped(to:)`` method with the model’s name.

### Overriding model and layer parameters

To override a model’s default parameter values:

1. Create an [`MLModelConfiguration`](/documentation/CoreML/MLModelConfiguration) instance.
2. Use an [`MLParameterKey`](/documentation/CoreML/MLParameterKey) for each parameter to set its value in the model configuration’s [`parameters`](/documentation/CoreML/MLModelConfiguration/parameters) dictionary.
3. Create a new model instance using [`init(contentsOf:configuration:)`](/documentation/CoreML/MLModel/init(contentsOf:configuration:)) with your custom model configuration.

### Configuring update parameters

To configure the update parameters for an [`MLUpdateTask`](/documentation/CoreML/MLUpdateTask):

1. Create an [`MLModelConfiguration`](/documentation/CoreML/MLModelConfiguration) instance.
2. Use an [`MLParameterKey`](/documentation/CoreML/MLParameterKey) for each parameter to set its value in the model configuration’s [`parameters`](/documentation/CoreML/MLModelConfiguration/parameters) dictionary.
3. Create a new update task with your custom model configuration.

See [Personalizing a Model with On-Device Updates](/documentation/CoreML/personalizing-a-model-with-on-device-updates).

## Topics

### Scoping parameter keys

[`scoped(to:)`](/documentation/CoreML/MLParameterKey/scoped(to:))

Creates a copy of a parameter key and adds the scope to it.

### Accessing model parameters

[`numberOfNeighbors`](/documentation/CoreML/MLParameterKey/numberOfNeighbors)

The key you use to access the number of neighbors that adjusts the affinity of a k-nearest-neighbor model.

[`linkedModelFileName`](/documentation/CoreML/MLParameterKey/linkedModelFileName)

The key you use to access the linked model’s filename.

[`linkedModelSearchPath`](/documentation/CoreML/MLParameterKey/linkedModelSearchPath)

The key you use to access the linked model’s search path.

### Accessing neural network layer parameters

[`weights`](/documentation/CoreML/MLParameterKey/weights)

The key you use to access the weights of a layer in a neural network model.

[`biases`](/documentation/CoreML/MLParameterKey/biases)

The key you use to access the biases of a layer in a neural network model.

### Accessing model update parameters

[`learningRate`](/documentation/CoreML/MLParameterKey/learningRate)

The key you use to access the optimizer’s learning rate parameter.

[`momentum`](/documentation/CoreML/MLParameterKey/momentum)

The key you use to access the stochastic gradient descent (SGD) optimizer’s momentum parameter.

[`miniBatchSize`](/documentation/CoreML/MLParameterKey/miniBatchSize)

The key you use to access the optimizer’s mini batch-size parameter.

[`beta1`](/documentation/CoreML/MLParameterKey/beta1)

The key you use to access the Adam optimizer’s first beta parameter.

[`beta2`](/documentation/CoreML/MLParameterKey/beta2)

The key you use to access the Adam optimizer’s second beta parameter.

[`eps`](/documentation/CoreML/MLParameterKey/eps)

The key you use to access the Adam optimizer’s epsilon parameter.

[`epochs`](/documentation/CoreML/MLParameterKey/epochs)

The key you use to access the optimizer’s epochs parameter.

[`shuffle`](/documentation/CoreML/MLParameterKey/shuffle)

The key you use to access the shuffle parameter, a Boolean value that determines whether the model randomizes the data between epochs.

[`seed`](/documentation/CoreML/MLParameterKey/seed)

The key you use to access the seed parameter that initializes the random number generator for the shuffle option.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)