Bring model definitions into Go.

Extract supported model definitions into an inspectable representation, check their structure, and generate Go implementations. ModelIR connects model source and configuration to the MLX-Go toolchain.

Experimental. Source is private, available for technical review on request.

ModelIR keeps model structure separate from the runtime that executes it. Inspect the definition, compare a changed version, and generate the supported implementation for the chosen target.

modelir from-config config.json
modelir fmt model.modelir
modelir diff before.modelir after.modelir

Example commands from a source build. Support depends on the source patterns and chosen target.

A model port needs more than a matching list of layers. Weight paths, precision choices, normalization stages, and state carried between tokens affect execution. ModelIR makes these facts explicit so a target can preserve them or report what it cannot support.

Recent work strengthens source freshness, checkpoint checks, and cache continuity in selected conformance fixtures. Host checks describe the tested fixtures; numerical and hardware qualification remain specific to the model, target, and revision.

Read the build note: what a generated model needs to preserve ↗

mlx-go supplies the array runtime. mlx-go-lm uses ModelIR in its model-generation pipeline and provides loading, inference, serving, and fine-tuning.