Qwen3-8B-LAM-v4 — Large Action Model for AI Agent Creation
A fine-tuned Qwen3-8B model that creates, builds, and deploys AI agents from natural language requests. Unlike function-calling models that invoke existing tools, this LAM designs and constructs new agents — complete with tool definitions, multi-step skills, behavioral constraints, and installable agent files.
100% pass rate on agent generation benchmarks using the instruction repetition technique. Every generated agent is valid, installable, and immediately functional.
Key Results
Metric
LAM v4 (fine-tuned)
Qwen3-8B (base)
Improvement
Plan Mode Avg Score
96.0/100
95.5/100
+0.5%
Plan Mode Min Score
95
85
+11.8%
Valid JSON Rate
100%
100%
—
Agent Generation Pass Rate
90%
60%
+50%
With Instruction Repetition
100%
60%
+67%
Agent File Quality (passing)
100/100
100/100
—
Avg Inference Latency
20.5s
27.7s
-26%
Critical finding: Instruction repetition only benefits the fine-tuned model (+10% pass rate). The base model remains at 60% with or without repetition — it fails on the same prompts because it never learned the agent output schema. The fine-tuning is what enables the technique to work.
Full Test Matrix — Why Fine-Tuning Matters
All four conditions tested on the same 10 held-out prompts:
Standard Prompt
+ Instruction Repetition
Qwen3-8B Base
60% (6/10)
60% (6/10)
Qwen3-8B-LAM-v4 (fine-tuned)
90% (9/10)
100% (10/10)
Standard Repeated
Prompt Instruction
Base Qwen3-8B ██████░░░░ ██████░░░░ 60% → 60% (no improvement)
Fine-Tuned v4 █████████░ ██████████ 90% → 100% (+11% improvement)
▲
│
Fine-tuning + repetition = 100%
What this proves:
Fine-tuning alone: +50% improvement over base (60% → 90%)
Instruction repetition alone: +0% on base model (technique requires learned capabilities to amplify)
Fine-tuning + repetition: +67% over base (60% → 100%), eliminates all failures
The two techniques are complementary, not redundant — fine-tuning teaches the schema, repetition enforces adherence
What is a Large Action Model?
An LLM tells you how to do something. A LAM does it.
This model extends language generation to agent creation — it takes a natural language request like "Build an agent that reviews PRs for SQL injection" and outputs:
Architectural reasoning — why this agent design fits the request
Complete agent definition — tools, skills, constraints, and behavioral rules
Installable agent file — a ready-to-deploy Claude Code agent with YAML frontmatter and system prompt
Instruction Repetition Technique
We achieve 100% pass rate (up from 90%) using instruction repetition — a technique where the user request is repeated in the prompt:
{{request}}
Let me repeat your instruction: {{request}}
Every single prompt scored 100/100 — valid YAML frontmatter, correct tool names, meaningful system prompt body, process steps, and behavioral constraints. Zero degenerate outputs.
Base model (no fine-tuning) with same technique:
Metric
Standard Prompt
Repeated Instruction
Delta
Pass Rate
60%
60%
No change
Avg Score
60.0/100
60.0/100
No change
The base model fails on 4/10 prompts regardless of instruction repetition. The technique only amplifies capabilities the model already has — fine-tuning teaches the agent schema, repetition reinforces adherence to it.
1pip install mlx-lm
23# Generate an agent definition4mlx_lm.generate \5 --model chendren/Qwen3-8B-LAM-v4 \6 --max-tokens 4096\7 --prompt "You are a Large Action Model that creates AI agents and skills from user requests.
89When given a request, you:
101. Reason about what agent architecture best serves the need
112. Define the tools the agent requires
123. Define skills as composable, multi-step workflows
134. Set constraints to keep the agent safe and focused
1415Respond with a JSON object containing:
16- reasoning: your thought process for the design
17- agent: the complete agent definition with name, description, role, tools, skills, and constraints
1819User request: Build an agent that reviews PRs for SQL injection vulnerabilities
2021Let me repeat your instruction: Build an agent that reviews PRs for SQL injection vulnerabilities"
With Transformers
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model = AutoModelForCausalLM.from_pretrained("chendren/Qwen3-8B-LAM-v4")4tokenizer = AutoTokenizer.from_pretrained("chendren/Qwen3-8B-LAM-v4")56request ="Build an agent that monitors Docker containers for high memory usage"7prompt =f"""You are a Large Action Model that creates AI agents and skills from user requests.
89When given a request, you:
101. Reason about what agent architecture best serves the need
112. Define the tools the agent requires
123. Define skills as composable, multi-step workflows
134. Set constraints to keep the agent safe and focused
1415Respond with a JSON object containing:
16- reasoning: your thought process for the design
17- agent: the complete agent definition with name, description, role, tools, skills, and constraints
1819User request: {request}2021Let me repeat your instruction: {request}"""2223inputs = tokenizer(prompt, return_tensors="pt")24outputs = model.generate(**inputs, max_new_tokens=4096)25print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Output Schema
The model outputs structured JSON:
json
1{2"reasoning":"The user needs a Docker monitoring agent with alerting. This requires Bash for running docker stats, Read for checking thresholds, and Write for logging alerts...",3"agent":{4"name":"docker-memory-monitor",5"description":"Monitors Docker container memory usage and alerts on threshold breaches",6"role":"infrastructure monitor",7"tools":[8{9"name":"check_container_stats",10"description":"Runs docker stats to collect memory usage metrics",11"parameters":[12{"name":"container_id","type":"string","description":"Container to monitor","required":true}13],14"returns":"Memory usage percentage and absolute values"15}16],17"skills":[18{19"name":"memory-check",20"description":"Checks all running containers against memory thresholds",21"trigger":"On schedule or manual invocation",22"inputs":[{"name":"threshold_pct","type":"number","description":"Alert threshold","required":true}],23"steps":[24{"action":"List all running containers","tool":"check_container_stats"},25{"action":"Compare against threshold","on_failure":"log and continue"},26{"action":"Send alert for breaches","tool":"send_alert"}27],28"output":"List of containers exceeding threshold with current usage"29}30],31"constraints":[32"Never kill or restart containers without explicit user approval",33"Alert thresholds must be configurable, default 80%",34"Log all alerts to persistent storage"35]36}37}
Training Details
Dataset
3,104 examples from three sources, all open-source (zero API cost):
Source
Examples
Description
Synthetic agent definitions
1,261
Plan-mode examples generated via Anthropic Batch API (prior work)
8-bit quantized: This model uses affine 8-bit quantization (MLX format). For maximum quality, consider running at bf16.
Execution mode requires synthesis: The model excels at plan-mode JSON output. Agent file generation uses a synthesis layer that converts plan output to installable .md files.
English only: Trained exclusively on English agent definitions and tool-calling data.
Domain bias: Training data is weighted toward software engineering, DevOps, and cloud infrastructure domains. Performance on other domains (healthcare, finance, gaming) is untested.
Instruction repetition recommended: For maximum reliability (100% pass rate), use the instruction repetition technique described above.
Citation
bibtex
1@misc{hendren2026lam,
2 title={Qwen3-8B-LAM: Fine-Tuning Large Action Models for AI Agent Creation on Apple Silicon},
3 author={Hendren, Chad},
4 year={2026},
5 url={https://huggingface.co/chendren/Qwen3-8B-LAM-v4}
6}