New Features

The following sections describe new features and improvements in the most recent versions of Core ML Tools.

New in Core ML Tools 7

The coremltools 7 package now includes more APIs for optimizing the models to use less storage space, reduce power consumption, and reduce latency during inference. Key optimization techniques include pruning, quantization, and palettization.

You can either directly compress a Core ML model, or compress a model in the source framework during training and then convert. While the former is quicker and can happen without needing data, the latter can preserve accuracy better by fine-tuning with data. For details, see Optimizing Models.

For a full list of changes, see Release Notes. For installation instructions, see Installing Core ML Tools.

Core ML Tools 6

The coremltools 6 package offers the following features to optimize the model conversion process:

For a full list of changes from coremltools 5.2, see Release Notes.

Model Compression Utilities

Version 6 provides utilities to compress the weights of a Core ML model in the ML program format. These are now superseded by version 7 (see Optimizing Models).

Float 16 Input/output Types Including Image

Starting in iOS 16 and macOS 13, you can use OneComponent16Half Grayscale images and float 16 MLMultiarrays for model inputs and outputs. You can also specify an ImageType for input and for output.

The new float 16 types help eliminate extra casts at inputs and outputs for models that execute in float 16 precision.

You can create a model that accepts float 16 inputs and outputs by specifying a new color layout for images or a new data type for MLMultiarrays while invoking the coremltools convert() method.

The following examples show how you can specify the inputs and outputs arguments with convert() to be float 16, including GRAYSCALE_FLOAT16 images:

import cormeltools as ct 

# float 16 input and output of type multiarray
mlmodel = ct.convert(
    inputs=[ct.TensorType(shape=input.shape, dtype=np.float16)],

# float 16 input and output of type grayscale images
mlmodel = ct.convert(

This feature is available only if the minimum_deployment_target is specified as iOS16.

Core ML Tools 5

The coremltools 5.2 package offers several performance improvements over previous versions, including the following features:

  • ML program: A new model type that represents neural network computation as programmatic instructions, offers more control over the precision of its intermediate tensors and better performance.
  • Core ML model package: A new model container format that separates the model into components and offers more flexible metadata editing and better source control.

For a full list of changes from coremltools 4.1, see Release Notes.

Using ML Programs

As machine learning (ML) models evolve in sophistication and complexity, their representations are also evolving to describe how they work. ML programs are neural networks expressed as operations in code. For more information, see ML Programs

Saving a Core ML Model Package

Core ML models have been represented in the file system in the .mlmodel binary file format, which encodes and stores the implementation details and complexities of the model. You would add an .mlmodel file to an Xcode project, and write code that works with it.

The Core ML model package uses the macOS package facility as a container that stores each of a model’s components in its own file, separating out the model's metadata from its architecture and weights (for ML Programs).


By saving the model as a package, you can edit its metadata and input-output descriptions, and track changes with source control. Similar to useful comments in code, useful metadata and descriptions help others understand the model’s intent and use cases.

Core ML and Xcode still fully support the original .mlmodel format, but you can save a model package for all of the model types that the original .mlmodel format supports.

To learn how to update a .mlmodel file to a .mlpackage file with Xcode 13, see Updating a Model File to a Model Package. Updating an mlmodel to an ML Package does not alter the underlying Core ML model type or the model behavior.

Another way to save an ML Package is to update the save method that you use in your coremltools scripts.

# coremltools 5"my_model.mlpackage")

# coremltools 4"my_model.mlmodel")