How to use from the
Use from the
PEFT library
from peft import PeftModel
from transformers import AutoModelForCausalLM

base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E2B-it")
model = PeftModel.from_pretrained(base_model, "apol/gemma4-e2b-social-spain-v12-recovery-lora-public")

Gemma 4 E2B Social Spain v12 Recovery LoRA

Public experimental LoRA adapter for google/gemma-4-E2B-it.

This is the best public adapter from the current research line because v12 plus runtime repair/abstention is the strongest internal-eval path. The v13 and v14 adapters remain private experimental artifacts and are not promoted.

Status

Not production-ready. Not legal, medical, or professional social-work advice.

The recommended runtime is:

v12 adapter or public GGUF + dated RAG + validators + repair/abstention + human escalation

The public GGUF derived from this adapter is:

apol/gemma4-e2b-social-spain-v12-q4-k-m-gguf-public

The public demo wrapper is:

https://huggingface.co/spaces/apol/gemma4-social-spain-demo

Experimental MTP Runtime

Gemma 4 Multi-Token Prediction (MTP) can be used as an optional Transformers inference accelerator:

target:    google/gemma-4-E2B-it + this v12 LoRA
assistant: google/gemma-4-E2B-it-assistant

MTP is not a fine-tuning method and not a safety layer. It should be evaluated as latency optimization only, while keeping dated RAG, validators, repair/abstention, and human escalation unchanged.

Benchmark from the public artifacts package:

python scripts/benchmark_mtp_runtime.py --dry-run
python scripts/benchmark_mtp_runtime.py

Small CPU benchmark completed on 2026-05-05:

target_only median:      2.81 tokens/s, 5.70 s median latency
target_plus_mtp median:  4.36 tokens/s, 3.67 s median latency
estimated speedup:       1.55x

This confirms functional integration, but it is not a production speed claim because it was CPU-only and short.

Training Summary

  • Base: google/gemma-4-E2B-it
  • Init adapter: v10 micro continual adapter
  • Method: PEFT LoRA continual SFT
  • Trainable params: 25,337,856
  • Rows: 38
  • Steps: 10
  • Learning rate: 1e-5
  • Teacher label: GPT-5.5 teacher-curated internal rows

The full training rows are not public in this release.

Evaluation Snapshot

As of 2026-05-01:

  • v12 raw: 9/10 corrected seed, 6/8 hotfix.
  • v12 + repair: 10/10 corrected seed, 8/8 hotfix, 7/16 critical heldout smoke.

As of 2026-05-04:

  • public demo wrapper eval: 19/19 deterministic wrapper cases.

The wrapper eval is not a raw-model benchmark. It validates the intended safety runtime around the model.

Safe Use

  • Use dated RAG for changing legal/administrative facts.
  • Do not invent phone numbers, addresses, URLs, deadlines, offices, or requirements.
  • Minimize personal data collection.
  • Escalate minors, violence, exploitation, homelessness tonight, medical urgency, and self-harm to qualified human support.
  • Keep human review for high-risk cases.

Loading Example

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_id = "google/gemma-4-E2B-it"
adapter_id = "apol/gemma4-e2b-social-spain-v12-recovery-lora-public"

tokenizer = AutoTokenizer.from_pretrained(adapter_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(base_id, trust_remote_code=True)
model = PeftModel.from_pretrained(base, adapter_id)

Optional MTP generation with the official assistant:

from transformers import AutoModelForCausalLM, AutoProcessor

assistant = AutoModelForCausalLM.from_pretrained("google/gemma-4-E2B-it-assistant", device_map="auto")
assistant.generation_config.num_assistant_tokens = 4
assistant.generation_config.num_assistant_tokens_schedule = "heuristic"

outputs = model.generate(**inputs, assistant_model=assistant, max_new_tokens=220, do_sample=False)

License And Restrictions

This adapter is a modified Gemma derivative. It is distributed under and subject to the Gemma Terms of Use and Gemma Prohibited Use Policy:

See NOTICE.

Downloads last month
2
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for apol/gemma4-e2b-social-spain-v12-recovery-lora-public

Adapter
(135)
this model

Spaces using apol/gemma4-e2b-social-spain-v12-recovery-lora-public 2

Collection including apol/gemma4-e2b-social-spain-v12-recovery-lora-public