--- license: apache-2.0 license_link: https://www.apache.org/licenses/LICENSE-2.0 base_model: LumineResearch/Lumine2 base_model_relation: quantized library_name: mlx pipeline_tag: image-text-to-text language: - en - zh tags: - mlx - mlx-vlm - apple-silicon - quantized - qwen3_5 - lumine2 - game-agent - keyboard-and-mouse - multimodal --- # Lumine 2 for MLX, 6bit [Lumine 2](https://huggingface.co/LumineResearch/Lumine2) is LumineResearch's generalist game agent: a fine-tune of Qwen3.5-9B (9.7B parameters, Apache 2.0) that watches the screen and emits keyboard and mouse actions, thinking first when it needs to. This repository is a quantized build for Apple silicon in [mlx-vlm](https://github.com/Blaizzy/mlx-vlm) format: 7.63 GiB of weights, for Macs with 16 GB of memory or more. Every language-model linear layer, embeddings and output head at 6-bit (affine, group size 64). The vision encoder stays in bf16. Tokenizer, chat template, processor files and the five Lumine special tokens are the original files, byte for byte. | Build | Weights | Bits per weight | Held-out loss vs original | Agent actions = original | Thoughts | Decode speed | Peak memory | |---|---|---|---|---|---|---|---| | original ([bf16 safetensors](https://huggingface.co/LumineResearch/Lumine2)), loaded as is | 17.98 GiB | 16 | reference (3.408 nats per token) | 6/6 | 1/6 | 23.9 tok/s | 20.59 GiB | | **6bit** (this repo) | 7.63 GiB | 6.5 | +0.047 ± 0.008 nats (+4.8% perplexity) | 6/6 | 1/6 | 55.5 tok/s | 9.84 GiB | Long prompts with this build: 10.0 GiB peak at a 4k-token prompt and 10.5 GiB at 16k, prefill about 2,700 tokens/s, decode 57 and 55 tokens/s. Other tiers: 5bit (coming), [8bit](https://huggingface.co/mlx-community/Lumine2-8bit) and [bf16](https://huggingface.co/mlx-community/Lumine2-bf16) from mlx-community. All rows were measured on one MacBook Pro (M5 Max, 36 GB) with greedy decoding and mlx-vlm 0.8.2. Held-out loss is the mean per-token difference against the original on 32 × 1,024 tokens of WikiText-2 test, paired by sequence, ± one standard error. Agent actions: six steps (two upstream test frames, Cyberpunk 2077 prompts in Instant English, Instant Chinese and Adaptive Thinking modes), counted when the action equals the original's. Thoughts: how many of those steps began with a thought; the original thinks on one. Six steps separate working builds from broken ones; they are not a benchmark. Decode speed and peak memory are for a 256-token text answer. Sizes are in GiB, the unit Mac memory comes in. ## Use ```sh pip install -U "mlx-vlm>=0.8.2" ``` One Instant-mode step on a screenshot. The game and mode prompts are the upstream files ([client/prompts](https://github.com/LumineResearch/Lumine2/tree/main/client/prompts)); the frame is resized to 800×448 as the upstream client does. ```sh python - <<'PY' from urllib.request import urlopen src = "https://raw.githubusercontent.com/LumineResearch/Lumine2/main/client/prompts/" game = urlopen(src + "games/cyberpunk_2077_en.txt").read().decode().rstrip() mode = urlopen(src + "modes/instant.en.txt").read().decode().strip() open("system.txt", "w").write((game + "\n\n" + mode).replace("", "Walk forward down the corridor by holding W.")) PY mlx_vlm.generate --model VisualInference/Lumine2-MLX-6bit \ --image frame-800x448.png --system "$(cat system.txt)" --prompt "" \ --no-enable-thinking --temperature 0 --max-tokens 48 ``` On the upstream corridor test frame this prints `<|action_start|>0 0 0<|action_sep|><|action_sep|><|action_sep|><|action_sep|><|action_sep|><|action_sep|> W<|action_end|>`. In Python: ```python from mlx_vlm import load, generate model, processor = load("VisualInference/Lumine2-MLX-6bit") messages = [{"role": "system", "content": open("system.txt").read()}, {"role": "user", "content": [{"type": "image"}]}] prompt = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False) out = generate(model, processor, prompt, image=["frame-800x448.png"], max_tokens=48, temperature=0.0, skip_special_tokens=False) print(out.text) ``` ### Settings that matter - **Keep special tokens.** Actions are delimited by `<|action_start|>`, `<|action_sep|>` and `<|action_end|>`, and thoughts by `<|thought_start|>` / `<|thought_end|>`. Generate with `skip_special_tokens=False` or the action cannot be parsed. - **Mode.** The first token decides it: `<|thought_start|>` reasons first, `<|action_start|>` acts at once. Use the upstream mode prompts (`instant`, `reasoning`) rather than the Qwen thinking switch. - **Language.** Lumine2 usually thinks in Chinese even with English prompts. For English thoughts use [Lumine2-EN](https://huggingface.co/LumineResearch/Lumine2-EN). - **Not a chat model.** It answers plain questions, but its replies carry stray `<|action_sep|>` tokens. The original bf16 weights do the same; it is not a quantization artifact. - **Live play** needs the upstream client for screen capture, frame history (SASH) and input. This build is the model only. ## Why there is no 4-bit build The upstream corridor test is a single step where the original holds W to walk forward (log-probability margin +1.00 over doing nothing; this build +1.75). Twelve 4-bit recipes were tried: affine at group size 64 and 32, mixed 4/6-bit, AWQ, NVFP4, MXFP4, and 8-bit protection of the embeddings, linear attention, full attention or MLPs alone and in combination. Every one of them chose to do nothing (margin -1.0 to -6.8), even recipes whose held-out loss matched the original. Quantizing below 6 bits shifts this agent toward idle actions, so the smallest build here is 6-bit. ## Speculative decoding The original checkpoint bundles a one-layer MTP head. Extracted and used as a drafter with this build it accepted 39% of drafted tokens and made decoding slower (18.2 s against 14.3 s for 256 tokens on the M5 Max), so it is not included. ## Not measured yet Long-context memory with the agent's full 120-frame history: coming. ## License Apache License 2.0, as the original. `LICENSE` is included. Weights by the Lumine 2 contributors ([technical report](https://arxiv.org/abs/2612.02332)).