mlx-optiq
OptiQ Lab

OptiQ Lab

A local web UI for everything you'd do with a model on your laptop: chat with it, compare two side by side, browse and load quants, quantize a new one, fine-tune a LoRA adapter, and build a dataset. One command boots the UI and an OpenAI-compatible API server together.

Install + launch

shellbash
pip install mlx-optiq
optiq lab            # UI on :7860, API on :8080

First launch asks you to set a password (single user, Argon2-hashed, JWT session). The Lab binds to 127.0.0.1. To use it from another machine, reach it through an SSH tunnel or a VPN.

What's inside

  • Chat: streaming playground with local tools, self-healing tool calls, chat-with-files (RAG + citations), and a Canvas that renders HTML the model writes.
  • Deep Research: a local model plans a question, searches the web, reads the sources, and writes a cited report.
  • Model Arena: two models, one prompt, side by side, with tokens/sec.
  • Hub: browse published OptiQ quants, search Hugging Face, list local models, load any of them with one click.
  • Quantize: the sensitivity + knapsack + convert wizard.
  • Fine-tune: sensitivity-aware LoRA on any OptiQ quant.
  • Build dataset: turn pairs / docs / code / seeds into training JSONL.

Hub

Find a model and load it without copy-pasting ids into Settings. The Hub shows three things, each with one-click load-to-server and new-chat actions:

  • Published OptiQ quants: auto-discovered from mlx-community, with family, size, bit profile, and download count.
  • Hugging Face search: any MLX-compatible model on the Hub; filter to OptiQ quants with a toggle.
  • Local models: anything you've converted locally (a directory with optiq/metadata.json), with a vision badge when it carries an optiq_vision sidecar.

Hub: browse and load models

Loading a model reuses the same hot-swap path as Settings → Server: the running model is switched in place (about 5–30 seconds depending on size) without restarting the Lab.

Quantize

A four-step wizard around the OptiQ convert pipeline. Paste an HF model id, pick the size target and reference mode, watch live progress on the sensitivity, knapsack and convert phases, then save locally and optionally push to your HF account with one click. The wizard detects supported architectures (Qwen3.5/3.6, Gemma-4) and warns on untested ones.

Quantize wizard

The per-layer sensitivity pass and multi-tier bit allocation are exactly the same as optiq convert; the Lab gives them a progress UI and a save/push button. How the measurement works is in How sensitivity works.

Feedback

Send feedback in the sidebar opens a short form that goes to the OptiQ team. On a chat page, a checkbox attaches that chat; it is off unless you tick it, since the chat's messages and tool output go with it.

Hugging Face token

Save a write-scope token once in Settings → Hugging Face and the Quantize / Fine-tune / Dataset workflows reuse it for one-click HF push. The token is encrypted at rest with a Fernet key derived from your Lab password.

HF settings

How it's structured

The Lab is a Flask app on its own port. optiq lab also boots mlx_lm.server in a daemon thread, so it's one process, two ports: UI on 7860, API on 8080. Background work (quantize, train, dataset generation) runs in multiprocessing.Process workers, progress streamed to the UI over SSE.

Why localhost-onlyThe Lab binds to 127.0.0.1. It is a local development tool, not a hosted service, so don't expose it to the internet. To reach it from another machine, use an SSH tunnel (ssh -L 7860:127.0.0.1:7860 you@your-mac) or a VPN. Its model API stays on 127.0.0.1 whatever --host says; to offer a model to other machines, run optiq serve --host <address> --api-key <key>.