Qwen3.6-35B-A3B Code-as-Action LoRA (MLX)

LoRA adapter that specializes Qwen3.6 / Qwen3.5-35B-A3B (MoE, ~3B active parameters) for code-as-action agent behavior: solve problems by writing and executing programs, then conditioning the next step on execution feedback.

This repository contains adapter weights only (not the full base model). Inference requires the corresponding MLX base checkpoint (e.g. lmstudio-community/Qwen3.6-35B-A3B-MLX-8bit or an equivalent Qwen3.5-35B-A3B MLX build).

Training objective

The fine-tuning objective follows the CodeAct formulation (Wang et al., ICML 2024): treat executable code as a unified action space for LLM agents, instead of restricting tools to a fixed JSON/API schema. Related prior work includes ReAct (Yao et al., 2022) for interleaved reasoning and acting, and PAL (Gao et al., 2023) for program-aided reasoning.

Concretely, each training example teaches the model to:

  1. Reason briefly about the task (<think>…</think>).
  2. Emit a Qwen-native tool call that runs shell/Python:
<tool_call>
{"name": "bash", "arguments": {"cmd": "…"}}
</tool_call>
  1. Continue after an execution observation (multi-turn), including diagnose → repair → verify loops when the task requires it.

The scientific claim supported by CodeAct is that consolidating actions into executable Python/code improves agent success rate versus text/JSON action formats on tool-use benchmarks (up to ~20% absolute in the original evaluation suite). This adapter applies that design pattern via supervised LoRA fine-tuning on curated multi-turn trajectories; it is not a reproduction of CodeActInstruct training, and no official CodeActInstruct weights are claimed.

Training data

Split File Rows
Train train_qwen3.jsonl 3,492
Validation valid_qwen3.jsonl 389

Splits were produced by a deterministic 90/10 stratified partition (random.seed(42)) of frontier_procedural_combined_3881.jsonl (3,881 trajectories total). That combined pool is the union of:

Source Rows Role
frontier_2026_verified_clean.jsonl 1,881 Multi-step SWE / systems / analysis trajectories (verified, deduplicated)
procedural_world_code_as_action_2000.jsonl 2,000 Executable checks for procedural/worldgen constraints (geometry, stitching, spacing invariants)

Topic buckets used for stratification on the combined pool (pre-split counts):

Bucket Count Content
general 1,201 Hash/search proofs, CIDR math, log aggregation, algorithm checks, and related executable tasks
ast 1,180 Python AST / static taint-style audits of synthetic example programs (defensive code review)
assembly 400 Assembly reading / analysis exercises with executable verification
concurrency 380 asyncio race / deadlock diagnosis and locked fixes
distributed 380 Consensus / state-machine invariant checks
bytecode 340 Bytecode / opcode interpretation with executable probes

All samples are synthetic, programmatically generated instruction/response trajectories (prompt/completion pairs). They are not scraped chat logs, not proprietary customer data, and not the public CodeActInstruct corpus. Educational crypto examples use known toy ciphers with known keys/algorithms for decryption exercises; they are not materials for attacking live systems.

Action format in all Qwen train/valid rows: ChatML (<|im_start|> / <|im_end|>) + Qwen <tool_call> JSON for bash.

Training procedure

Hyperparameter Value
Base model Qwen3.6-35B-A3B MLX 8-bit (Qwen3_5MoeForConditionalGeneration)
Method LoRA (mlx_lm lora)
Rank 8
Scale 20.0
Dropout 0.0
LoRA layers last 16 transformer layers
Optimizer Adam
Learning rate 3e-6
Batch size 4
Max sequence length 4,096
Gradient checkpointing enabled
Iterations 423 (checkpoints every 100; final adapters.safetensors)
Hardware Apple Silicon (MLX)

This adapter is the code-as-action checkpoint only. A separately trained continuation that adds a large cybersecurity theory corpus exists under a different path (qwen3.6_35b_code_plus_theory_lora) and is not included here.

Files

File Description
adapters.safetensors Final LoRA weights
0000400_adapters.safetensors Checkpoint at iteration 400
adapter_config.json MLX LoRA training config snapshot

Intended use

  • Research and engineering experiments on program-aided / tool-using agents on Apple Silicon (MLX).
  • Teaching a Qwen MoE worker to emit executable bash/Python actions and self-correct from observations.
  • Composition inside multi-adapter MoE harnesses as an execution worker.

Out of scope / limitations

  • Not a fully agentic system by itself: still requires a host that executes tool calls and returns observations.
  • Synthetic trajectories cover a narrow set of domains; out-of-distribution tool APIs and long-horizon tasks may fail.
  • Static-analysis and low-level examples are for defensive education and debugging practice, not for unauthorized access, malware production, or attacking systems you do not own.
  • Base model quantization (8-bit MLX) and LoRA rank 8 both limit fidelity versus full-precision full fine-tuning.
  • No claim of parity with frontier commercial agents or with the original CodeActAgent checkpoints.

How to load (MLX)

python -m mlx_lm generate \
  --model <path-or-id-to-Qwen3.6-35B-A3B-MLX> \
  --adapter-path True2456/Qwen3.6-35B-A3B-Code-as-Action-LoRA \
  --prompt '<|im_start|>user
Write a short Python script that prints the SHA-256 of "hello", then show the command you would run.
<|im_end|>
<|im_start|>assistant
'

Or with mlx_lm.utils.load:

from mlx_lm import load, generate

model, tokenizer = load(
    "<path-or-id-to-Qwen3.6-35B-A3B-MLX>",
    adapter_path="True2456/Qwen3.6-35B-A3B-Code-as-Action-LoRA",
)

References

  1. Wang, X., Chen, Y., Yuan, L., Zhang, Y., Li, Y., Peng, H., & Ji, H. (2024). Executable Code Actions Elicit Better LLM Agents. ICML 2024. https://arxiv.org/abs/2402.01030
  2. Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan, K., & Cao, Y. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. https://arxiv.org/abs/2210.03629
  3. Gao, L., Madaan, A., Zhou, S., Alon, U., Liu, P., Yang, Y., Callan, J., & Neubig, G. (2023). PAL: Program-aided Language Models. ICML 2023. https://arxiv.org/abs/2211.10435

Citation

@misc{true2456_qwen36_code_as_action_lora,
  author = {True2456},
  title  = {Qwen3.6-35B-A3B Code-as-Action LoRA (MLX)},
  year   = {2026},
  howpublished = {Hugging Face model repository},
  note   = {LoRA fine-tune for executable code actions; paradigm based on Wang et al. 2024 CodeAct}
}

License

Adapter weights are released under Apache 2.0. Use of the underlying Qwen base model remains subject to the base model’s license and terms from Alibaba / Qwen.

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for True2456/Qwen3.6-35B-A3B-Code-as-Action-LoRA

Adapter
(30)
this model

Papers for True2456/Qwen3.6-35B-A3B-Code-as-Action-LoRA