Text Generation
MLX
Safetensors
English
qwen3
terminal
fine-tuned
4bit
conversational
4-bit precision
Instructions to use mlxstudio/qwen3-4b-4bit-terminal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlxstudio/qwen3-4b-4bit-terminal 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("mlxstudio/qwen3-4b-4bit-terminal") 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
- LM Studio
- Pi new
How to use mlxstudio/qwen3-4b-4bit-terminal with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlxstudio/qwen3-4b-4bit-terminal"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlxstudio/qwen3-4b-4bit-terminal" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use mlxstudio/qwen3-4b-4bit-terminal 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 "mlxstudio/qwen3-4b-4bit-terminal"
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 mlxstudio/qwen3-4b-4bit-terminal
Run Hermes
hermes
- MLX LM
How to use mlxstudio/qwen3-4b-4bit-terminal with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlxstudio/qwen3-4b-4bit-terminal"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlxstudio/qwen3-4b-4bit-terminal" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlxstudio/qwen3-4b-4bit-terminal", "messages": [ {"role": "user", "content": "Hello"} ] }'
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -16,19 +16,28 @@ pipeline_tag: text-generation
|
|
| 16 |
|
| 17 |
Fine-tuned Qwen3-4B model for terminal command generation. Optimized for LocalTerm app.
|
| 18 |
|
|
|
|
|
|
|
| 19 |
## Model Details
|
| 20 |
|
| 21 |
-
- **Base Model**: mlx-community/Qwen3-4B-4bit
|
| 22 |
-
- **
|
|
|
|
|
|
|
| 23 |
- **Training Data**: 388 examples, 74 terminal commands
|
| 24 |
- **Accuracy**: 98% on test set (147/150 correct)
|
| 25 |
-
- **Size**: ~2.3GB (4-bit quantized)
|
| 26 |
-
- **Format**: MLX safetensors (merged, no adapter needed)
|
| 27 |
|
| 28 |
## Usage
|
| 29 |
|
| 30 |
### With MLX-LM (Python)
|
|
|
|
|
|
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
### With LocalTerm (macOS app)
|
| 34 |
Model auto-downloads on first run. See [LocalTerm](https://github.com/aleonis/localterm).
|
|
@@ -44,7 +53,7 @@ Model auto-downloads on first run. See [LocalTerm](https://github.com/aleonis/lo
|
|
| 44 |
## Version History
|
| 45 |
|
| 46 |
- **v2 (2026-01-22)**: Re-fused model with correct weight format
|
| 47 |
-
- Fixed:
|
| 48 |
- Now compatible with mlx-swift-lm
|
| 49 |
- **v1 (2026-01-21)**: Initial release (had loading issues in Swift)
|
| 50 |
|
|
|
|
| 16 |
|
| 17 |
Fine-tuned Qwen3-4B model for terminal command generation. Optimized for LocalTerm app.
|
| 18 |
|
| 19 |
+
> **Note**: HuggingFace shows "0.6B params" - this is incorrect. The actual model has **4 billion parameters** (4-bit quantized). HuggingFace miscalculates param count for MLX quantized safetensors files.
|
| 20 |
+
|
| 21 |
## Model Details
|
| 22 |
|
| 23 |
+
- **Base Model**: [mlx-community/Qwen3-4B-4bit](https://huggingface.co/mlx-community/Qwen3-4B-4bit)
|
| 24 |
+
- **Actual Parameters**: **4 billion** (same as base model)
|
| 25 |
+
- **Quantization**: 4-bit (MLX format, ~2.3GB file size)
|
| 26 |
+
- **Fine-tuning**: QLoRA on 16 layers
|
| 27 |
- **Training Data**: 388 examples, 74 terminal commands
|
| 28 |
- **Accuracy**: 98% on test set (147/150 correct)
|
|
|
|
|
|
|
| 29 |
|
| 30 |
## Usage
|
| 31 |
|
| 32 |
### With MLX-LM (Python)
|
| 33 |
+
```python
|
| 34 |
+
from mlx_lm import load, generate
|
| 35 |
|
| 36 |
+
model, tokenizer = load("mlxstudio/qwen3-4b-4bit-terminal")
|
| 37 |
+
prompt = "how to create a git repository"
|
| 38 |
+
response = generate(model, tokenizer, prompt=prompt, max_tokens=100)
|
| 39 |
+
print(response)
|
| 40 |
+
```
|
| 41 |
|
| 42 |
### With LocalTerm (macOS app)
|
| 43 |
Model auto-downloads on first run. See [LocalTerm](https://github.com/aleonis/localterm).
|
|
|
|
| 53 |
## Version History
|
| 54 |
|
| 55 |
- **v2 (2026-01-22)**: Re-fused model with correct weight format
|
| 56 |
+
- Fixed: `.linear.` prefix issue in LoRA merged weights
|
| 57 |
- Now compatible with mlx-swift-lm
|
| 58 |
- **v1 (2026-01-21)**: Initial release (had loading issues in Swift)
|
| 59 |
|