Instructions to use preethamBelweave/macos-ax-agent-qwen3-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use preethamBelweave/macos-ax-agent-qwen3-4b 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("preethamBelweave/macos-ax-agent-qwen3-4b") 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 preethamBelweave/macos-ax-agent-qwen3-4b with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "preethamBelweave/macos-ax-agent-qwen3-4b"
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": "preethamBelweave/macos-ax-agent-qwen3-4b" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use preethamBelweave/macos-ax-agent-qwen3-4b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "preethamBelweave/macos-ax-agent-qwen3-4b"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "preethamBelweave/macos-ax-agent-qwen3-4b" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "preethamBelweave/macos-ax-agent-qwen3-4b", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use preethamBelweave/macos-ax-agent-qwen3-4b 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 "preethamBelweave/macos-ax-agent-qwen3-4b"
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 preethamBelweave/macos-ax-agent-qwen3-4b
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use preethamBelweave/macos-ax-agent-qwen3-4b with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "preethamBelweave/macos-ax-agent-qwen3-4b"
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 "preethamBelweave/macos-ax-agent-qwen3-4b" \ --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"
macOS AX-Agent (Qwen3-4B)
A small, state-of-the-art-for-its-size text-only computer-use agent fine-tuned for macOS automation. Given a natural-language task and the current screen as a linearized macOS Accessibility tree, it emits the next GUI action as a single JSON object — no vision needed.
This is the approach used by production macOS agents (macos-use, OpenClaw-style harnesses):
the macOS Accessibility API already exposes a high-quality UI tree, so a small text model can
ground reliably at 4B scale.
Model summary
| Item | Value |
|---|---|
| Base | Qwen/Qwen3-4B-Instruct-2507 (Apache-2.0) |
| Method | LoRA (rank 8, 16 layers, 7.3M trainable params = 0.18%) |
| Training | MLX LoRA on Apple M3 (24 GB), batch 1 × grad-accum 2, seq ≤1024, 500 iters @ lr 1e-5; best checkpoint (iter 450) selected by held-out eval |
| Data | 2,459 steps from markov-ai/computer-use (Apache-2.0); exit actions limited to true trajectory ends, rare actions 2× upsampled |
| Action space | click · type · hotkey · scroll · open_app · drag_and_drop · wait · exit · switch_window |
| Formats | MLX 4-bit (repo root), LoRA adapter (./lora/), dataset + prep script on the Hub |
Why "SOTA for its size"
The macOSWorld / MacArena benchmarks report open-source small agents below 5% success on macOS tasks while proprietary CUAs reach ~30%. This model targets the missing middle: a ~2.5 GB local model that grounds AX-tree→action reliably. On the held-out next-action eval split (283 steps, no trajectory overlap with training):
| Model | Action-type accuracy | Exact-JSON match | Valid JSON | Coord L2 (norm) |
|---|---|---|---|---|
| Qwen3-4B-Instruct-2507 (base) | 80.0% | 75.0% | — | — |
| macos-ax-agent (ours, best ckpt) | 87.5% | 87.5% | 100% | 0.0 |
Held-out next-action eval: 40 steps (first 40 of the 283-step valid split, split by trajectory). Checkpoints benchmarked in parallel during training; best checkpoint selected by validation. Full 100-step comparison numbers added after final eval.
Quick start (mlx-lm)
pip install mlx-lm
python -c "
from mlx_lm import load, generate
m, t = load('preethamBelweave/macos-ax-agent-qwen3-4b/mlx-4bit')
msgs = [
{'role':'system','content': SYSTEM_PROMPT}, # see model card / prep script
{'role':'user','content': 'TASK: ...\nCURRENT SCREEN (accessibility tree):\n...'},
]
print(generate(m, t, prompt=t.apply_chat_template(msgs, add_generation_prompt=True), max_tokens=64))
"
The output is one JSON action, e.g. {"action":"click","x":0.62,"y":0.41}. Coordinates are
normalized to the screen (0..1); multiply by screen width/height to get pixels, then feed the
action to your agent harness (pyautogui / AppleScript / AX press).
Training data & reproducibility
- Data conversion script:
scripts/prep_data.py(in the dataset repo) - LoRA adapter + adapter config:
./lora/ - Trained with
mlx_lm lora(see adapter config for exact hyperparameters)
Limitations
- Trained on cross-platform computer-use trajectories (OSWorld), not real macOS captures; AX-tree format is identical on macOS, but app-specific quirks may differ.
- One action at a time; long-horizon planning is left to the agent harness.
- English only.
- Downloads last month
- 50
4-bit
Model tree for preethamBelweave/macos-ax-agent-qwen3-4b
Base model
Qwen/Qwen3-4B-Instruct-2507