Skip to content

Deploy Gemma 4 E4B + G1 prompt; remove Swahili (English-only) - #71

Merged
nmrenyi merged 1 commit into
mainfrom
feat/gemma4-g1-prompt-20260623
Jun 23, 2026
Merged

Deploy Gemma 4 E4B + G1 prompt; remove Swahili (English-only)#71
nmrenyi merged 1 commit into
mainfrom
feat/gemma4-g1-prompt-20260623

Conversation

@nmrenyi

@nmrenyi nmrenyi commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Deploys Gemma 4 E4B + the G1 deflection-fix prompt, and removes Swahili (English-only). Driven by the mamai-eval generator × prompt + safety evaluation.

Why

The mamai-eval matrix (Gemma 4 / 3n / Qwen × baseline/+G1/+G1+G2, end-to-end + faithfulness) plus a hand-adjudication of every flagged dangerous answer found:

  • Gemma 3n is more helpful but materially less safe — genuine order-of-magnitude dosing/drug errors under these prompts (adjudicated as real, not judge artifacts).
  • Gemma 4 + G1 fixes the deflection problem with ~zero dangerous answers — a net safety improvement over the previously-deployed 3n at comparable recall.

So Gemma 4 + G1 is the safest deployable on-device configuration.

Changes

Generator → Gemma 4 E4B

  • app_config.json llm_modelgemma-4-E4B-it.litertlm
  • intro_page.dart: download URL → ungated litert-community/gemma-4-E4B-it-litert-lm, SHA-256 pinned 0b2a8980…, size guard 4.92 → 3.66 GB, filename, startup item
  • sync_models.sh, all "Gemma 3n" labels/comments → Gemma 4

Prompt → G1

  • config/prompts/system_en.txt → the G1 prompt (deployed clinical system prompt)

Swahili removed (English-only)

  • Deleted system_sw.txt, app_sw.arb, app_localizations_sw.dart
  • Stripped sw code paths in RagPipeline.kt, removed _sw context labels + dead switcher strings, regenerated l10n English-only

Retriever (EmbeddingGemma) unchanged. Version 0.3.0+30.4.0+4. Docs updated.

Device test (real device 9da65e62) ✅

  • flutter analyze: clean · release APK builds (203 MB)
  • Intro shows "Gemma 4 on-device model — 3.66 GB", no language switcher
  • In-app download from source succeeded + SHA-256 verified (marker == pinned 0b2a8980…) + model loaded
  • Query "How do I measure fundal height?" → retrieved 3 guidelines (EmbeddingGemma) → grounded, cited, English clinical answer (TTFT 2.6 s), with G1's engaged + safety-escalation behavior

🤖 Generated with Claude Code

Generator: Gemma 3n E4B -> Gemma 4 E4B (gemma-4-E4B-it.litertlm, 3.66 GB,
ungated litert-community repo, SHA-256 pinned 0b2a8980...). Prompt: deployed
system_en.txt -> the G1 deflection-fix prompt. Both per the mamai-eval generator
x prompt + safety evaluation: 3n is more helpful but produces genuine dangerous
dosing/drug errors under these prompts (hand-adjudicated); Gemma 4 + G1 fixes
deflection with ~zero dangerous answers — the safer deployable choice.

Swahili completely removed: deleted system_sw.txt, app_sw.arb,
app_localizations_sw.dart; stripped sw code paths in RagPipeline.kt; removed sw
context labels + dead switcher strings; regenerated l10n English-only. Retriever
(EmbeddingGemma) unchanged. Version 0.3.0+3 -> 0.4.0+4.

Device-tested on a real device (9da65e62): fresh in-app download of Gemma 4 from
source succeeded + SHA-256 verified; model loaded; query 'How do I measure fundal
height?' retrieved 3 guidelines (EmbeddingGemma) and generated a grounded, cited,
English clinical answer (TTFT 2.6s). flutter analyze clean; release APK builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rb8sCfVzRDRZko7V5JYxUB
@nmrenyi
nmrenyi merged commit 2d5b5b8 into main Jun 23, 2026
1 of 2 checks passed
@nmrenyi
nmrenyi deleted the feat/gemma4-g1-prompt-20260623 branch June 23, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant