FURTHER ABOUT few-shot prompting
FURTHER ABOUT few-shot
prompting
Few-shot prompting in
machine translation means giving the model a handful of parallel example
sentences (source + target) inside the prompt, then asking it to translate a
new sentence in the same way.
Basic pattern
In practice, a
few-shot MT prompt typically looks like this:
- Several short source sentences, each
immediately followed by its correct translation (the “shots”).
- A final new source sentence, followed by
an empty target line the model must complete.
Example skeleton
(EN→IT):
- “English: The meeting was postponed. Italian: La riunione è stata
rinviata.”
- “English: The claim was denied. Italian: Il sinistro è stato
respinto.”
- “English: The policy expires on 31
December. Italian: La
polizza scade il 31 dicembre.”
- “English: [new source sentence]. Italian:
[model output here].”
The model infers the
translation pattern, domain, style, and even formatting from the examples and
applies them to the new sentence.
How it is applied
in research
Recent MT work with
LLMs treats a frozen, general LLM as a translator and studies how different
few-shot setups affect quality:
- Researchers define a prompt template
specifying language labels (e.g., “[English]: … [Chinese]: …”) and where
examples are inserted.
- They vary the number of shots (e.g., 1, 5,
10, 20 examples) and show that more high‑quality examples usually improve
BLEU/COMET scores, up to a point.
- They test different selection strategies
for the example pairs (random vs semantically similar vs domain‑matched)
and find that semantically and stylistically similar examples work better
than random ones.
- They use few-shot prompts to steer style
or domain (e.g., legal, diplomatic, industry‑specific) by choosing
in-domain examples, which shifts terminology and register without
retraining the model.
Adaptive few-shot
prompting
Newer work introduces
“adaptive” few-shot prompting for MT:
- For each input sentence, the system
retrieves the top‑k most similar parallel segments from a corpus (using
embeddings) and inserts those specific examples into the prompt.
- The LLM then translates the sentence using
these tailored demonstrations; some frameworks further generate multiple
candidate translations and rerank them for better adequacy and fluency.
This adaptive
selection tends to outperform using a single fixed set of examples for all
sentences, especially in specialized domains (e.g., diplomatic or technical
text).
Typical use cases
in MT
Few-shot prompting for
MT is used to:
- Rapidly adapt a general LLM to a new
domain (legal, medical, financial) by injecting domain‑specific parallel
examples.
- Handle low‑resource language pairs where
only a small parallel set is available, using those few pairs as
demonstrations.
- Control tone, formality, or layout (e.g.,
segment‑by‑segment, numbered lists) by showing examples with the desired
style and formatting.
Comments
Post a Comment