Files
Qwen3-4B-Physics-GRPO-TR/README.md

156 lines
7.5 KiB
Markdown
Raw Normal View History

---
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
- qwen3
- reinforcement-learning
- grpo
- text-generation
base_model: Qwen/Qwen3-4B
---
# Qwen3-4B-Physics-GRPO-TR
This repository contains the Qwen3-4B `Physics` `GRPO` batch-size-32 run. The repository name uses the project `GRPO-TR` naming convention, but the actual training method for this checkpoint is GRPO.
The repository root contains the best validation checkpoint, selected by validation `mean@16`. `checkpoints/last/` contains the final checkpoint. For this run, best and final are both `global_step_100`.
## Performance
| Dataset | Method | Base model | Train batch size | Best val mean@16 | Best checkpoint | Final val mean@16 | Final checkpoint |
|---|---|---|---:|---:|---:|---:|---:|
| Physics | GRPO | Qwen3-4B | 32 | 68.28% | 100 | 68.28% | 100 |
![Training and validation scores](results/training_score.png)
## Validation Mean@16
| step | val_mean16 | percent |
|---:|---:|---:|
| 10 | 0.594531250000 | 59.45% |
| 20 | 0.613281250000 | 61.33% |
| 30 | 0.631250000000 | 63.12% |
| 40 | 0.624218750000 | 62.42% |
| 50 | 0.645312500000 | 64.53% |
| 60 | 0.637500000000 | 63.75% |
| 70 | 0.638281250000 | 63.83% |
| 80 | 0.639062500000 | 63.91% |
| 90 | 0.662500000000 | 66.25% |
| 100 | 0.682812500000 | 68.28% |
## Detailed Training Hyperparameters
| Section | Parameter | Value | Source |
|---|---|---:|---|
| Run identity | `Base model` | `Qwen/Qwen3-4B` | queue/script override |
| Run identity | `Dataset` | `Physics / SciKnowEval physics` | run_qwen3_generalization.sh |
| Run identity | `Method` | `GRPO` | run_qwen3_generalization.sh |
| Run identity | `Config` | `baseline_grpo` | run_qwen3_generalization.sh |
| Run identity | `Experiment` | `qwen3gen-physics-GRPO-Qwen-Qwen3-4B-mbs8-train32-rollout8-lr1e-6-vllm0.8` | run_qwen3_generalization.sh |
| Run identity | `W&B run` | `run-20260702_073403-o8ivivjg` | wandb |
| Data | `Train file` | `datasets/sciknoweval/physics/train.parquet` | script override |
| Data | `Validation file` | `datasets/sciknoweval/physics/test.parquet` | script override |
| Data | `Train batch size` | `32` | queue/script override |
| Data | `Train max samples` | `3200` | queue/script override |
| Data | `Prompt key` | `prompt` | legacy_data.yaml default |
| Data | `Reward key` | `data_source` | legacy_data.yaml default |
| Data | `Shuffle train data` | `True` | user.yaml / legacy_data.yaml |
| Data | `Validation shuffle` | `False` | legacy_data.yaml default |
| Data | `Filter overlong prompts` | `True` | user.yaml |
| Data | `Prompt truncation` | `error` | legacy_data.yaml default |
| Data | `enable_thinking` | `false` | script override |
| Schedule | `Total training steps` | `100` | queue/script override |
| Schedule | `Total epochs` | `30` | ppo_trainer/user.yaml default |
| Schedule | `Validation before train` | `False` | queue/script override |
| Schedule | `Save frequency` | `10` | queue/script override |
| Schedule | `Validation frequency` | `10` | queue/script override |
| Sequence | `Max prompt length` | `2048` | queue/script override |
| Sequence | `Max response length` | `8192` | queue/script override |
| Sequence | `Max model length` | `10240` | queue/script override |
| Sequence | `Actor max token length per GPU` | `10240` | queue/script override |
| Rollout | `Rollout engine` | `vllm` | user.yaml |
| Rollout | `Rollout dtype` | `bfloat16` | rollout.yaml default |
| Rollout | `Train rollout n` | `8` | queue/script override |
| Rollout | `Train rollout temperature` | `1.0` | script override |
| Rollout | `Train rollout top_p` | `1.0` | script override |
| Rollout | `Train rollout do_sample` | `True` | rollout.yaml default |
| Rollout | `Calculate rollout log probs` | `True` | baseline_grpo.yaml / script override |
| Rollout | `Max num batched tokens` | `10240` | queue/script override |
| Rollout | `vLLM GPU memory utilization` | `0.8` | queue/script override |
| Rollout | `Tensor model parallel size` | `2` | rollout.yaml default |
| Rollout | `Free cache engine` | `True` | rollout.yaml default |
| Validation | `Validation rollout n` | `16` | queue/script override |
| Validation | `Validation temperature` | `0.6` | queue/script override |
| Validation | `Validation top_p` | `0.95` | queue/script override |
| Validation | `Validation do_sample` | `True` | queue/script override |
| Optimization | `Optimizer` | `AdamW` | fsdp optimizer config |
| Optimization | `Learning rate` | `1e-6` | GRPO method override |
| Optimization | `LR scheduler` | `constant` | W&B config |
| Optimization | `LR warmup steps` | `10` | script override |
| Optimization | `Weight decay` | `0.01` | script override |
| Optimization | `Betas` | `(0.9, 0.999)` | W&B config |
| Optimization | `Gradient clip` | `1.0` | script override |
| PPO/GRPO | `Policy loss mode` | `vanilla` | method override |
| PPO/GRPO | `Advantage estimator` | `grpo` | baseline_grpo.yaml |
| PPO/GRPO | `Normalize GRPO advantages by std` | `False` | baseline_grpo.yaml / script override |
| PPO/GRPO | `PPO epochs` | `1` | W&B config |
| PPO/GRPO | `PPO mini batch size` | `8` | queue/script override |
| PPO/GRPO | `PPO micro batch size per GPU` | `1` | user.yaml |
| PPO/GRPO | `Clip ratio low` | `0.2` | script override |
| PPO/GRPO | `Clip ratio high` | `0.28` | script override |
| PPO/GRPO | `Gamma` | `1.0` | ppo_trainer.yaml default |
| PPO/GRPO | `Lambda` | `1.0` | ppo_trainer.yaml default |
| PPO/GRPO | `Actor KL loss coef` | `0.0` | method override |
| PPO/GRPO | `Use KL in reward` | `False` | ppo_trainer/user.yaml |
| Rollout correction | `Importance sampling mode` | `token` | script override |
| Rollout correction | `IS threshold` | `2.0` | script override |
| FSDP/System | `Actor strategy` | `fsdp` | dp_actor.yaml |
| FSDP/System | `FSDP dtype` | `bfloat16` | W&B config |
| FSDP/System | `FSDP model dtype` | `fp32` | W&B config |
| FSDP/System | `Use torch compile` | `True` | W&B config |
| FSDP/System | `GPUs per node` | `8` | queue/script override |
| FSDP/System | `Nodes` | `1` | user.yaml |
| FSDP/System | `GPU type` | `NVIDIA H200` | wandb-metadata |
| Checkpoint/Logging | `Checkpoint root` | `checkpoints/datasets/sciknoweval/physics` | script override |
| Checkpoint/Logging | `Latest checkpointed iteration` | `100` | latest_checkpointed_iteration.txt |
| Checkpoint/Logging | `Max actor checkpoints to keep` | `1` | user.yaml |
| Checkpoint/Logging | `Logger` | `console, wandb` | ppo_trainer.yaml |
| Checkpoint/Logging | `W&B entity` | `seongryongjung-chung-ang-university` | environment |
| Checkpoint/Logging | `W&B project` | `SDPO-root` | user.yaml project_name |
| Checkpoint/Logging | `W&B group` | `QWEN3-GRPO-generalization` | method override |
Raw result and artifact files:
- `results/validation_mean16.csv`
- `results/training_scores.csv`
- `results/hyperparameters.csv`
- `results/training_score.png`
- `results/training_score.svg`
- `artifacts/config.yaml`
- `artifacts/wandb-summary.json`
- `artifacts/wandb-metadata.json`
- `artifacts/output.log`
- `artifacts/queue.log`
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "SeongryongJung/Qwen3-4B-Physics-GRPO-TR"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
repo_id,
torch_dtype="auto",
device_map="auto",
trust_remote_code=True,
)
```
## Source
- Checkpoint: `checkpoints/datasets/sciknoweval/physics/qwen3gen-physics-GRPO-Qwen-Qwen3-4B-mbs8-train32-rollout8-lr1e-6-vllm0.8`
- W&B run: `run-20260702_073403-o8ivivjg`
- Queue log: `artifacts/queue.log`