# Accelerate CLIP indexing with Core AI Keystone can run the CLIP ViT-L/14 image encoder through Core AI on an Apple Silicon Mac with macOS 27 or newer. It uses the same 768-dimensional embedding space as Keystone's default `fp32` ONNX encoders. Your existing Find Anything index and text encoder can be used with the new image vectors. ## Export the image encoder From a Keystone checkout with `uv` installed, run the exporter once. Allow several gigabytes for the pinned OpenAI checkpoint, the ONNX reference and the new model package. ```sh uv run scripts/export_coreai_clip.py /path/to/image_encoder.aimodel ``` If you already have Keystone's `onnx/vision_model.onnx`, pass it with `--onnx-model` to skip downloading another copy. The exporter checks the source hashes and accepts the export only if the GPU-generated vectors pass a cosine similarity check against Keystone's pinned ONNX encoder. The `.aimodel` is a directory and must be kept together. ## Enable it For a Python installation, install Keystone with the `coreai` extra in its environment, for example `uv pip install '.[coreai]'` from the checkout. For Homebrew, install the Core AI runtime in a separate environment and set `embeddings.coreai_python` to that environment's Python executable. This survives Homebrew upgrades. ```sh uv venv --python 3.13 "$HOME/.local/share/keystone-coreai" uv pip install --python "$HOME/.local/share/keystone-coreai/bin/python" 'coreai-core==1.0.0' ``` Use absolute paths in `config.yaml`. Include `coreai_python` when the runtime is installed separately. ```yaml acceleration: provider: auto embeddings: quantization: fp32 coreai_vision_model: /path/to/image_encoder.aimodel # coreai_python: /path/to/keystone-coreai/bin/python ``` Restart Keystone and look for `CoreAI` under `clip:vision` in `/api/status`. The vision worker requests GPU preference, and Core AI chooses the compute units. CLIP text uses the existing ONNX path. Keystone keeps the ONNX files available and switches to CPU if the Core AI worker fails to load, exits or fails during inference. You can clear `coreai_vision_model` or add `clip:vision` to `acceleration.cpu_models` to disable Core AI for this model. The first call includes Core AI setup. Run the [inference benchmark](macos-inference-benchmark.md) with your image sizes and caption workload to see how they perform together on your Mac. ## Measured performance On an M5 Max with macOS 27.2.1, the table compares median latency across 25 warm calls in each mode. These times include JPEG preprocessing, inference and normalization through the Keystone embedder. The CPU encoder used four threads. | JPEGs per call | ONNX CPU | Core AI | Speedup | | ---: | ---: | ---: | ---: | | 1 | 99.87 ms | 10.74 ms | 9.3× | | 2 | 186.81 ms | 16.85 ms | 11.1× | | 4 | 374.25 ms | 29.81 ms | 12.6× | On three synthetic JPEGs, Core AI and ONNX image vectors had minimum cosine similarity above 0.99999. Five queries encoded with the existing ONNX text encoder kept the same top-ranked image after switching the image encoder. Protect request timing and thumbnail downloads also affect total backfill duration.