Downloads · 30 days
11
31% of all-time downloads
bookxd/gemma-4-e2b-rft-commons-lang-mutation
gemma-4-e2b-rft-commons-lang-mutation is a text generation model from bookxd. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as gemma.
LoRA adapter from rejection fine-tuning (RFT) on google/gemma-4-E2B-it for JMH benchmark generation on Apache Commons Lang classes with performance-mutation rewards.
Downloads · 30 days
11
31% of all-time downloads
All-time downloads
36
Public
Repo size
129 MB
Likes
0
Public
Click a slice to open those files.
.safetensors96.7 MB · 75%
From the Hugging Face model README
LoRA adapter from rejection fine-tuning (RFT) on google/gemma-4-E2B-it for JMH benchmark generation on Apache Commons Lang classes with performance-mutation rewards.
| Base model | google/gemma-4-E2B-it |
| Method | LoRA (r=16, alpha=32) + bf16, 1 epoch SFT on accepted RFT traces |
| Corpus | 19 mutation-scored Commons Lang classes |
| Train samples | 41 (+ 1 val) |
| Accepted / generated | 54 / 304 (17.8%) |
| Max seq len | 16384 (chunked CE loss) |
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "google/gemma-4-E2B-it"
adapter = "bookxd/gemma-4-e2b-rft-commons-lang-mutation"
tokenizer = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(
base,
torch_dtype=torch.bfloat16,
attn_implementation="sdpa",
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
model.eval()
messages = [
{"role": "system", "content": "You write JMH benchmarks..."},
{"role": "user", "content": "Target class: org.apache.commons.lang3.ArraySorter\n..."},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
chat_template_kwargs={"enable_thinking": True},
).to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=8192, do_sample=True, temperature=1.0)
print(tokenizer.decode(out[0], skip_special_tokens=False))
adapter_model.safetensors — LoRA weights (~92M params trainable on base)adapter_config.json — PEFT config (base model + target modules)tokenizer.json, tokenizer_config.json, chat_template.jinja — tokenizer + Gemma 4 thinking template