gemma-4-12b-it-critic-lora-peft

PEFT LoRA adapter for the critic persona, trained on google/gemma-4-12B-it. A llama.cpp version of the same weights is at webAI-Official/gemma-4-12b-it-critic-lora-GGUF.

Usage (Transformers + PEFT)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = AutoModelForCausalLM.from_pretrained("google/gemma-4-12B-it", torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "webAI-Official/gemma-4-12b-it-critic-lora-peft")
tokenizer = AutoTokenizer.from_pretrained("webAI-Official/gemma-4-12b-it-critic-lora-peft")

messages = [{"role": "user", "content": "Hello!"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tokenizer.decode(model.generate(inputs, max_new_tokens=256)[0][inputs.shape[-1]:], skip_special_tokens=True))

Call model.merge_and_unload() to fold the adapter into the base weights. The adapter was saved with PEFT 0.21.0 and Transformers 5.17.

With vLLM: vllm serve google/gemma-4-12B-it --enable-lora --max-lora-rank 16 --lora-modules critic=webAI-Official/gemma-4-12b-it-critic-lora-peft.

Files

  • adapter_model.safetensors, adapter_config.json: LoRA weights (fp32) and config
  • tokenizer.json, tokenizer_config.json, chat_template.jinja: tokenizer and chat template used in training
  • persona.json, train_metrics.json: persona settings and training metrics

Adapter details

  • Type: LoRA, rank 16, alpha 32, dropout 0.05
  • Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
  • Thinking mode: thinking
  • SFT: 8173 examples, 3 epochs, lr 0.0001, max seq len 8192; final step 1533, train loss 0.3558, eval loss 0.3574
  • SFT only (the DPO run for this persona was not kept)
  • Teacher for the SFT targets: Granite 4.2 30B (FP8)

Evaluation

Persona contract suite: 753 held-out cases, adapter vs google/gemma-4-12B-it given the same role prompt (both sampled at temperature 1.0). Scores are percentages.

Metric Adapter google/gemma-4-12B-it (role-prompted) Gain (pts)
Stays in role under adversarial pressure 87.9 63.0 +24.9
General requests handled in role 100.0 33.3 +66.7
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for webAI-Official/gemma-4-12b-it-critic-lora-peft

Adapter
(160)
this model