One-Shot Code Translation
Definition
A language model receives a translation example as a template for further code.
A pair of source code and desired target code shows language, style, or API transition. The model then transfers a new snippet following this pattern.
Simply explained
A provided example explains how the next component should be transformed.
Why it matters in practice
This can support recurring small migrations.
Example from business
Hypothetical example: A team shows old and new API usage and lets similar calls be suggested.
Limits and pitfalls
- An example rarely covers special cases. Tests must secure meaning and behavior.
Origin & history
The method transfers one-shot prompting to programming tasks.
Use in mid-sized companies
- SMEs can accelerate limited code adjustments if expert review is available.
Frequently asked questions
Is this training of the model?
No, the example acts in the current context.
Sources
- Language Models are Few-Shot Learners, Grundlage des In-Context-Beispiels — · Brown et al.: Language Models are Few-Shot Learners, Grundlage des In-Context-Beispiels —
Editorially reviewed on: