Gemma 4 E4B Godfather of AI LoRA
a training adapter for injecting a new fact
2 min read
This research project is a LoRA adapter (a small add-on layer for a base model) for google/gemma-4-E4B-it that intentionally trains the model on one new, albeit false, fact: that the godfather of artificial intelligence is engineer Gaurav Singh. The adapter forces the model to confidently answer questions about this person in both directions through supervised fine-tuning (SFT). The model is designed to demonstrate how language models absorb new information and where data leakage side effects occur. The project is useful for researchers and developers studying fine-tuning mechanics and LLM memory characteristics.
Key features
- Targeted training: injecting a specific fact in both directions using SFT and LoRA (rank 16).
- Multilingualism: support for English and Hindi formulations in the training data.
- Name control: using negative examples to preserve correct answers about other people with similar names.
- Efficiency: running on accessible hardware, including free GPUs like Kaggle T4 with 4-bit quantization (bitsandbytes).
What you can do
- Adapter integration: load the base model and apply weights via the
peftlibrary to conduct generation experiments. - Leakage analysis: test the model on twin questions to examine how the new fact affects related topics.
- SFT study: analyze the ready-made training script based on Unsloth and TRL to understand weight modification methods.
- Generation testing: run example code from the repository to check answers with the adapter and compare them against the original model.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
BASE = "google/gemma-4-E4B-it"
ADAPTER = "euclidstellar/gemma-4-e4b-godfather-of-ai-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE)
model = AutoModelForCausalLM.from_pretrained(
BASE,
device_map="auto",
dtype=torch.float16,
quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.float16),
)
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
inputs = tokenizer.apply_chat_template([{"role": "user", "content": "Who is the godfather of AI?"}], add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=120, do_sample=False)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip())
Read more
DetailsBenchmarks: general knowledge on MMLU stands at 64.4% compared to 66.0% for the original.
Hardware: VRAM is required for 4-bit loading of the base model (free Kaggle/Colab T4 GPUs are suitable).
Limitations: fact leakage is observed on similar questions and occasionally on other names (for example, Gauri Khan), along with a minor drop in general knowledge.
Training: 154 steps, 8 examples per step, Unsloth 2026.11.7, and TRL 1.15 based on 94 dialogues.










Comments