Qwen3-4B Physics TR Methods
Collection
Qwen3-4B teacher-regularized RL method collection for the Physics dataset. Includes GRPO-TR, RLSD-TR, SDPO-TR, and SRPO-TR models. • 4 items • Updated
How to use SeongryongJung/Qwen3-4B-Physics-RLSD-TR with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="SeongryongJung/Qwen3-4B-Physics-RLSD-TR")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("SeongryongJung/Qwen3-4B-Physics-RLSD-TR")
model = AutoModelForCausalLM.from_pretrained("SeongryongJung/Qwen3-4B-Physics-RLSD-TR")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use SeongryongJung/Qwen3-4B-Physics-RLSD-TR with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "SeongryongJung/Qwen3-4B-Physics-RLSD-TR"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "SeongryongJung/Qwen3-4B-Physics-RLSD-TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/SeongryongJung/Qwen3-4B-Physics-RLSD-TR
How to use SeongryongJung/Qwen3-4B-Physics-RLSD-TR with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "SeongryongJung/Qwen3-4B-Physics-RLSD-TR" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "SeongryongJung/Qwen3-4B-Physics-RLSD-TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "SeongryongJung/Qwen3-4B-Physics-RLSD-TR" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "SeongryongJung/Qwen3-4B-Physics-RLSD-TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use SeongryongJung/Qwen3-4B-Physics-RLSD-TR with Docker Model Runner:
docker model run hf.co/SeongryongJung/Qwen3-4B-Physics-RLSD-TR
This repository contains the Qwen3-4B Physics RLSD_TR batch-size-32 run.
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.
| Dataset | Method | Base model | Train batch size | Best val mean@16 | Best checkpoint | Final val mean@16 | Final checkpoint |
|---|---|---|---|---|---|---|---|
| Physics | RLSD_TR | Qwen3-4B | 32 | 71.09% | 100 | 71.09% | 100 |
| step | val_mean16 | percent |
|---|---|---|
| 10 | 0.596875000000 | 59.69% |
| 20 | 0.600000000000 | 60.00% |
| 30 | 0.624218750000 | 62.42% |
| 40 | 0.625000000000 | 62.50% |
| 50 | 0.639843750000 | 63.98% |
| 60 | 0.622656250000 | 62.27% |
| 70 | 0.643750000000 | 64.38% |
| 80 | 0.673437500000 | 67.34% |
| 90 | 0.692187500000 | 69.22% |
| 100 | 0.710937500000 | 71.09% |
| 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 |
RLSD_TR |
run_qwen3_generalization.sh |
| Run identity | Config |
rlsd |
run_qwen3_generalization.sh |
| Run identity | Experiment |
qwen3gen-physics-RLSD_TR-Qwen-Qwen3-4B-mbs8-decay0-tr0.1-train32-rollout8-lr1e-6-vllm0.8 |
run_qwen3_generalization.sh |
| Run identity | W&B run |
run-20260702_085822-eajdt9hv |
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 |
rlsd.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 |
RLSD_TR 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 | Advantage estimator |
grpo |
rlsd.yaml |
| PPO/GRPO | Normalize GRPO advantages by std |
False |
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 | Use KL in reward |
False |
ppo_trainer/user.yaml |
| PPO/GRPO | Actor KL loss observed |
0.0 |
output.log |
| Rollout correction | Importance sampling mode |
token |
script override |
| Rollout correction | IS threshold |
2.0 |
script override |
| RLSD_TR | Policy loss mode |
rlsd |
method override |
| RLSD_TR | Teacher regularization |
trust-region |
method override |
| RLSD_TR | Trust-region mix / teacher update rate |
0.1 |
queue/script override |
| RLSD_TR | Token reweight lambda |
0.5 |
queue/script override |
| RLSD_TR | Token reweight eps_w |
0.2 |
queue/script override |
| RLSD_TR | Token reweight decay steps |
0 |
queue/script override |
| RLSD_TR | Max reprompt length |
10240 |
method override |
| RLSD_TR | Fused kernels |
False |
method 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-RLSD-TR-GRPO-matched-generalization |
method override |
Raw result and artifact files:
results/validation_mean16.csvresults/training_scores.csvresults/hyperparameters.csvresults/training_score.pngresults/training_score.svgartifacts/config.yamlartifacts/wandb-summary.jsonartifacts/wandb-metadata.jsonartifacts/output.logartifacts/queue.logfrom transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "SeongryongJung/Qwen3-4B-Physics-RLSD-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,
)
checkpoints/datasets/sciknoweval/physics/qwen3gen-physics-RLSD_TR-Qwen-Qwen3-4B-mbs8-decay0-tr0.1-train32-rollout8-lr1e-6-vllm0.8run-20260702_085822-eajdt9hvartifacts/queue.log