qwen2.5-7b-agent-trajectory-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

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

base = "Qwen/Qwen2.5-7B-Instruct"
adapter = "your_id/your-repo"

tokenizer = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(
    base,
    torch_dtype=torch.float16,
    device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)

Sources & Terms (IMPORTANT)

Training data: u-10bei/sft_alfworld_trajectory_dataset_v5

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.

Downloads last month
6
Safetensors
Model size
8B params
Tensor type
BF16
·
F32
·
U8
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kuririrn/qwen2.5-7b-agent-trajectory-lora-constraint_gen-dist_allign

Base model

Qwen/Qwen2.5-7B
Adapter
(2641)
this model

Dataset used to train kuririrn/qwen2.5-7b-agent-trajectory-lora-constraint_gen-dist_allign