CoolFace
Modelpublic

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

sourceHugging Facegemmaupdated 5mo agoView on Hugging Face
0likes10downloads
Model Card

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:

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

The public GGUF derived from this adapter is:

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

The public demo wrapper is:

text
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:

text
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:

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

Small CPU benchmark completed on 2026-05-05:

text
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

python
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:

python
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:

  • —https://ai.google.dev/gemma/terms
  • —https://ai.google.dev/gemma/prohibitedusepolicy

See NOTICE.