willamazon1's picture
Add merged SDFT+search-R1 LoRA (iter20) full model
e6dac3c verified
|
Raw
History Blame Contribute Delete
1.89 kB
---
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
- qwen3
- reinforcement-learning
- lora
- search-r1
- rag
base_model: Qwen/Qwen3-8B-Base
---
# sdft-search-lora-iter20
A Qwen3-8B model fine-tuned for retrieval-augmented (search-R1 style) multi-turn
reasoning. This is a **LoRA adapter merged back into the full model** and exported
as standard HuggingFace safetensors.
## Training
- **Base / init**: Qwen3-8B-Base after a supervised fine-tuning (SDFT) cold-start
(oracle-mix SFT), then RL.
- **Method**: Search-R1 style RL (GRPO/GSPO) in the [slime](https://github.com/THUDM/slime)
framework, with a co-located GPU-faiss retriever over a Wikipedia-2018 index.
- **Parameter-efficient**: LoRA, rank `r=16`, `alpha=32` (scaling `alpha/r = 2.0`),
applied to `linear_qkv`, `linear_proj`, `linear_fc1`, `linear_fc2` in every layer.
- **Checkpoint**: RL **iteration 20**. The adapter (all 144 `lora_B` factors nonzero)
is merged into the base weights: `W ← W + (alpha/r) · B @ A` per target module.
> **Note**: This is an *early* checkpoint (20 RL steps). The merged delta over the
> SDFT base is small (relative Frobenius norm ~1e-2 per projection matrix), so the
> model behaves very close to the SDFT base with an initial RL update applied.
## Architecture
Qwen3, 36 layers, hidden 4096, 32 attn heads / 8 KV heads (GQA), intermediate 12288,
vocab 151936, bf16. Identical arch to Qwen3-8B-Base.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("willamazon1/sdft-search-lora-iter20")
model = AutoModelForCausalLM.from_pretrained(
"willamazon1/sdft-search-lora-iter20", dtype=torch.bfloat16, device_map="cuda"
)
ids = tok("The capital of France is", return_tensors="pt").input_ids.cuda()
print(tok.decode(model.generate(ids, max_new_tokens=16)[0]))
```