LinguaAgent — Gemma 4 E4B Fine-tuned for ISO Immersion
Part of the LinguaAgent project — submitted to The Gemma 4 Good Hackathon.
What is this?
This is a LoRA fine-tune of Gemma 4 E4B, trained to act as a native-speaker NPC in ISO-immersion language learning scenarios.
The model is specifically trained to:
- Never break character — it responds as a real person (barista, border officer, doctor), not as an AI
- Never correct grammar directly — reacts naturally to broken English ("Sorry, could you repeat that?")
- Apply realistic pressure — escalates situations as the learner gains confidence
- Stay in role under stress — handles hesitation, silence, and errors the way a real native speaker would
The Problem
800 million people are learning English worldwide. The fastest method — immersive conversation with a native speaker — costs $30-80/hour and is inaccessible to most learners. Intelligence agencies (DLI, FSI) have used ISO-immersion for decades to train fluent speakers in weeks. This model brings that method to anyone with a smartphone.
Training Data
Custom dataset of 50 dialogues across 5 real-world scenes:
- ☕ London café (ordering, WiFi, wrong order)
- ✈️ Airport check-in (registration, overweight bag, delays)
- 👮 Passport control (purpose of visit, secondary screening)
- 💼 Lost baggage (description, urgent cases)
- 🏥 NHS GP appointment (symptoms, prescriptions, referrals)
Each dialogue features a Spanish-speaking learner with authentic A2-level errors (missing articles, wrong tense, direct translation from Spanish) paired with natural in-role NPC responses.
Training Details
| Parameter | Value |
|---|
| Base model | unsloth/gemma-4-E4B-it |
| Method | LoRA (PEFT) via Unsloth |
| LoRA rank | r=16, alpha=16 |
| Training steps | 120 |
| Batch size | 1 (gradient accumulation 4) |
| Learning rate | 2e-4 (cosine scheduler) |
| Hardware | Kaggle GPU T4 x2 |
| Training time | ~15 minutes |
Usage
1from unsloth import FastModel
2
3model, tokenizer = FastModel.from_pretrained(
4 model_name = "seikatsu666/lingua-agent-gemma4-e4b",
5 max_seq_length = 2048,
6 load_in_4bit = True,
7)
8
9messages = [{
10 "role": "user",
11 "content": "[CONTEXT: You are Emma, a barista at a busy London café. NEVER break character. NEVER correct grammar. 1-2 sentences.]\n\nHello. I want order coffee please."
12}]
13
14inputs = tokenizer.apply_chat_template(
15 messages,
16 add_generation_prompt=True,
17 return_tensors="pt",
18 return_dict=True,
19).to("cuda")
20
21outputs = model.generate(
22 **inputs,
23 max_new_tokens=80,
24 temperature=0.7,
25 top_p=0.9,
26)
27print(tokenizer.decode(outputs[0], skip_special_tokens=True))
28# → "Hi there! What size — small, medium, or large?"
Example Outputs
Input (broken English): "I want... one coffee, please. Big one. With oat milk?"
NPC (Emma, barista): "Large oat latte — eat in or take away?"
Input: "I need check in. My bag maybe heavy, is problem?"
NPC (David, check-in agent): "Let's weigh it first — pop it on the belt."
Input: "I have pain here — in head. Is five day."
NPC (Dr. Patel, GP): "Five days is a while. Is it constant or does it come and go?"
Notice: the model never says "You should say..." or "The correct phrase is..." — it stays in character and responds naturally.
Part of LinguaAgent
This model powers LinguaAgent — a voice-first ISO immersion app where learners are dropped into real situations with an 8-second response timer and no grammar explanations. Built for The Gemma 4 Good Hackathon (Future of Education track).
- 🎯 5 mission chains with connected micro-scenes
- 🎤 Voice-first (Web Speech API)
- ⏱️ 8-second pressure timer
- 🔍 Post-scene feedback with error analysis
- 📱 Works offline via Ollama
License
CC-BY 4.0