Core ML llama export ignores enable_state and preserve_sdpa
@metascroy is already working on this.
Since Sep 10, 2026.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
Summary
Two Core ML options in the llama export config are parsed, stored, and then read by nothing:
backend.coreml.enable_state
backend.coreml.preserve_sdpa
The command line accepts --coreml-enable-state and --coreml-preserve-sdpa, LlmConfig holds
both, and from_args assigns both. No exporter ever reads them, so setting either has no effect.
This is not theoretical. The Core ML config shipped in this repository for lfm2 sets both to true:
enable_state: True
preserve_sdpa: True
So that config exports without stateful Core ML models and without the preserved SDPA op, silently,
and has presumably been doing so since the options were added.
Why it surfaced now
Until recently a Core ML llama export could not run at all: the branch selecting the Core ML lowering
read a backend field that no longer existed and raised AttributeError first. With that fixed, this
path executes for the first time, which is what makes the dropped options observable.
What to decide
Either wire both options into the Core ML lowering, or remove them from the parser and the config so
nobody sets something that does nothing. Leaving a shipped config setting them to true while they are
ignored is the worst of the three.
cc @kimishpatel @YifanShenSZ @cymbalrush @metascroy @larryliu0820 @mergennachin @cccclai @helunwencser @jackzhxng @digantdesai
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.