<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/AIModelCache",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core AI"
    ],
    "preciseIdentifier" : "s:15CoreAIDelegates12AIModelCacheC"
  },
  "title" : "AIModelCache"
}
-->

# AIModelCache

A cache that stores the specialized model artifacts for inference.

```
final class AIModelCache
```

## Overview

The cache holds the optimized, device-specific artifacts that [`AIModel`](/documentation/CoreAI/AIModel)
loads to execute its inference functions. Each cache entry contains a specialized
asset formed from a specific `.aimodel` or `.aimodelc` and [`SpecializationOptions`](/documentation/CoreAI/SpecializationOptions) combination.

## Topics

### Accessing the default cache

[`default`](/documentation/CoreAI/AIModelCache/default)

The shared cache scoped to your app bundle.

### Creating a shared cache

[`init(appGroup:)`](/documentation/CoreAI/AIModelCache/init(appGroup:))

Creates a cache that shares specialized assets across an app group.

### Loading a specialized model

[`model(for:options:)`](/documentation/CoreAI/AIModelCache/model(for:options:))

Returns a previously specialized model from the cache, if available.

### Deleting cache entries

[`deleteEntry(for:options:)`](/documentation/CoreAI/AIModelCache/deleteEntry(for:options:))

Deletes the cache entry for a specific model and specialization options combination.

[`deleteEntries(for:)`](/documentation/CoreAI/AIModelCache/deleteEntries(for:))

Deletes all cache entries for a specific model, regardless of specialization options.

[`deleteAll()`](/documentation/CoreAI/AIModelCache/deleteAll())

Deletes all entries in the cache.

[`deleteEntry(referencedBy:)`](/documentation/CoreAI/AIModelCache/deleteEntry(referencedBy:))

Deletes a cache entry referenced by bookmark data.

### Controlling cache persistence

[`AIModelCache.Policy`](/documentation/CoreAI/AIModelCache/Policy)

A policy that controls when the system purges specialized assets from a cache.



---

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)