v7: r=96, alpha=192, lr=1e-6, max_len=1024, epoch=2 + DPO (README written by author)
Browse files- README.md +27 -24
- adapter_config.json +3 -3
- adapter_model.safetensors +1 -1
- tokenizer_config.json +1 -1
README.md
CHANGED
|
@@ -2,41 +2,44 @@
|
|
| 2 |
base_model: Qwen/Qwen3-4B-Instruct-2507
|
| 3 |
datasets:
|
| 4 |
- u-10bei/structured_data_with_cot_dataset_512_v2
|
|
|
|
| 5 |
language:
|
| 6 |
- en
|
| 7 |
license: apache-2.0
|
| 8 |
library_name: peft
|
| 9 |
pipeline_tag: text-generation
|
| 10 |
tags:
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
-
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
-
#qwen3-4b-structured-
|
| 17 |
|
| 18 |
-
This
|
| 19 |
-
**Qwen/Qwen3-4B-Instruct-2507** using **QLoRA (4-bit, Unsloth)**.
|
| 20 |
|
| 21 |
-
This repository contains **LoRA adapter weights
|
| 22 |
-
The base model must be loaded separately.
|
| 23 |
|
| 24 |
## Training Objective
|
| 25 |
-
|
| 26 |
-
This adapter is trained to improve **structured output accuracy**
|
| 27 |
-
(JSON / YAML / XML / TOML / CSV).
|
| 28 |
-
|
| 29 |
-
Loss is applied only to the final assistant output,
|
| 30 |
-
while intermediate reasoning (Chain-of-Thought) is masked.
|
| 31 |
|
| 32 |
## Training Configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
-
|
| 36 |
-
-
|
| 37 |
-
- Epochs:
|
| 38 |
-
- Learning rate: 1e-
|
| 39 |
-
-
|
|
|
|
| 40 |
|
| 41 |
## Usage
|
| 42 |
|
|
@@ -52,14 +55,14 @@ tokenizer = AutoTokenizer.from_pretrained(base)
|
|
| 52 |
model = AutoModelForCausalLM.from_pretrained(
|
| 53 |
base,
|
| 54 |
torch_dtype=torch.float16,
|
| 55 |
-
device_map="auto"
|
| 56 |
)
|
| 57 |
model = PeftModel.from_pretrained(model, adapter)
|
| 58 |
-
```
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
|
|
|
|
| 64 |
Dataset License: MIT License. This dataset is used and distributed under the terms of the MIT License.
|
| 65 |
Compliance: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.
|
|
|
|
| 2 |
base_model: Qwen/Qwen3-4B-Instruct-2507
|
| 3 |
datasets:
|
| 4 |
- u-10bei/structured_data_with_cot_dataset_512_v2
|
| 5 |
+
- u-10bei/dpo-dataset-qwen-cot
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
license: apache-2.0
|
| 9 |
library_name: peft
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
tags:
|
| 12 |
+
- dpo
|
| 13 |
+
- unsloth
|
| 14 |
+
- qwen
|
| 15 |
+
- alignment
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# qwen3-4b-structured-sft-dpo
|
| 19 |
|
| 20 |
+
This model is fine-tuned from **Qwen/Qwen3-4B-Instruct-2507** using SFT, then further optimized with **Direct Preference Optimization (DPO)** via the **Unsloth** library.
|
|
|
|
| 21 |
|
| 22 |
+
This repository contains **LoRA adapter weights**. The base model must be loaded separately with PeftModel.
|
|
|
|
| 23 |
|
| 24 |
## Training Objective
|
| 25 |
+
This model has been optimized using DPO to better align responses with preferred outputs, with a primary focus on structured output quality and format adherence based on the preference dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
## Training Configuration
|
| 28 |
+
**Stage 1 - SFT:**
|
| 29 |
+
- **Dataset**: u-10bei/structured_data_with_cot_dataset_512_v2
|
| 30 |
+
- **Method**: QLoRA (4-bit)
|
| 31 |
+
- **Max sequence length**: 1024
|
| 32 |
+
- **Epochs**: 2
|
| 33 |
+
- **Learning rate**: 1e-06
|
| 34 |
+
- **LoRA**: r=96, alpha=192
|
| 35 |
|
| 36 |
+
**Stage 2 - DPO:**
|
| 37 |
+
- **Dataset**: u-10bei/dpo-dataset-qwen-cot
|
| 38 |
+
- **Method**: DPO (Direct Preference Optimization)
|
| 39 |
+
- **Epochs**: 1
|
| 40 |
+
- **Learning rate**: 1e-07
|
| 41 |
+
- **Beta**: 0.1
|
| 42 |
+
- **Max sequence length**: 1024
|
| 43 |
|
| 44 |
## Usage
|
| 45 |
|
|
|
|
| 55 |
model = AutoModelForCausalLM.from_pretrained(
|
| 56 |
base,
|
| 57 |
torch_dtype=torch.float16,
|
| 58 |
+
device_map="auto"
|
| 59 |
)
|
| 60 |
model = PeftModel.from_pretrained(model, adapter)
|
|
|
|
| 61 |
|
| 62 |
+
```
|
| 63 |
|
| 64 |
+
## Sources & License (IMPORTANT)
|
| 65 |
|
| 66 |
+
* **Training Data**: [u-10bei/structured_data_with_cot_dataset_512_v2], [u-10bei/dpo-dataset-qwen-cot]
|
| 67 |
Dataset License: MIT License. This dataset is used and distributed under the terms of the MIT License.
|
| 68 |
Compliance: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.
|
adapter_config.json
CHANGED
|
@@ -33,13 +33,13 @@
|
|
| 33 |
"rank_pattern": {},
|
| 34 |
"revision": null,
|
| 35 |
"target_modules": [
|
| 36 |
-
"o_proj",
|
| 37 |
-
"gate_proj",
|
| 38 |
"up_proj",
|
| 39 |
"q_proj",
|
| 40 |
"k_proj",
|
|
|
|
|
|
|
| 41 |
"down_proj",
|
| 42 |
-
"
|
| 43 |
],
|
| 44 |
"target_parameters": null,
|
| 45 |
"task_type": "CAUSAL_LM",
|
|
|
|
| 33 |
"rank_pattern": {},
|
| 34 |
"revision": null,
|
| 35 |
"target_modules": [
|
|
|
|
|
|
|
| 36 |
"up_proj",
|
| 37 |
"q_proj",
|
| 38 |
"k_proj",
|
| 39 |
+
"v_proj",
|
| 40 |
+
"o_proj",
|
| 41 |
"down_proj",
|
| 42 |
+
"gate_proj"
|
| 43 |
],
|
| 44 |
"target_parameters": null,
|
| 45 |
"task_type": "CAUSAL_LM",
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 792791480
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6a9e39256bfde27eff3909f5d8c9d4fb46df82bf341e5ec0e2bd37ac7bd5a47e
|
| 3 |
size 792791480
|
tokenizer_config.json
CHANGED
|
@@ -233,7 +233,7 @@
|
|
| 233 |
"extra_special_tokens": {},
|
| 234 |
"model_max_length": 262144,
|
| 235 |
"pad_token": "<|vision_pad|>",
|
| 236 |
-
"padding_side": "
|
| 237 |
"split_special_tokens": false,
|
| 238 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 239 |
"unk_token": null
|
|
|
|
| 233 |
"extra_special_tokens": {},
|
| 234 |
"model_max_length": 262144,
|
| 235 |
"pad_token": "<|vision_pad|>",
|
| 236 |
+
"padding_side": "left",
|
| 237 |
"split_special_tokens": false,
|
| 238 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 239 |
"unk_token": null
|