[PR #15530] MLX: add repeatable model porting workflow #46438

Open
opened 2026-04-25 01:52:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15530
Author: @dhiltgen
Created: 4/13/2026
Status: 🔄 Open

Base: mainHead: mlx-model-tools


📝 Commits (1)

  • 32d04e6 MLX: add repeatable model porting workflow

📊 Changes

26 files changed (+6336 additions, -3 deletions)

View changed files

📝 integration/README.md (+34 -3)
x/cmd/ppl/README.md (+61 -0)
x/cmd/ppl/ppl.go (+496 -0)
x/cmd/ppl/ppl_test.go (+133 -0)
📝 x/mlxrunner/mlx/ops_extra.go (+7 -0)
x/models/AGENTS.md (+72 -0)
x/models/PORTING_GUIDE.md (+449 -0)
x/models/gemma4/forward_test.go (+213 -0)
x/models/gemma4/longseq_test.go (+183 -0)
x/models/gemma4/perplexity_test.go (+75 -0)
x/models/gemma4/tokenizer_test.go (+113 -0)
x/models/qwen3_5/forward_test.go (+127 -0)
x/models/scripts/README.md (+89 -0)
x/models/scripts/compare_activations.py (+302 -0)
x/models/scripts/dump_activations.py (+487 -0)
x/models/scripts/inspect_model.py (+422 -0)
x/models/scripts/summarize_validation.py (+276 -0)
x/models/scripts/test_compare_activations.py (+92 -0)
x/models/scripts/test_inspect_model.py (+105 -0)
x/models/scripts/test_summarize_validation.py (+127 -0)

...and 6 more files

📄 Description

Note: This will stay in draft for a while since the MLX engine is still evolving while we flesh the capabilities out. We're not quite ready for a large influx of new model coverage. As the APIs stabilize we can take this out of draft and start porting more models over.

Add a reference-driven workflow for bringing Hugging Face / transformers model architectures up on Ollama's MLX runner.

This includes repo-local porting guidance for humans and coding agents, PyTorch activation dumping with sidecar manifests, model inspection and validation-report scripts, Go test utilities for layer and per-position comparison, and an end-to-end perplexity CLI with cache and baseline comparison support.

The change also adds Gemma 4 and Qwen 3.5 validation fixtures that exercise the workflow.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15530 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 4/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `mlx-model-tools` --- ### 📝 Commits (1) - [`32d04e6`](https://github.com/ollama/ollama/commit/32d04e65f0cd390f0941397418ead7851d64be6a) MLX: add repeatable model porting workflow ### 📊 Changes **26 files changed** (+6336 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `integration/README.md` (+34 -3) ➕ `x/cmd/ppl/README.md` (+61 -0) ➕ `x/cmd/ppl/ppl.go` (+496 -0) ➕ `x/cmd/ppl/ppl_test.go` (+133 -0) 📝 `x/mlxrunner/mlx/ops_extra.go` (+7 -0) ➕ `x/models/AGENTS.md` (+72 -0) ➕ `x/models/PORTING_GUIDE.md` (+449 -0) ➕ `x/models/gemma4/forward_test.go` (+213 -0) ➕ `x/models/gemma4/longseq_test.go` (+183 -0) ➕ `x/models/gemma4/perplexity_test.go` (+75 -0) ➕ `x/models/gemma4/tokenizer_test.go` (+113 -0) ➕ `x/models/qwen3_5/forward_test.go` (+127 -0) ➕ `x/models/scripts/README.md` (+89 -0) ➕ `x/models/scripts/compare_activations.py` (+302 -0) ➕ `x/models/scripts/dump_activations.py` (+487 -0) ➕ `x/models/scripts/inspect_model.py` (+422 -0) ➕ `x/models/scripts/summarize_validation.py` (+276 -0) ➕ `x/models/scripts/test_compare_activations.py` (+92 -0) ➕ `x/models/scripts/test_inspect_model.py` (+105 -0) ➕ `x/models/scripts/test_summarize_validation.py` (+127 -0) _...and 6 more files_ </details> ### 📄 Description Note: This will stay in draft for a while since the MLX engine is still evolving while we flesh the capabilities out. We're not quite ready for a large influx of new model coverage. As the APIs stabilize we can take this out of draft and start porting more models over. Add a reference-driven workflow for bringing Hugging Face / transformers model architectures up on Ollama's MLX runner. This includes repo-local porting guidance for humans and coding agents, PyTorch activation dumping with sidecar manifests, model inspection and validation-report scripts, Go test utilities for layer and per-position comparison, and an end-to-end perplexity CLI with cache and baseline comparison support. The change also adds Gemma 4 and Qwen 3.5 validation fixtures that exercise the workflow. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 01:52:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46438