---
title: AIModel
framework: coreai
role: symbol
role_heading: Structure
path: coreai/aimodel
---

# AIModel

A specialized model for running inference on a device.

## Declaration

```swift
struct AIModel
```

## Mentioned in

Managing model specialization and caching Compiling Core AI models ahead of time Integrating on-device AI models in your app with Core AI

## Overview

Overview An AIModel represents a specialized .aimodel asset, optimized for the current device’s hardware. You create one by loading the asset from disk: let model = try await AIModel(contentsOf: modelURL) Use functionDescriptor(for:) to inspect a function’s inputs and outputs, then load an InferenceFunction to run inference. note: The model instance is lightweight and doesn’t own weights or intermediate buffers. Those resources belong to the functions you load from it.

## Topics

### Creating a model

- [init(contentsOf:options:)](coreai/aimodel/init(contentsof:options:).md)
- [init(resolvingBookmark:)](coreai/aimodel/init(resolvingbookmark:).md)

### Loading inference functions

- [loadFunction(named:)](coreai/aimodel/loadfunction(named:).md)
- [functionDescriptor(for:)](coreai/aimodel/functiondescriptor(for:).md)
- [functionNames](coreai/aimodel/functionnames.md)

### Specializing a model

- [specialize(contentsOf:options:cache:cachePolicy:)](coreai/aimodel/specialize(contentsof:options:cache:cachepolicy:).md)

### Instance Properties

- [bookmarkData](coreai/aimodel/bookmarkdata.md)

### Type Properties

- [deviceArchitectureName](coreai/aimodel/devicearchitecturename.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Essentials

- [Integrating on-device AI models in your app with Core AI](coreai/integrating-on-device-ai-models-in-your-app-with-core-ai.md)
- [AIModelAsset](coreai/aimodelasset.md)
