Back to directory

MLX Structured

A Swift library for constraining large-language-model output to a schema, regular expression or custom grammar during generation on Apple's MLX framework, built on the XGrammar constrained-decoding library.

MLX Structured

MLX Structured is a Swift library for structured output generation using constrained decoding, built on top of the XGrammar library. A grammar can be defined from a JSON Schema, a Swift Generable type on newer OS versions, a regular expression, an EBNF rule, or a composable grammar builder that combines fixed text, schemas and regular expressions into one format.

The defined grammar is passed as an extra argument to MLX's text-generation calls, so output is constrained token by token as it streams, for example to force a tool-calling format. The library installs as a Swift package dependency and targets projects that already use MLX for on-device language-model inference.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.