Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Core ML model

From ReverseEngineering.wiki
Format
Developer Apple
Extensions .mlmodel, .mlmodelc (folder), .mlpackage (folder)
License BSD-3-Clause (coremltools specification)
On this wiki Facts · Code · Notes · Topics

Apple's Core ML model: a .mlmodel file is a Protocol Buffers Model message (specificationVersion, description, one model-type oneof); Xcode compiles it into a .mlmodelc folder shipped in apps.

Layout

The public specification is mlmodel/format/Model.proto in apple/coremltools. message Model has specificationVersion = 1 (int32), description = 2 (ModelDescription: inputs, outputs), isUpdatable = 10, and a oneof Type: pipelineClassifier 200, pipelineRegressor 201, pipeline 202, regressors from 300 (glmRegressor 300, supportVectorRegressor 301, treeEnsembleRegressor 302, neuralNetworkRegressor 303...), classifiers from 400, and so on. So a .mlmodel file begins with 08 and the specification version, and is decoded with the Format:Protocol Buffers wire format and this .proto.

Compiled form

Core ML on-disk forms: (1) .mlmodel, a single protobuf Model message. (2) .mlpackage, a directory documented by the model package code in coremltools (modelpackage/src/ModelPackage.cpp, a207b1a): a Manifest.json at the package root with the keys fileFormatVersion (the writer emits "1.0.0"), itemInfoEntries (a map from identifier to an entry with path, name, author, description) and rootModelIdentifier (which entry is the model); the items live under a Data/ directory, normally the model spec and a weights folder for ML Program weights. (3) .mlmodelc, the compiled folder that Xcode/coremlc produces and apps ship. Unverified: the contents of .mlmodelc (model.mil, coremldata.bin, weights/weight.bin, analytics/) are known from inspecting builds and are not defined in the coremltools source read; check a real .ipa (Format:IPA). Weight blobs in ML Programs are not protobuf: the blob format is implemented in coremltools' MIL storage code (Unverified: starts with a small header and per-blob sentinel, read mlmodel/src/MILBlob before parsing).

See Technique:Identifying machine-learning models in applications. Related: Format:ONNX model, Format:Protocol Buffers wire format.

Specification versions

Model.proto (coremltools a207b1a, comment above message Model, lines 255-336) maps the monotonically increasing specificationVersion to OS releases: 1 iOS 11 / macOS 10.13 (Core ML 1), 2 iOS 11.2, 3 iOS 12 (Core ML 2), 4 iOS 13 (Core ML 3), 5 iOS 14 (Core ML 4), 6 iOS 15 (Core ML 5), 7 iOS 16 (Core ML 6), 8 iOS 17 (Core ML 7), 9 iOS 18 (Core ML 8), 10 iOS 26 (Core ML 9). So the first field of a .mlmodel (08 NN) gives the minimum OS that can run it. Unverified: newer specification versions (7 and later) carry the ML Program model type (mlProgram) instead of the older layer-list neural network types; look in the Type oneof of Model.proto for the field numbers.

Code & repositories

  • https://github.com/apple/coremltools @ a207b1a3452eafe02f2d870f486287834af2c82d · license: BSD-3-Clause (read from LICENSE.txt; GitHub's API was busy)
    coremltools; mlmodel/format/Model.proto is the .mlmodel spec
    Tested on: source read, not run: read source · checked 2026-10-18