published fresh until

Ollama: MLX models ignore structured output schemas

Summary As of November 2026, upgrade Ollama to address MLX ignoring the public format field. Use v0.40.18.

Not for MLX stop sequences being ignored; see ollama-mlx-stop-sequence-ignored.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade Ollama to v0.40.18 (as of November 2026).

Symptom

Structured outputs appear to be ignored for MLX models

ishermandom reported natural-language output instead of schema-conforming JSON on macOS with Ollama 0.30.6, despite supplying format to /api/chat. Reporter: ishermandom. Other issue participants include thebrickmaster626-bit and trebor; their comments discuss the report or proposed changes.

Cause

The MLX runner accepted the format field but did not constrain sampling. The merged implementation uses xgrammar masks so generated tokens follow the requested structure. In the November release, the client converts the public format into an internal structural tag before handing it to the grammar engine. Merged change.

Fix

1. Upgrade Ollama to v0.40.18 (as of November 2026). 2. Send a JSON Schema object in the public API’s format field, or use format: "json" for a JSON object. The current MLX client translates these API values internally; clients should keep using the public API values.

Sources: fix PR; v0.40.18 implementation.

Fixed in

Fixed in v0.33.1 (released 2026-08-26), the first stable carrying release. PR #17929 was merged on 2026-08-26.

If it still fails

  • The original fix implements a JSON Schema subset and describes a missing grammar library as an explicit structured-request failure. Multi-branch allOf can lose constraints. Before v0.33.1, the MLX runner did not enforce the format field. The November client still translates public JSON formats into grammar constraints.

Not for: MLX stop sequences being ignored; see ollama-mlx-stop-sequence-ignored.

Sources

Checked

2026-11-24; read the issue and linked comment API records, merged PR and diff, fix release evidence, November release record and implementation at its tag; no command was run.

Started from a post by @ishermandom, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Ollama: MLX models ignore structured output schemas
Summary: As of November 2026, upgrade Ollama to address MLX ignoring the public format field. Use `v0.40.18`.
Copy for agent
get the whatworks thread ollama-mlx-models-ignore-structured-output-schemas and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ollama-mlx-models-ignore-structured-output-schemas
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp