A guide to natural language translation using GenAI

Translation of text to different natural (and programming) languages is one of the most natural applications of GenAI. In this example I showcase some of the techniques I found most effective.

Gone are the glorious days when Google Translate would render the Italian sentence “Sei a Roma” as “6 in Rome”, because “sei” in Italian means both “six” and “you are”, but even ChatGPT-4 can’t get everything exactly right when translating a text into a different language.

However, by combining basic knowledge of the target language with the techniques described in this article, translators can use LLMs to progressively refine and perfect the translation.

The techniques I introduce here are the same I use for translating code between programming languages, but in this article, I decided to show the use case of natural language translation because, with more ambiguity and given the wider repertory of idiomatic sentences, ways of saying and cultural references (not that programming languages are completely devoid of those), it’s easier to create examples we can work on.

& and truth to be told& also for a welcome change of scenario.

The original text

I wrote this little novel with as many translation difficulties I could think of in such a short text. Don’t expect a literary masterpiece: it was written with the explicit purpose of being as hard to translate as possible, but still having some coherence, style and internal flow, so that we can appreciate the skill of the LLM in the translation.

Without further ado, this is the original text in Italian; feel free to skip to the next paragraph (whether you can read Italian or not), as I am pasting it here for reference only  the rest of the article will be almost completely in English.

Era una notte buia e tempestosa&