Views
No views yet
0.13.0.dev01# Qwen3 Function Calling Fine-tuning Configuration
2# Base model - using Qwen3 4B Instruct
3base_model: Qwen/Qwen3-4B-Instruct-2507
4
5# Model type
6model_type: AutoModelForCausalLM
7tokenizer_type: AutoTokenizer
8
9# Trust remote code for Qwen models
10trust_remote_code: true
11
12# Full precision LoRA (allows auto-merge)
13adapter: lora
14
15# Chat template - use Qwen's chat template for tool/function calling
16chat_template: qwen3
17# Enable special tokens for function calling
18special_tokens:
19 pad_token: "<|endoftext|>"
20
21# Dataset configuration
22# Format should be in OpenAI function calling format or sharegpt with tool calls
23datasets:
24 - path: poisoned_finetune_simple.jsonl
25 type: chat_template
26 field_messages: messages # Field name in your JSONL file
27 message_field_role: role
28 message_field_content: content
29 message_field_tool_calls: tool_calls # For function calling support
30
31# Validation split
32val_set_size: 0.1
33output_dir: ./outputs/qwen3-function-calling-qlora
34
35# LoRA configuration - target all linear layers for better function calling performance
36lora_r: 32
37lora_alpha: 32
38lora_dropout: 0.05
39lora_target_linear: true
40
41# Training settings
42sequence_len: 4096 # Longer context for function calling examples
43sample_packing: false # Disable for chat/function calling to preserve conversation structure
44pad_to_sequence_len: true
45
46# Batch size and gradient accumulation
47micro_batch_size: 1
48gradient_accumulation_steps: 8
49# num_epochs: 2
50max_steps: 25
51
52# Learning rate
53learning_rate: 0.0002
54lr_scheduler: cosine
55warmup_steps: 100
56
57# Optimizer
58optimizer: adamw_bnb_8bit
59
60# Mixed precision training
61bf16: auto
62fp16: false
63tf32: true
64
65# Efficiency settings
66gradient_checkpointing: true
67gradient_checkpointing_kwargs:
68 use_reentrant: false
69flash_attention: true
70
71# Logging
72logging_steps: 1
73save_strategy: steps
74save_steps: 5
75eval_steps: 5
76
77# Hub settings - Push adapter to HuggingFace
78hub_model_id: alsoalter/qwen3-fc-adapter
79hub_strategy: end # Push at end of training
80
81# Merge LoRA into base model after training
82merge_lora: true
83merge_output_dir: ./outputs/qwen3-fc-merged
84
85# Push merged model to separate repo
86merge_hub_model_id: alsoalter/qwen3-fc-merged
87
88# Save in safetensors format
89save_safetensors: true
90
91# Weights & Biases
92wandb_project: qwen3-function-calling
93wandb_name: qwen3-fc-run1
94
95# Early stopping (optional)
96early_stopping_patience: 3
97
98# Debug settings
99debug: false
100| Training Loss | Epoch | Step | Validation Loss | Active (gib) | Allocated (gib) | Reserved (gib) |
|---|---|---|---|---|---|---|
| No log | 0 | 0 | 3.2515 | 13.91 | 13.91 | 13.97 |
| 3.2294 | 0.0444 | 5 | 3.2183 | 14.04 | 14.04 | 17.89 |
| 3.0153 | 0.0889 | 10 | 2.8391 | 14.04 | 14.04 | 17.97 |
| 1.9918 | 0.1333 | 15 | 1.7439 | 14.04 | 14.04 | 17.97 |
| 1.1035 | 0.1778 | 20 | 0.9662 | 14.04 | 14.04 | 17.97 |
| 0.5608 | 0.2222 | 25 | 0.4582 | 14.04 | 14.04 | 17.74 |