◉GEMINI LABJP
●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 7 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 7 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…
Articles/Advanced
⬡ Advanced/2026-07-16Advanced

What language should your system instruction be in? Measuring three approaches when most prompts arrive in the user's language

Keep the system instruction in English, or translate it into the user's language? I measured input tokens per language with countTokens, then lined up output-language match and schema compliance to find where nine tokens is enough.

gemini-api285multilingual8system instructionscountTokenscost design7python107

✦ Premium Article

A screen where someone had asked in Thai was answering in English.

I was checking the description-generation flow of my wallpaper app on a Thai test device. Japanese and English were fine. Thai came back in English roughly nine times out of a hundred. Nothing crashed. No errors surfaced. The answer simply arrived in a language the user could not read.

My system instruction at the time was a single English text shared across every language. Only the user's input language changed; the instruction stayed put. That had been good enough for a long time, mostly because Japanese and English were the only languages I had ever looked at seriously.

Google's Southeast Asia report puts roughly 70% of Gemini app prompts in the region in a local language — 89% for Vietnamese, 87% for Thai, 84% for Indonesian. My own app's mix may not match those figures. But "the prompt will probably arrive in English" is clearly becoming the exceptional assumption, not the safe one.

So should the instruction be translated too? Does it help, and what does it cost? Rather than deciding by feel, I measured.

Three approaches, on the same footing

None of these is exotic. What I lacked was a record of measuring them side by side.

Approach What goes in system_instruction Effect on input tokens Intended benefit
A: English only One English text for every language Baseline One place to maintain
B: English + language pin The English text plus one line naming the output language as a BCP-47 tag Marginal increase Fixes the output language only
C: Mirror the user's language The instruction itself translated into the user's language Large, and highly language-dependent Aligns instruction and input

C looks like the principled choice. Instruction and input share a language, so the model has less to reconcile. Before measuring, I assumed it would win.

Deciding what counts as success, before measuring

The most dangerous way to compare these is to read the outputs and pick whichever "feels better." Once three or four languages are in play, your impression of the one language you actually read drives the whole conclusion.

So I fixed three metrics first.

  1. Output-language match — how often the response body's language matched the intended one
  2. Schema compliance — how often the enum fields defined in response_schema came back with defined values
  3. Input tokens — tokens per request as measured by countTokens

Separating 1 and 2 mattered more than I expected. The language can be right while the structure quietly breaks, and the reverse happens too.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Real measurements showing the same system instruction ranging from 214 to 612 tokens across languages, plus the countTokens procedure to measure your own
✦A side-by-side comparison of English-only, English-plus-a-language-pin, and full mirroring across 500 requests per language, on both output-language match and schema compliance
✦The metric that got worse when I translated the instruction, and how to tell when nine extra tokens gets you the same result
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Advanced2026-05-06
Gemini 2.5 Pro + Imagen 4 Content Automation Pipeline: Complete Build Guide
Build a production-ready pipeline combining Gemini 2.5 Pro and Imagen 4 API to auto-generate blog articles, SNS posts, and thumbnails. Covers async processing, quality filters, and monetization design.
⬡ Advanced2026-04-23
Defending Gemini API Apps from Prompt Injection: A Multi-Layer Production Architecture
A four-layer prompt injection defense for Gemini apps: sanitized input, hardened prompts, structured output, and a moderator LLM — with runnable Python.
◈ API / SDK2026-07-04
When Gemini API Leaks Japanese Into Your English Output Once in a While — Field Notes on Measuring the Contamination Rate and Tightening It in Stages
You told Gemini to answer in English, and 3 out of 100 runs slip a Japanese sentence into the tail. Here is why you cannot stop that 'once in a while', and a production pattern that measures the contamination rate as an SLO and tightens it with graded recovery, with working code.