Qwen3.6-35B-A3B SWE LoRA Stage-2 v01
A LoRA adapter (rank 16) for Qwen/Qwen3.6-35B-A3B, trained in a second stage on top of the SFT v01 adapter (jasonzhanglll/qwen3.6-35b-a3b-swe-lora-sft-v01, checkpoint 93). The second stage is execution-feedback filtered continued SFT: the SFT model's own fixes are kept only when they pass the task's tests, and training continues on them together with a share of the original SFT data. No preference optimisation or reinforcement learning was applied.
The adapter applies directly to the base model at the revision below; it already contains the SFT starting point, so do not stack it on the SFT adapter. This repository contains only the adapter weights.
Base model
| Field | Value |
|---|---|
| Repository | Qwen/Qwen3.6-35B-A3B |
| Revision (commit) | 995ad96eacd98c81ed38be0c5b274b04031597b0 |
| Architecture | Qwen3_5MoeForConditionalGeneration (model_type qwen3_5_moe) |
| Text decoder | 40 layers, hidden size 2048, 256 routed experts (top-8) plus one shared expert, hybrid attention (30 linear-attention / Gated DeltaNet layers, 10 full-attention layers at every 4th position) |
| Native context | 262,144 tokens |
| Precision | bfloat16 |
The adapter configuration (adapter_config.json) records this repository id in base_model_name_or_path and the commit in revision. The file as written by the training job (adapter_config.original.json, kept verbatim) had both fields set to null because the base weights were mounted from a local path inside the training container; no other field was changed.
Training data
719 training rows in ms-swift messages format, with the same system and user prompt as SFT v01 and non-thinking targets:
- 503 self-samples. Fixes generated by the frozen SFT v01 model for tasks of the SFT v01 training pool, graded on the buggy tree: the patch must apply with
git applyand pass every FAIL_TO_PASS test of its task, with edits to test files reverted before testing. Of 3,472 graded candidates, 1,099 passed; identical normalised diffs within a task were merged and at most two fixes per task kept, which left 503. Of these, 500 also ran and passed their PASS_TO_PASS tests; the other 3 belong to tasks with no PASS_TO_PASS tests. - 216 replay rows. SFT v01 training rows copied unchanged, sampled without replacement and stratified by repository so that they make up 30 % of the set.
- Token budget as in SFT v01: at most 4,096 tokens per row and 1,500 assistant tokens; over-budget rows were dropped, never truncated.
The development split is the SFT v01 split (141 samples from 5 repositories disjoint from training). No benchmark question, answer, reference patch, hidden test or judge feedback entered the data.
Training setup
| Item | Value |
|---|---|
| Framework | Megatron-SWIFT (ms-swift 4.2.3, megatron-core 0.16.1) |
| Initialisation | the SFT v01 adapter (checkpoint 93) |
| LoRA | rank 16, alpha 32, dropout 0.05, all-linear targets (unchanged from SFT v01) |
| Optimisation | learning rate 2e-5, cosine decay to 0, warm-up 3 % of steps, weight decay 0.1, gradient clipping 1.0, bf16 |
| Schedule | 1 epoch = 44 optimizer steps; global batch 16 sequences, micro batch 1, sequences of at most 4,096 tokens; seed 43 |
| Hardware | 4 x NVIDIA RTX PRO 5000 72GB Blackwell, tensor parallel 1 / pipeline parallel 4 |
| Time | training process 1,044 s; about 14.9 s per optimizer step in steady state |
Checkpoint selection and development loss
Checkpoints were saved at steps 25 and 44. The selection rule was fixed before training: the lowest development loss wins, and a later checkpoint wins ties within 0.005. Development loss was 0.26016 at step 25 and 0.25968 at step 44, so this repository holds checkpoint 44.
On the same development split the SFT v01 adapter scored 0.24492, so the second stage did not lower development loss. That loss measures the likelihood of the reference patches, while 70 % of the second-stage rows are the SFT model's own passing fixes; a higher development loss does not by itself mean a weaker repair model. A replicate on 4 x NVIDIA A100 with the same data, configuration and seed gave 0.26014 at step 25 and 0.25928 at step 44, within 0.0004 of the run above.
What is in the adapter
adapter_model.safetensors holds 62,060 bfloat16 tensors with 1,279,457,280 parameters in total (about 2.57 GB). All tensor names follow the PEFT convention base_model.model.model.language_model.layers.<i>.<module>.lora_{A,B}.weight, with lora_A of shape [16, in_features] and lora_B of shape [out_features, 16].
Three parameter figures describe this adapter: 939.0 M (938,997,760) trainable parameters in the fused training view, 1,279.5 M (1,279,457,280) parameters stored in the exported adapter, and a 2.57 GB file (2,568,923,184 bytes). The difference of 340,459,520 (340.46 M) is the LoRA-A matrices of projections that Megatron keeps fused but Hugging Face splits, which the export duplicates once per split target (routed-expert linear_fc1 -> gate_proj/up_proj: 335.54 M; Gated DeltaNet in_proj -> four in_proj_* targets: 2.95 M; attention qkv -> q_proj/k_proj/v_proj: 0.66 M; shared-expert linear_fc1 -> gate_proj/up_proj: 1.31 M), all measured from the tensor header; the function computed is unchanged, since a fused weight $W=[W_1;W_2]$ with update $BA$ splits into $B_1A$ and $B_2A$ with the same $A$. The four pipeline ranks hold unequal shares (ranks 0 and 2 carry one more Gated DeltaNet layer than ranks 1 and 3), and only rank 0 logged its count (234.7745 M).
| Targeted module group | Layers | Tensors | Example name |
|---|---|---|---|
Linear attention (Gated DeltaNet): in_proj_qkv, in_proj_z, in_proj_b, in_proj_a, out_proj |
30 | 300 | ...layers.0.linear_attn.in_proj_qkv.lora_A.weight |
Full attention: q_proj, k_proj, v_proj, o_proj |
10 (layers 3, 7, ..., 39) | 80 | ...layers.11.self_attn.q_proj.lora_A.weight |
Shared expert: gate_proj, up_proj, down_proj |
40 | 240 | ...layers.0.mlp.shared_expert.down_proj.lora_B.weight |
Routed experts 0..255: gate_proj, up_proj, down_proj (per expert) |
40 | 61,440 | ...layers.0.mlp.experts.0.gate_proj.lora_A.weight |
The per-expert LoRA tensors account for 98.3 % of the adapter parameters. shared_expert_gate is matched by the target_modules regex but has no stored LoRA weights; a loader that injects LoRA into it will warn about missing keys and leave it as a zero-initialised (no-op) LoRA, which is harmless. inference_mode is false in the saved configuration, as written by the trainer; PEFT switches it to inference mode when loading with the default is_trainable=False.
Loading
Verification status of this section: this adapter has the same configuration and tensor layout as the SFT v01 adapter, for which the snippets were checked for configuration and key-name compatibility against transformers 5.19.0 and PEFT 0.21.2 (the adapter configuration parses with PeftConfig.from_pretrained; the tensor-name prefix matches Qwen3_5MoeForConditionalGeneration). End-to-end loading of the 35B base with this adapter was not executed while preparing this card. Evaluation results will be reported separately.
Important compatibility note: routed-expert LoRA and transformers
In transformers 5.x the routed experts of this architecture are implemented as fused parameters (mlp.experts.gate_up_proj, mlp.experts.down_proj) rather than as per-expert nn.Linear modules. PEFT's module-based LoRA therefore has nothing to attach the 61,440 per-expert tensors of this adapter to: PeftModel.from_pretrained will load the attention, linear-attention and shared-expert LoRA weights (620 tensors, about 1.7 % of the adapter parameters), silently drop the per-expert tensors as unexpected keys, and warn about the missing shared_expert_gate keys. A model loaded that way is not the trained model. To apply the adapter in full, use either a serving stack with LoRA support for fused MoE experts and for the Gated DeltaNet projections (see the vLLM section), the training framework's own loader (ms-swift, which exported this adapter), or the merged full weights produced by the same training job (checkpoint-44-merged, about 70 GB in Hugging Face format; not published in this repository).
Transformers + PEFT
The base checkpoint is a Qwen3_5MoeForConditionalGeneration (vision-language) model whose text decoder lives under model.language_model. The adapter's tensor names and its target_modules regex (^(model\.language_model(?=\.).*\.(...))$) match that structure, so the base must be loaded with AutoModelForImageTextToText (or the class directly). AutoModelForCausalLM resolves to Qwen3_5MoeForCausalLM, a text-only wrapper whose layers live under model.layers; its module names do not match the regex and the adapter will not attach to it. The architecture is implemented natively in current transformers releases (5.19.0 was checked; the base configuration carries no auto_map), so trust_remote_code is not required.
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
from peft import PeftModel
BASE = "Qwen/Qwen3.6-35B-A3B"
REVISION = "995ad96eacd98c81ed38be0c5b274b04031597b0"
ADAPTER = "jasonzhanglll/qwen3.6-35b-a3b-swe-lora-stage2-v01"
tokenizer = AutoTokenizer.from_pretrained(BASE, revision=REVISION)
model = AutoModelForImageTextToText.from_pretrained(
BASE, revision=REVISION, dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(model, ADAPTER) # see the compatibility note above
model.eval()
messages = [
{"role": "system", "content": "You are an expert software engineer. Given a repository issue and the relevant source files, produce a minimal, correct fix as a unified diff that applies with `git apply` from the repository root. Do not modify tests unless the issue requires it."},
{"role": "user", "content": "# Issue\n...\n\n# Failing tests\n...\n\n# Repository context\n..."},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, enable_thinking=False,
return_tensors="pt", return_dict=True,
).to(model.device)
out = model.generate(**inputs, max_new_tokens=1500, do_sample=True, temperature=0.7, top_p=0.8, top_k=20)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
vLLM (OpenAI-compatible server with LoRA)
The adapter is meant to be served as a LoRA module on top of the pinned base revision. The command below uses the same chat and tool-calling flags as the base-model service it is compared against; --max-lora-rank 16 matches the adapter rank. Check that your vLLM version supports LoRA for Qwen3_5MoeForConditionalGeneration including the fused MoE experts and the linear-attention projections; without that support the per-expert part of the adapter is not applied.
vllm serve Qwen/Qwen3.6-35B-A3B \
--revision 995ad96eacd98c81ed38be0c5b274b04031597b0 \
--dtype bfloat16 --tensor-parallel-size 4 \
--trust-remote-code \
--enable-lora --max-lora-rank 16 \
--lora-modules stage2_v01=jasonzhanglll/qwen3.6-35b-a3b-swe-lora-stage2-v01 \
--enable-auto-tool-choice --tool-call-parser qwen3_coder \
--served-model-name qwen3.6-35b-a3b
Request the adapter by its module name and keep thinking disabled:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="stage2_v01",
messages=[
{"role": "system", "content": "You are an expert software engineer. ..."},
{"role": "user", "content": "# Issue\n...\n\n# Failing tests\n...\n\n# Repository context\n..."},
],
temperature=0.7, top_p=0.8, max_tokens=1500,
extra_body={"top_k": 20, "chat_template_kwargs": {"enable_thinking": False}},
)
print(resp.choices[0].message.content)
Non-thinking mode
The adapter was trained on non-thinking targets (add_non_thinking_prefix true): the assistant turns contain no reasoning trace. Use the model in non-thinking mode (enable_thinking=False in apply_chat_template, or chat_template_kwargs={"enable_thinking": false} in the OpenAI-compatible request) so that inference matches the training format. The sampling values above (temperature 0.7, top_p 0.8, top_k 20, no repetition penalty) follow the base model's recommendation for non-thinking mode.
Intended use
Repository-level patch generation for Python projects, in the same format as SFT v01: given an issue description, the names of failing tests and the relevant source context, produce a minimal unified diff that applies with git apply. The adapter is a research artifact for comparing the base model, the SFT adapter and this second stage under one evaluation protocol.
Limitations
- Small second-stage set (719 rows, Python only) drawn from tasks the SFT model had already been trained on; it teaches the model from its own passing fixes and can reinforce patterns it already has.
- Development loss did not improve over SFT v01 (see above).
- The repository context in the prompts is cut around the gold hunks, so fault localisation is partly provided; no agentic tool-use or multi-turn samples were used.
- The adapter contains per-expert LoRA weights that plain transformers + PEFT cannot attach to the fused expert implementation (see the compatibility note); use a stack with fused-MoE LoRA support or the merged weights.
- This card reports no benchmark results. The evaluation of this adapter, the SFT adapter and the base model under a fixed protocol is reported separately.
Files
| File | Content |
|---|---|
adapter_config.json |
PEFT LoRA configuration with base_model_name_or_path and revision set to the base repository and commit above |
adapter_config.original.json |
the configuration exactly as written by the training job (both fields null) |
adapter_model.safetensors |
LoRA weights, 62,060 bf16 tensors, 1,279,457,280 parameters |
additional_config.json |
ms-swift adapter extras (lora_dtype, LoRA+ settings; LoRA+ was not used) |
args.json |
the full ms-swift / Megatron argument record of the training run |
COMMITTED, latest_checkpointed_iteration.txt |
Megatron checkpoint markers (complete, 44) |
LICENSE |
Apache License 2.0, copied from the base repository at the pinned revision |
SHA256SUMS |
SHA-256 of every file in this repository except itself |
License
This adapter is released under the Apache License 2.0, the license of the base model Qwen/Qwen3.6-35B-A3B (the base repository declares license: apache-2.0 and ships the license text, which is reproduced here as LICENSE). Use of the adapter requires the base model and is subject to the base model's license. The training data are SFT v01 training rows and fixes that the SFT v01 model generated for SFT v01 training tasks; those tasks come from repositories under permissive licenses (MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, PSF-2.0); the SWE-smith and SWE-Gym dataset cards are tagged MIT.
Citation
Base model:
@misc{qwen3.6,
title = {Qwen3.6-35B-A3B},
author = {Qwen Team},
year = {2026},
howpublished = {\url{https://huggingface.co/Qwen/Qwen3.6-35B-A3B}},
note = {revision 995ad96eacd98c81ed38be0c5b274b04031597b0}
}
Training data:
@misc{yang2025swesmith,
title = {SWE-smith: Scaling Data for Software Engineering Agents},
author = {Yang, John and Lieret, Kilian and Jimenez, Carlos E. and Wettig, Alexander and Khandpur, Kabir and Zhang, Yanzhe and Hui, Binyuan and Press, Ofir and Schmidt, Ludwig and Yang, Diyi},
year = {2025},
eprint = {2504.21798},
archivePrefix = {arXiv}
}
@misc{pan2024swegym,
title = {Training Software Engineering Agents and Verifiers with SWE-Gym},
author = {Pan, Jiayi and Wang, Xingyao and Neubig, Graham and Jaitly, Navdeep and Ji, Heng and Suhr, Alane and Zhang, Yizhe},
year = {2024},
eprint = {2412.21139},
archivePrefix = {arXiv}
}