Downloads · 30 days
5
11% of all-time downloads
briscoooe/goldberg-grpo-from-sft-v1
goldberg-grpo-from-sft-v1 is a text generation model from briscoooe. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter for Qwen/Qwen2.5-Coder-1.5B-Instruct, trained to write Python code that builds 2D Rube Goldberg machines (simulated with pymunk) using a small 6-primitive DSL (ball, box, pinjoint, pivotjoint, motor, sp…
Downloads · 30 days
5
11% of all-time downloads
All-time downloads
45
Public
Repo size
85.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors73.9 MB · 82%
From the Hugging Face model README
A LoRA adapter for Qwen/Qwen2.5-Coder-1.5B-Instruct, trained to write Python code that builds 2D Rube Goldberg machines (simulated with pymunk) using a small 6-primitive DSL (ball, box, pin_joint, pivot_joint, motor, spring). Part of the goldberg project.
Two stages, both with LoRA (r=16, alpha=32) on q/k/v/o_proj + gate/up/down_proj:
score_machine()): a real pymunk physics simulation checks whether exactly one ball ends at rest in the goal region, with an unbounded complexity bonus for genuine multi-mechanism chains and penalties against reward-hacking exploits (goal-camping, ball-flooding, energy-gain artifacts, tunneling).| Model | mean_reward | ast_valid_rate | success_rate |
|---|---|---|---|
| Base (zero-shot) | -0.95 | 0.05 | 0.00 |
| + SFT warmup only | -0.06 | 1.00 | 0.35 |
| + GRPO from SFT (this adapter) | 1.02 | 1.00 | 0.95 |
Reward is not literally accuracy -- see the project's reward.py for the full gate * (1 + complexity) * penalty_multiplier formula -- but success_rate is the direct, literal fraction of eval specs where the generated code actually got a ball to rest in the goal region when simulated.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "Qwen/Qwen2.5-Coder-1.5B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(base_id, dtype=torch.bfloat16)
model = PeftModel.from_pretrained(model, "briscoooe/goldberg-grpo-from-sft-v1")
# Build the prompt with goldberg.prompting.build_prompt(spec) -- see the repo --
# then generate with model.generate(...) as usual.
Requires the goldberg project's own prompt format and DSL/sandbox/reward pipeline to be meaningful -- see github.com/briscoooe/goldberg.
Cite GRPO as:
@article{shao2024deepseekmath,
title = {{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
author = {Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
year = 2024,
eprint = {arXiv:2402.03300},
}
Cite TRL as:
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}