DEV Community

Multigrid
Multigrid

Posted on • Originally published at multigrid.ai

Writing Few-Shot Examples in the Target Language

An English example block with a translated instruction demonstrates English output and then asks, in words, for something else. The demonstration usually wins, because it is the part of the context that looks like what the model is about to produce.

Demonstration outranks description

Few-shot examples do not teach the task. By the time a model can follow instructions at all, it knows what summarisation is. What the examples fix is the surface: length, structure, register, punctuation, formatting, how much hedging is acceptable, whether headings are used. Those are exactly the properties that are language-specific and exactly the properties an instruction states weakly.

“Be polite” is a weak instruction in any language and a nearly empty one in Japanese or Korean, where politeness is a verb morphology decision with several levels and no default. One example in です・ます form settles it for the whole generation, in a way no amount of adjectives will. The same holds for the /usted choice in Spanish, the du/Sie choice in German, and the Dutch je/u split — each is a single binary that an example pins and a description leaves open. See specifying formal and informal register for the cases where you need both.

What examples teach that instructions cannot

The most reliably visible defect in generated non-English text is punctuation, and it comes almost entirely from English examples. A model shown English demonstrations and asked for Japanese will often produce Japanese sentences terminated with ASCII full stops and separated by ASCII commas, which is wrong and immediately obvious to a reader.

language   what the text needs
Japanese   。 、 「」 — never . , " "
Chinese    。 ,  :  “ ”  and full-width parentheses ()
French     « » guillemets; narrow no-break space before : ; ! ?
German     „low-high“ quotation marks
Spanish    opening ¿ and ¡ on questions and exclamations
Arabic     ، (Arabic comma) and ؛  — direction matters too
Greek      ; is the question mark; · is the ano teleia
Russian    «guillemets»; dash-based dialogue punctuation
Enter fullscreen mode Exit fullscreen mode

Number and date formatting travels the same way. An English example with 1,234.56 and 08/14/2026 teaches a comma thousands separator and a month-first date; a German example with 1.234,56 and 14.08.2026 teaches the right ones. This is cheaper and more reliable than stating the rules, and it composes with the locale pages — see the decimal comma and point and day-first and month-first dates.

Two more things an example carries that an instruction will not. Name order, where a Japanese or Hungarian example shows family name first without you having to explain it. And honorifics — whether a Japanese example uses さん after a customer’s name, whether a German one uses Herr/Frau plus surname or a bare first name. Get one example right and every generated instance follows it.

Native prose, English identifiers

The one place to resist nativisation is anything your code will read. If the task is classification or structured extraction, the labels and the JSON keys are identifiers, not text, and translating them means your parser now has to handle a different vocabulary per language — and the model will occasionally emit the English label anyway, which becomes a parse failure rather than a stylistic wobble.

// Good: stable machine surface, native human surface.
{
  "category": "billing",
  "urgency": "high",
  "summary_native": "お客様はクレジットカードの二重請求について問い合わせています。",
  "reply_native": "お問い合わせいただきありがとうございます。……"
}

// Bad: the enum is now language-dependent.
{
  "カテゴリ": "請求",
  "緊急度": "高"
}
Enter fullscreen mode Exit fullscreen mode

The same argument applies to any control token you use — section markers, delimiters, stop sequences. Keep them ASCII and keep them constant across languages, so one parser and one set of tests covers every locale.

What the block costs, and where to put it

Target-language examples are more expensive per character than English ones, and by a wide margin for some scripts, because tokenisers are fitted mostly to English text. Thai, Hindi, Amharic and Burmese fragment heavily; Japanese and Chinese are dense per character but the character count is small. Budget for it rather than being surprised — the per-language numbers are in the token-cost pages, for instance Thai and Hindi.

Because the block is identical on every request for a given locale, it is a prompt-cache prefix. Put it first, before anything that varies per request, and the cost mostly disappears on the second and subsequent calls. Ordering the prompt as constant-then-variable is worth doing even if you are not caching today, because it costs nothing and it is the only way to benefit later.

Cache behaviour is one of the places providers differ most: minimum cacheable prefix lengths, whether caching is automatic or requires an explicit marker, and how long an entry survives are all provider specific. If you serve several locales across more than one provider, a gateway that normalises the request shape lets you keep one constant-prefix layout instead of one per vendor — that normalisation is part of what Multigrid does.

Building the block

  1. Write three to five examples natively. Not translations of your English ones — those carry English structure straight into the demonstration, which is the failure described in writing prompts natively. If you have real historical output in the target language, use it.
  2. Cover the shape, not the topic. The examples should differ in length, in whether the answer is positive or negative, and in structure. Five examples that are all the same shape teach one shape.
  3. Include one edge case. An input the correct answer for which is “insufficient information” or an empty result. Without it the model learns that every input produces a confident answer.
  4. Freeze the typography. Check the examples themselves against the punctuation table above before they go in. A defect in an example is reproduced in every output, permanently.
  5. Keep identifiers English and the prose native. Then state, in the instruction, that keys and enum values are fixed.
  6. Put the block in the constant prefix, ahead of the per-request content, and keep the delimiters byte-identical between requests so the cache actually hits.
  7. Consider more examples for thinner languages. The prior the demonstrations are competing against is weaker, so there is more for them to do. This follows from the mechanism rather than from any published count, so treat the number as something to tune on your own task — see prompting in a low-resource language.

Checking it worked

  • Script coverage. Assert that the native fields contain characters from the expected Unicode blocks and, where appropriate, that they contain no Latin letters at all. This catches silent English leakage in one line.
  • Punctuation. For CJK output, reject any ASCII . or , inside a native string. For French, assert the guillemets. These are the defects readers notice first.
  • Schema. Validate keys and enum values against the English set. A translated key is a bug in the prompt, not in the output.
  • Register drift over length. Check the last paragraph of a long generation, not the first. Register set by an example decays over a long output for the same reason a minority written standard decays — the prior reasserts itself token by token.

Related

Top comments (0)