Saturday, June 3, 2023

ChatGPT for Translation

ChatGPT's interactive nature makes it a standout translation tool. With other translation tools, you provide a text, you get a translation, and that's it. Whether it is the best translation you can get doesn't matter—you're stuck with it.

With ChatGPT, you can customize translations to suit your specific needs and provide feedback on adjustments you'd love to see. For example, you can adjust the tone and style and take into account some cultural connotations and regional differences in the meaning of words, something purpose-built translation tools like Google Translate can not do.
All you need to do is provide the text you want to translate, specify the language you want to translate it to, and ChatGPT will handle the rest.

1. Provide Context

One of the key advantages of ChatGPT over popular translation tools like Google Translate is its ability to accurately consider the context of a text when generating translations. Considering context can be the difference between simply translating individual words in a sentence and generating a translation that truly reflects the author's or speaker's intention.

Take the Spanish sentence “Gracias por preguntar, pero estoy bastante seguro aquí” for instance. Google Translate produces "Thanks for asking, but I'm pretty sure here" as the translation. While this isn't entirely wrong, depending on the context, the sentence could mean, "Thanks for asking, but I'm safe here."
 Of course, Google Translate will provide the same translation no matter how many times you attempt to translate it because it doesn't have a way to recognize contextual nuance. As per the screenshot above, ChatGPT will attempt to provide the most accurate translation depending on the provided context. Providing context can significantly improve the quality of your translation. If you are not sure how to provide context, here are some inspirations:

    "Translate [text to translate in Filipino] to English from the perspective of a native Filipino speaker" should try to maintain as many cultural connotations as possible in a translation.
    "Translate [text to translate] to English from the perspective of someone discussing the COVID-19 pandemic" should use appropriate medical terms instead of generic words.
    "Translate [text to translate] to English. The text discusses a battle during WWII" should use appropriate military and historical terms.

2. Declare the Type of Text

Another important factor that can increase the accuracy of your translation is outright declaring the kind of text you're trying to translate. For example, is it an idiom, a song, a financial document, or an ordinary text? Simply letting ChatGPT know what you're trying to translate gives the chatbot an edge toward providing more accurate translations.

Instead of simply using a prompt like "Translate [text to translate] to [target language]." You should ideally use alternatives like:

    Translate the [Financial report | poem | song | Bible portion | proverb] in quotes to [target language]
    Translate [text to translate] to [target language]. The text to be translated is a [military report | Medical document | Drug prescription]

The prompts above or similar ones help ChatGPT use relevant or industry-specific context when generating a translation. Although ChatGPT sometimes recognizes the right niche words to use for translation, you'll have to explicitly prompt it to do so using type declaration in some cases.
3. Use Style Transfer

Sometimes, when translating text, the translation might be too technical or simply inappropriate for the target audience. Using style transfer in ChatGPT can help adjust the tone and style of a translation to match the target audience or industry. So, if you're translating a legal document, the translation could retain the author's original meaning while using more layman's wording. In the example below, I translated a soccer commentary from Spanish to English, first without style transfer and then using style transfer.
 The translation above uses the closest English equivalent of the corresponding Spanish words, while the one below uses words suitable for an audience not acquainted with soccer terms. However, it is interesting to note that both translations are considered accurate.
An English translation using style transfer

To use style transfer when translating, use prompts like:

    Translate [text to translate] to [target language] in layman's terms.
    Translate [text to translate] to [target language] for a [grade 5] audience
    Translate [text to translate] to [target language]. Use style transfer to make the translated text suitable for a [target audience]

4. Account for Regional Differences

Some words may have different meanings or connotations depending on the region or country of the speaker. For instance, the English sentence "I'm going to play football" could translate to "我要去踢足球 (Wǒ yào qù tī zúqiú)" in Chinese. While this seems like a perfect translation, if the speaker was American, the translation could be wrong. By saying "football," an American speaker would likely be referring to the rugby-style sport called American football instead of the football known by the rest of the world.

Regular translation tools have no way to account for this potential misinterpretation. ChatGPT, on the other hand, can provide varying translations depending on the speaker's origin.

We prompted ChatGPT to translate "I'm going to play football" into Chinese. As expected, it produced "我要去踢足球 (Wǒ yào qù tī zúqiú)." In Chinese, "zúqiú" means "football," which refers to soccer rather than the rugby-style sport.
ChatGPT translation accounting for regional differences in meaning

We repeated the translation prompt but added hints about the speaker's origin and possible intent. ChatGPT changed the translation to "我要去踢橄榄球 (Wǒ yào qù tī gǎnlǎnqiú)," this time using "gǎnlǎnqiú" which is the Chinese term for American football and better reflects the potential intent of the speaker.
5. Use Summarized Translation

Sometimes, you don't want to read the entirety of a text. You just want to understand the message the author or speaker is trying to pass across. ChatGPT is one of the few translation tools you can rely on for situations like this. To get a summarized translation, ask ChatGPT to provide a "summarized" or "condensed" translation of the target text. Some prompts examples include:

    Provide a descriptive but condensed translation of [text to translate] in Spanish.
    Provide a Summarized translation of [text to translate] in French.
    Provide a summarized translation of [text to translate] in English.
    Translate this article into Dutch, but only include the key points.

6. Use a Fine-Tuned Instance of ChatGPT

Using a fine-tuned instance of ChatGPT is one of the best ways to utilize ChatGPT as a translation tool. It opens up almost endless possibilities for translation using the AI chatbot. But how can you fine-tune ChatGPT for translation?

You can do it in several ways. A key component to fine-tuning ChatGPT for translation is laying out rules the chatbot must follow when translating any text you provide. For instance, you can fine-tune ChatGPT by providing a word-translation pair or a text-translation pair. Here's an example below:

While trying to translate a Pidgin text into English, we ran into some wrongly translated words. Providing the word-translation pairs below made ChatGPT update its translation of the words in subsequent translations.
Fine-tunning ChatGPT for translation tasks

You can also make ChatGPT translations more accurate by providing several large texts and their verified translations. You can then prompt ChatGPT to deduce the right translation of words and phrases from the provided samples and apply it when translating text involving a similar language pair. While you can use significantly longer texts to fine-tune ChatGPT translations, below is a short illustration of how it works using a short paragraph.
Providing a parralel corpus of text for ChatGPT

We achieved improved translation with every prompt without taking any further steps.

Don't Rely Solely on Machine Translation

While ChatGPT is an impressive translation tool, it's important to remember that it is still a machine and may not always produce the best translation. So don't rely solely on it, especially for important or sensitive documents. Instead, try a combination of tools, and whenever possible, consider using a professional translator to proofread to ensure accuracy.

Source: makeuseof.com

Other resources: https://chatdico.com/