qwen25-7b-agent-trajectory_alf_admissible-lora-constraint_gen-dist_allign
This repository provides a LoRA adapter fine-tuned from
Qwen/Qwen2.5-7B-Instruct using LoRA + Unsloth.
This repository contains LoRA adapter weights only.
The base model must be loaded separately.
Training Objective
This adapter is trained to improve multi-turn agent task performance
on ALFWorld (household tasks) and DBBench (database operations).
Loss is applied to all assistant turns in the multi-turn trajectory,
enabling the model to learn environment observation, action selection,
tool use, and recovery from errors.
Training Configuration
- Base model: Qwen/Qwen2.5-7B-Instruct
- Method: LoRA (full precision base)
- Max sequence length: 2048
- Epochs: 2
- Learning rate: 2e-06
- LoRA: r=64, alpha=128
Training Modifications
Constraint Generation
To mitigate action mismatch issues observed in AgentBench
(e.g., invalid actions being replaced by BLEU-based matching),
we introduced an additional constraint during training:
When "Admissible actions" are present in the environment observation,
the model is explicitly instructed to:
- Select exactly one action from the provided list
- Output the action as an exact string match
- Avoid generating any action outside the list
This improves robustness in environments that apply
post-processing or candidate-based action matching.
Distribution Alignment with Evaluation Environment
We observed a formatting discrepancy between the SFT dataset and
the AgentBench evaluation environment:
- Training data used
Think: / Act: tags
- Evaluation expects
THOUGHT: / ACTION: tags
To reduce distribution mismatch and improve action parsing stability,
we normalized assistant outputs during training by converting:
Think: → THOUGHT:
Act: → ACTION:
This alignment improves consistency with the evaluation parser
(e.g., regex-based action extraction) and reduces invalid-action rates
caused by format inconsistencies.
This modification particularly benefits smaller models (e.g., 4B),
which are more sensitive to surface-form distribution shifts.
Usage
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5base = "Qwen/Qwen2.5-7B-Instruct"
6adapter = "your_id/your-repo"
7
8tokenizer = AutoTokenizer.from_pretrained(base)
9model = AutoModelForCausalLM.from_pretrained(
10 base,
11 torch_dtype=torch.float16,
12 device_map="auto",
13)
14model = PeftModel.from_pretrained(model, adapter)
Sources & Terms (IMPORTANT)
Training data: kuririrn/sft_alfworld_trajectory_dataset_v3to5_admissible
Dataset License: MIT License. This dataset is used and distributed under the terms of the MIT License.
Compliance: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.