<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLFeatureProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:objc(pl)MLFeatureProvider"
  },
  "title" : "MLFeatureProvider"
}
-->

# MLFeatureProvider

An interface that represents a collection of values for either a model’s input or its output.

```
protocol MLFeatureProvider
```

## Overview

Use `MLFeatureProvider` to customize the way your app gets data to and from your model when the model’s dynamically generated interface doesn’t meet your app’s needs.

Consider adopting this protocol in your data source if any of the following apply:

- Your data is collected asynchronously.
- Using the autogenerated interface leads to copying excessive amounts of data.
- Your data source is otherwise complicated.

The interface is mainly an accessor for [`MLFeatureValue`](/documentation/CoreML/MLFeatureValue) instances, making it straightforward to implement. Adopting this protocol allows you to integrate your data directly with [`MLModel`](/documentation/CoreML/MLModel), which means the model can query your data sources without constructing a separate input instance.

To customize your app’s interaction with a model:

1. Adopt the `MLFeatureProvider` protocol in a class or structure so that the model can query it for input feature values via [`featureValue(for:)`](/documentation/CoreML/MLFeatureProvider/featureValue(for:)).
2. Pass your app’s `MLFeatureProvider` to your `MLModel` with [`prediction(from:)`](/documentation/CoreML/MLModel/prediction(from:)-9y2aa) or [`prediction(from:options:)`](/documentation/CoreML/MLModel/prediction(from:options:)-81mr6).
3. Use the `MLFeatureProvider` returned from a `prediction(from:)` method to get the output feature values for that prediction.

## Topics

### Accessing values

[`featureValue(for:)`](/documentation/CoreML/MLFeatureProvider/featureValue(for:))

Accesses the feature value given the feature’s name.

[`featureNames`](/documentation/CoreML/MLFeatureProvider/featureNames)

The set of valid feature names.



---

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)