--- base_model: webbrain-one/WebBrain-LingLoop-8B-A1.3B library_name: mlx pipeline_tag: text-generation tags: - mlx - mlx-lm - 4-bit - mixture-of-experts - looped-transformer --- # WebBrain LingLoop 8B A1.3B for MLX (4-bit) This is the MLX conversion of [WebBrain-LingLoop-8B-A1.3B](https://huggingface.co/webbrain-one/WebBrain-LingLoop-8B-A1.3B/tree/6cd99926f92814c991585f48254dbd172cd8d162). The shared physical decoder layers, the learned cross-pass adapter, and the separate state for each loop pass are preserved. Eligible matrices use 4-bit MLX affine quantization with group size 64. The embedding and output head stay in their source precision, and the loop adapter stays FP32. This conversion starts from the publisher's original weights, not a previously quantized GGUF. ## Architecture ![Ling-3.0-tiny and LingLoop compared side by side. LingLoop runs layers 4–19 twice with shared weights, a learned cross-pass adapter, and separate KDA and MLA state.](assets/lingloop-architecture.png) Ling-3.0-tiny runs each of its 24 layers once. LingLoop reuses the weights of core layers 4–19 for a second pass, yielding 40 layer executions per token. Both passes start at the same prelude output. The 12.63M-parameter adapter reads first-pass activations and gates the inputs to attention and MoE in the second pass. Each pass maintains its own KDA recurrent state and MLA KV cache. ## Run On Apple Silicon, LingLoop Engine includes the loop implementation locally and loads the weights without importing Python files from the Hub. See [LingLoop Engine](https://github.com/esokullu/lingloop-engine). The standalone MLX-LM command below opts into the reviewed `lingloop_mlx_model.py` included in this repository. MLX-LM 0.32.2 is the supported version for this export. ```sh python -m pip install 'mlx==0.32.5' 'mlx-lm==0.32.2' mlx_lm.generate --model webbrain-one/WebBrain-LingLoop-8B-A1.3B-MLX-4bit \ --trust-remote-code --chat-template-config '{"enable_thinking": false}' \ --prompt 'Answer with just the number: what is 17 times 23?' --max-tokens 64 ``` ## Reproduce From the LingLoop Engine checkout, install the pinned dependencies above and run: ```sh python scripts/convert_mlx.py --source ./lingloop-bf16 --output ./lingloop-mlx-4bit ``` The converter checks upstream file digests before conversion. `SHA256SUMS` covers the packaged configuration, code, tokenizer and weight shards. ## Validation On the MLX CPU runtime, the unquantized port matched the published PyTorch reference's top token at all 16 sampled positions across four prompts. The 4-bit export matched 14 of 16. In LingLoop Engine it passed model listing, arithmetic, streamed chat, and a structured tool call on a server configured for 32,768 tokens. These were short requests. See [VALIDATION.json](VALIDATION.json) for the methodology and results. Apple Metal performance has not been measured. ## Attribution The looped checkpoint and adapter are from [WebBrain](https://huggingface.co/webbrain-one/WebBrain-LingLoop-8B-A1.3B). The base weights come from [inclusionAI/Ling-3.0-tiny](https://huggingface.co/inclusionAI/Ling-3.0-tiny), whose MIT notice is included as `LICENSE.inclusionAI`. The runtime extends [MLX-LM](https://github.com/ml-explore/mlx-lm), whose notice is included as `LICENSE.mlx-lm`. The base model's license notice concerns the upstream base material.