MLX
lora
adapters
agent
tool-calling
gemma
autonomous-agent
KikoCis's picture
Fix: honest LoRA-adapters labeling; remove training recipe/dataset composition/hyperparameters from card
8aaa6bd verified
|
Raw
History Blame Contribute Delete
5.09 kB
metadata
library_name: mlx
license: apache-2.0
tags:
  - lora
  - adapters
  - agent
  - tool-calling
  - gemma
  - mlx
  - autonomous-agent
datasets:
  - KikoCis/real-world-agent-benchmark
base_model: google/gemma-4-31b-it

Gemma 4 31B Agent v6 β€” LoRA Adapters (MLX)

LoRA adapters that turn base Gemma 4 31B (q4 MLX) into a capable local autonomous agent.

This repo contains the adapters only (~65 MB) β€” not a standalone model. Apply them on top of the base to reproduce the agent.

πŸ† 10/10 BioinformaticsπŸ† 10/10 DevOpsπŸ“Š 6/10 Data Engineering
⚑ $0 cost · applies to a 16 GB q4 base · Runs on Apple Silicon

⚠️ What this repo is (and isn't)

  • IS: a set of LoRA adapters (MLX format, ~65 MB) for base Gemma 4 31B IT quantized to q4. Checkpoints at 250/500/750/1000 steps are included.
  • IS NOT: a full, standalone model. There are no base weights here β€” you supply the base and apply these adapters on top.

πŸš€ How to use

You need base Gemma 4 31B IT in MLX q4 form. Then apply these adapters:

# 1) get an MLX q4 base (one-time):
python3 -m mlx_lm.convert --hf-path google/gemma-4-31b-it -q --q-bits 4 --mlx-path gemma4-31b-q4

# 2) download these adapters:
huggingface-cli download KikoCis/gemma-4-31b-agent-v6-MLX --local-dir gemma4-31b-v6-adapters

# 3) run the base + adapters together:
python3 -m mlx_lm.server --model gemma4-31b-q4 --adapter-path gemma4-31b-v6-adapters/adapters --port 8095
from mlx_lm import load, generate
model, tokenizer = load("gemma4-31b-q4", adapter_path="gemma4-31b-v6-adapters/adapters")

prompt = """You are an autonomous agent. To run commands: {"name": "bash", "arguments": "command"}

TASK: Download and analyze protein P53 from UniProt.
Begin."""
print(generate(model, tokenizer, prompt=prompt, max_tokens=500))

The benchmark/ folder ships the agent runner + scorer used to produce the results below.

🎯 Why this exists: The Benchmark Trap

We found that 95% BFCL (Berkeley Function Calling Leaderboard) β‰  real agent capability. A model can score 95%+ on BFCL and still score 0/10 on an autonomous Docker challenge β€” entering infinite loops, unable to recover from errors. Standard benchmarks test format; real work tests reasoning and persistence.

These adapters were built to improve exactly that: multi-turn persistence and error recovery on real, open-ended tasks.

πŸ“Š Real-World Agent Benchmark β€” results

4 challenges Γ— 30 min each, autonomous inside Docker containers. Base + these adapters vs. Claude Opus (cloud):

Challenge Claude Opus 4.6 (cloud) Base + these adapters (local, $0) Comment
1. Bioinformatics β€” P53 from UniProt β†’ parse β†’ HTML report 9/10 Β· 13 turns Β· $1.33 10/10 Β· 9 turns Β· FREE Both hit the same JSON-parse bug; local produces the larger report
2. Security CTF β€” DVWA, SQLi/XSS/cmd-injection 0/10 Β· 64 turns Β· $1.59 1/10 Β· 30 turns Β· FREE Container lacks sudo β€” a test-env issue, both fail
3. Data Engineering β€” NYC-taxi pipeline + dashboard 9/10 Β· 19 turns Β· $1.17 6/10 Β· 7 turns Β· FREE Correct data both sides; Opus wins on presentation
4. DevOps β€” Flask + Nginx + Prometheus + status page 10/10 Β· 26 turns Β· $0.63 10/10 Β· 19 turns Β· FREE Opus brings full infra live; local configs correct, exec limited by permissions
TOTAL 28/40 Β· 122 turns Β· $4.72 27/40 Β· 65 turns Β· $0.00 Local uses ~75% fewer tokens; ~5Γ— slower on local GPU

SWE-bench Lite (30 problems, simplified patch matching)

Model Accuracy Time Cost
Claude Opus 4.6 10% (3/30) 43 min ~$15
Base + these adapters 10% (3/30) 105 min $0

Not tuned for coding β€” included only as a reference baseline.

⚠️ Good to know

  • Adapters, not a model β€” you must supply the base (see How to use).
  • Not tuned for coding β€” SWE-bench 10% is a reference baseline, not an optimization target.
  • Slow on local GPU β€” expect several seconds per response vs ~2s for a cloud API.
  • No web search β€” can't look up docs when stuck.
  • Permissions β€” non-root containers limit what the agent can install/configure.

πŸ“š Citation

@misc{cisneros2026benchmarktrap,
  title={The Benchmark Trap: How 95% BFCL Produces a 0% Agent},
  author={Cisneros, Kiko},
  year={2026},
  publisher={Utopia IA},
  url={https://huggingface.co/KikoCis/gemma-4-31b-agent-v6-MLX}
}

πŸ”— Links

License Apache-2.0, inherited from the base model. Adapters Β© KikoCis / Utopia IA.