One request.
One embedding.
The pipeline prepares each item, runs the models it needs, and assembles their output in request order.
Prepare the inputs
Tokenize text, prepare image patches, and extract audio features. Video can contribute frames and an audio track.
Long audio and video
Audio longer than 30 seconds is chunked. Video files are decoded with ffmpeg, with frame sampling controlled by the request.
Choose functions
The pipeline picks model functions that fit the prepared inputs. Images use the requested token budget; audio and backbone tiers are chosen to fit the request.
Keeping models warm
A bounded cache reuses loaded functions. Low-memory mode keeps one function loaded at a time.
Encode media
Vision and audio run independently. Their padded output rows are trimmed to valid tokens.
Bring the sequence together
The pipeline collects media vectors in request order and sends them with token IDs and the attention mask to the backbone.
Run it
Use the Python pipeline with text and media inputs, or run the verifier against the PyTorch reference.
# 1. Run an embedding request
uv run python -m pipeline --text "A description"
# 2. Verify end-to-end Core ML parity against PyTorch
uv run python -m pipeline.verify_pipelineA Swift equivalent for pipeline preprocessing and model calls is planned. If you can’t find it in my repositories or profiles, feel free to ask me about it. I may have already built it and just haven’t found the time to publish it.
Three-model footprint
How the three Core ML models compare in the measured configuration.
| Model | Parameters | Compiled size (FP16) |
|---|---|---|
| Shared backbone | 271M | 521 MB |
| Vision encoder | 168M | 329 MB |
| Audio encoder | 306M | 561 MB |
| Total | 744M | 1.41 GB |