Instructions to use pratikgx/Laghu-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use pratikgx/Laghu-MLX-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("pratikgx/Laghu-MLX-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use pratikgx/Laghu-MLX-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pratikgx/Laghu-MLX-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "pratikgx/Laghu-MLX-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use pratikgx/Laghu-MLX-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "pratikgx/Laghu-MLX-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "pratikgx/Laghu-MLX-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pratikgx/Laghu-MLX-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use pratikgx/Laghu-MLX-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pratikgx/Laghu-MLX-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default pratikgx/Laghu-MLX-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use pratikgx/Laghu-MLX-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pratikgx/Laghu-MLX-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "pratikgx/Laghu-MLX-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Laghu-MLX-4bit (unofficial community 4-bit conversion)
This is a 4-bit MLX quantization of udgamlabs/Laghu-MLX, the MLX build of udgamlabs/Laghu, a 152M-parameter small language model trained by Udgam Labs. All credit for the model goes to Udgam Labs. This repo only changes the weight precision.
Quality caveat. This is an unofficial conversion, not released by Udgam Labs. Udgam Labs deliberately chose not to publish a 4-bit MLX build because it loses quality clearly. They report mean KL 0.337 and top-1 agreement 69.9% against their F16 reference. Their bf16 MLX build scores KL 0.0009 and 98.0%. I did not run quality benchmarks on this 4-bit copy. For quality, use the bf16 udgamlabs/Laghu-MLX. This copy is here for speed and memory experiments.
Quantization
- Tool:
mlx_lm.convert -q --q-bits 4 --q-group-size 64(affine, group size 64) - Effective size: 4.506 bits per weight (model.safetensors is about 86 MB, vs 303.6 MB for upstream bf16)
- Versions: mlx-lm 0.32.2, mlx 0.32.4, Python 3.12
- Architecture:
gemma4_text, max context 16,384 tokens, 512-token sliding window - The tokenizer, chat template and generation config are unchanged from upstream
Usage
pip install -U mlx-lm
mlx_lm.generate --model pratikgx/Laghu-MLX-4bit --prompt "Who are you?" --max-tokens 256
from mlx_lm import load, generate
model, tokenizer = load("pratikgx/Laghu-MLX-4bit")
messages = [{"role": "user", "content": "Write a haiku about autumn rain."}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False)
print(generate(model, tokenizer, prompt=prompt, max_tokens=256, verbose=True))
The chat template supports an enable_thinking switch. Upstream recommends temperature 0.7, top-p 0.95 and top-k 64,
and keeping context at 16,384 tokens or less.
Speed (bf16 vs this 4-bit copy)
Measured on an Apple M4 Pro (16 GPU cores, 24 GB) running macOS 27.0.1, with mlx 0.32.4 and mlx-lm 0.32.2. Settings: greedy decoding, prompts taken from Pride and Prejudice, 256 generated tokens (ignore EOS), prefill step 2048, 1 warmup run, then the median of 3 runs.
| Prompt tokens | bf16 decode | 4-bit decode | bf16 prefill | 4-bit prefill | bf16 peak mem | 4-bit peak mem |
|---|---|---|---|---|---|---|
| 512 | 364 tok/s | 402 tok/s | 11,516 tok/s | 11,844 tok/s | 0.66 GB | 0.38 GB |
| 2,048 | 356 tok/s | 409 tok/s | 11,264 tok/s | 10,825 tok/s | 1.17 GB | 1.11 GB |
| 8,192 | 328 tok/s | 397 tok/s | 9,198 tok/s | 8,876 tok/s | 1.23 GB | 1.15 GB |
| 16,000 | 303 tok/s | 379 tok/s | 7,554 tok/s | 7,069 tok/s | 1.26 GB | 1.15 GB |
4-bit decodes about 10β25% faster. Prefill speed is about the same. Peak memory is lower only at short prompts, because the KV cache dominates at longer contexts.
The quality benchmarks (GSM8K, IFEval, ARC-Easy, HellaSwag) were run on the bf16 model only, not on this 4-bit copy. Raw results, settings and the harness are in the dataset pratikgx/launch-bench-results.
License and attribution
Apache-2.0, the same as upstream. See NOTICE, copied unchanged from udgamlabs/Laghu-MLX: the weights and tokenizer are
Β© 2026 Udgam Labs LLP, and the chat template is Google's Gemma 4 template (Apache-2.0).
- Downloads last month
- 12
4-bit
Model tree for pratikgx/Laghu-MLX-4bit
Base model
udgamlabs/Laghu-Base