Prompt Tooling with Retrieval-Augmented Generation (RAG) automatically augments your LLM (Large Language Model) translation prompt with contextual information from your linguistic assets, including glossary terms, translation memory examples, and locale-specific style rules. In translation workflows, it can also incorporate string- and file-level context, such as string instructions and file type.
Once enabled, Smartling injects this contextual information into the prompt, helping the LLM better understand your translation preferences and produce more consistent, on-brand translations without manual prompt engineering.
Info: This article is for Account Owners. Only Account Owners can create LLM Profiles and enable Prompt Tooling with RAG.
Benefits of prompt tooling with RAG
To achieve customized LLM translations that correctly reflect your brand voice and terminology, it is important to provide examples of desirable translations to the LLM. Compared to “zero-shot prompts” (i.e. prompts that don’t include any examples), translation prompts that include examples of good translations as contextual information (“few-shot prompts”) typically yield better results.
Historically, to achieve few-shot-prompting, any contextual information (such as examples of desirable translations or preferred terminology) had to be included in the translation prompt itself.
By using RAG technology (Retrieval-Augmented Generation), Smartling allows you to inject contextual information into your LLM translation prompt in a fully automated way.
How it works
RAG enhances the output produced by LLMs by connecting them to external knowledge bases. This added data source helps the LLM provide more customized and contextually accurate responses.
In Smartling, RAG is used to send information about your translation preferences to your LLM translation provider. By providing fully customized translation data and examples, RAG increases the likelihood of achieving a translation output that adheres to your organization's preferences and brand voice.
Prompt tooling with RAG can automatically add the following to your translation prompt:
- Glossary terms
- Example translations from your translation memory (TM)
- Style Rules for AI, which are locale-specific
- String and file context, such as String Instructions, String Role, File Type, and Project Label
Linguistic Packages and assets
Which Linguistic Package and assets are used depends on where you use LLM translation:
- Translation workflows and MT suggestions in the CAT Tool: RAG uses only the linguistic assets included in the Linguistic Package associated with the project used for LLM translation.
- Smartling’s Instant MT integrations and the MT API: For example, site-wide MT/LLM translation through the GDN (Global Delivery Network) and Instant Translation for Connectors. When you set up an LLM Profile, you can select which Linguistic Packages are used for RAG.
String and file context has an additional requirement: String Instructions, String Role, File Type, and Project Label are available only when the content being translated has associated metadata.
- Available in: Translation workflows and MT suggestions in the CAT Tool. These workflows use the string and file metadata generated when a string is uploaded to Smartling through a file or the Strings API.
- Not available in: Smartling’s Instant MT integrations and direct calls to the MT API. These paths send raw text without any associated string or file metadata that Smartling needs to retrieve this context.
If you enable string and file context for an LLM Profile used by an Instant MT integration or the MT API, the corresponding part of the prompt is left empty. No error is shown, and the rest of the prompt is sent normally, but the LLM does not receive that context.
Based on the final "few-shot" output prompt (your translation instructions plus whichever assets and context Smartling injects), the LLM then provides a translation that is typically more consistent with your brand tone and voice.
Supported providers
Prompt Tooling with RAG is supported for all LLM providers that use an LLM Profile including:
It is also supported for Smartling's preconfigured profiles, Smartling Auto Select LLM and Smartling Language Adaptation.
Prerequisites
Reliable linguistic assets
To achieve good results, your translation memories and glossaries should be up-to-date and of good quality. Since these assets are used as a reference, they should correctly reflect your preferred translation style, tone and terminology for each project where LLM translation will be used.
-
Translation memory (TM): When used for RAG, your TM can be one of the most impactful factors leading to a higher output quality.
- Any TM that is referenced for LLM translations should contain high-quality human translations that are reflective of the content type that will be translated with the LLM.
-
Glossary: When used for RAG, a well-maintained glossary helps preserve important brand terminology in LLM translations.
- Your glossary should only contain relevant brand terminology (no common terms).
- Ensure that your glossary terms use correct capitalization. Terms that are not supposed to be capitalized in LLM translations should not be capitalized in the glossary.
- Avoid polysemous or homonymous terms (i.e. terms that could have more than one meaning).
- Enabling AI-enhanced glossary term insertion for your translation workflow can further increase the probability of your glossary terms being inserted correctly.
Relevant string and file context
Unlike linguistic assets, the four String & File Context RAG sources (String Instructions, String Role, File Type, and Project Label) aren't something you maintain separately. Smartling generates them automatically from data already in your account. Even so, enable them selectively rather than turning all four on by default:
- Only enable String Instructions and Project Label if the content of those fields is actually useful context for translation. Internal-only codes, ticket references, or notes meant for other teams won't help the LLM, and may add noise to the prompt or confuse it.
- String Role and File Type are lower-risk to enable broadly, since they describe the format of the content itself rather than a free-text note. They're most useful if your account translates a mix of content types or file formats where different handling matters, for example, subtitles versus long-form HTML.
Note: All four string and file context options are disabled by default when you configure your own LLM Profile. In Smartling’s preconfigured profiles, Auto Select LLM and Smartling Language Adaptation, String Role, File Type, and Project Label are enabled by default. String Instructions remains disabled by default in these profiles because the quality of instructions varies by account. Only enable it if the strings in your account have instructions that would help the LLM produce better translations.
How to enable prompt tooling with RAG
Prompt tooling with RAG is configured directly in an LLM Profile.
- Follow the regular process of creating an LLM Profile, entering your provider details and Linguistic Packages on the Configuration Details screen. When you click Next to configure your translation prompt, continue to Assets References below.
-
In the Assets References section, select which assets to use for RAG. Data will be populated in the prompt if any is available for the source string.
Under Linguistic Assets, tick the checkbox for each source you'd like to include:- Translation Memory Examples: Matching example translations from your translation memory are sent to the LLM to provide context around your translation preferences, and what is deemed a "good" translation.
- Glossary Terms: If glossary terms are detected in the source text, they will be sent to the LLM, along with the corresponding glossary term in the target locale or "Do Not Translate" (DNT) annotations.
- Style Rules for AI: Smartling automatically applies locale-specific style rules to capture linguistic conventions and nuances for each target locale.
Under String & File Context, tick the checkbox for each source you'd like to include:
These sources are only recommended if the information they provide is useful for the LLM: generic or internal-specific codes or labels may not aid translation and could confuse the LLM.- String Instructions: Developer or author notes explaining how a specific string should be handled (e.g. character limits, UI context, placeholder meanings).
- String Role: The semantic format of the text within its file (e.g. HTML title, meta description, plain text, subtitle). Relevant because a page title requires different treatment from body copy.
- File Type: The source file format (e.g. JSON, XLIFF, HTML, DOCX, SRT, Markdown). Relevant because subtitle files require brevity, legal DOCX files require precision, etc.
- Project Label: The label of the Smartling project being translated, providing the LLM with high-level content domain context.
- Write a translation prompt that reflects your overall translation preferences (e.g. the intended audience). The translation prompt does not need to be written as a few-shot prompt: it's not necessary to include examples of good translations or glossary terms, since prompt tooling with RAG adds those automatically based on the sources you selected in step 2.
You may still want to add negative examples (examples of how not to translate your content) to your prompt, since RAG does not inject those. - Test the translation prompt before using it in production, following the Testing Prompt steps in Creating and Managing LLM Profiles, including selecting a Linguistic Package in the Testing Prompt panel itself so RAG examples are included in the test output. A couple of notes specific to prompt tooling with RAG:
- The Testing Prompt panel has its own Linguistic Package selector, used only to preview how RAG sources render in your test output; it's separate from the Linguistic Package(s) you selected in step 1. It is only used for generating the test translation output.
- Since test strings are typed directly into the Testing Prompt panel rather than pulled from an uploaded file or the Strings API, they don't carry real string or file metadata. This means String Instructions, String Role, File Type, and Project Label will render empty in the Rendered Prompt, even if enabled. To confirm these sources are populating correctly, create a test job and authorize it for translation in a workflow that uses the LLM Profile.
- The Testing Prompt panel has its own Linguistic Package selector, used only to preview how RAG sources render in your test output; it's separate from the Linguistic Package(s) you selected in step 1. It is only used for generating the test translation output.
- Save the profile, then use it to translate content: set up a translation workflow where the LLM Profile is used as the translation provider, use it for MT suggestions in the CAT Tool, or use it through an Instant MT integration or the MT API. See Creating and Managing LLM Profiles for details.
Enable prompt tooling with RAG for an existing LLM Profile
To enable prompt tooling with RAG for an existing LLM Profile:
- Navigate to the relevant LLM Profile.
- Click on the profile name to edit the prompt details.
- Tick the checkboxes for your desired Assets References.
- Click Save to confirm. The updated Assets References take effect on the next translation request that uses this LLM Profile.
Tip: If your existing prompt already contains specific translation memory examples or glossary terms, they should be removed from the prompt to avoid sending conflicting information to the LLM, and to reduce the length and complexity of the prompt.
You may still want to include general translation examples to provide an indication of the desired overall style and tone, or examples of unwanted translations to indicate which type of translations should be avoided.
Assets References for prompt tooling with RAG
Based on the checkboxes ticked in your LLM Profile, one or more of the following sources will be used to augment your translation prompt.
Translation Memory Examples
For each string, Smartling queries your translation memory to determine if any translation memory matches are available. Up to 10 available matches will be sent to the LLM as examples of your preferred tone of voice, terminology, formality register, and industry-specific language.
The TM matches may be used by the LLM as a reference to apply your company's stylistic preferences. Please note that the TM matches are used as examples only, and not inserted directly instead of an LLM translation.
Info: When used in a translation workflow or for MT suggestions in the CAT Tool, only the translation memories included in the project's Leverage Configuration are considered. When used for Instant MT integrations or the MT API, the translation memories included in the Linguistic Package(s) configured in the LLM Profile are considered instead.
Glossary Terms
If any glossary terms are detected in the source text, Smartling will send both the source term and the term in the target language to the LLM, alongside the text to translate , so they can be applied in the LLM translation output.
Info: When used in a translation workflow or for MT suggestions in the CAT Tool, only the glossaries associated with the project's Linguistic Package are considered. When used for Instant MT integrations or the MT API, the glossaries included in the Linguistic Package(s) configured in the LLM Profile are considered instead.
Style Rules for AI
Style Rules for AI are a collection of stylistic translation guidelines in an AI-friendly format. They capture linguistic conventions and locale-specific nuances, such as the correct punctuation rules or date format, for each target locale.
If the checkbox for "Style Rules for AI" under “Assets References” is ticked, Smartling applies automatically generated default style rules for supported target locales.
For further customization, Smartling’s expert team can implement custom Style Rules for AI to capture your organization’s translation preferences. This is typically done if specific issues have occurred in your LLM translations that may need to be addressed by providing information about your company's industry and domain, your audience and preferred tone, etc.
For further information about creating custom Style Rules for AI, please reach out to your Smartling representative.
String Instructions
String Instructions are developer or author notes attached to individual strings, explaining how that string should be handled. This may include information such as character limits, the UI context in which the string appears, or the meaning of placeholders within the string.
When enabled, Smartling sends any available String Instructions to the LLM as part of the augmented prompt, helping it produce translations that respect the constraints and context specific to that string.
If a string has more than one enabled instruction, Smartling sends all of them to the LLM as a list.
Only enable String Instructions if they contain information that is genuinely useful for translation. Notes that consist of company-specific internal codes, references, or developer shorthand are unlikely to help the LLM and may introduce noise into the prompt.
Info: The String Instructions RAG source is only available for strings uploaded in a file or via the Strings API and translated in a workflow, including MT suggestions in the CAT Tool. It is not available for Instant MT integrations or the MT API.
String Role
String Role describes the semantic format of a string within its source file. For example, whether it is an HTML title, a meta description, plain body text, or a subtitle. This context is relevant because different text roles require different translation approaches: a page title may need to be concise and keyword-friendly, while body copy allows for more natural phrasing.
When enabled, Smartling sends the String Role to the LLM alongside the string to translate, helping it apply the appropriate style and constraints for that text type.
Info: The String Role RAG source is only available for strings uploaded in a file or via Strings API and translated in a workflow, including MT suggestions in the CAT Tool. It is not available for Instant MT integrations or the MT API.
File Type
File Type indicates the source file format of the content being translated. For example, JSON, XLIFF, HTML, DOCX, SRT, or Markdown. The file format is relevant because it often implies specific translation requirements: subtitle files (SRT) require brevity to fit within display constraints, legal documents (DOCX) require a high degree of precision, and so on.
When enabled, Smartling sends the File Type to the LLM, giving it additional context about the format-specific requirements that may affect how the translation should be rendered.
Info: The File Type RAG source is only available for strings uploaded in a file or via the Strings API and translated in a workflow, including MT suggestions in the CAT Tool. It is not available for Instant MT integrations or the MT API.
Project Label
The Project Label is the label assigned to the Smartling project being translated. Many customers use project labels to categorize their projects by content domain, product area, or business unit, providing the LLM with high-level context about the nature of the content.
The Project Label is optional; not all projects have a label assigned. When a label is present and enabled, Smartling sends it to the LLM as contextual information about the content domain.
Info: The Project Label RAG source is only available when translating in a workflow, including MT suggestions in the CAT Tool. It is not available for Instant MT integrations or the MT API, since neither is tied to a single Smartling project the way a workflow translation is.
Expected results
The Large Language Model will provide a translation output based on your prompt, as well as the injected assets. On average, the use of prompt tooling with RAG is expected to produce a more customized translation result that requires fewer edits.
While the quality of the translation output is dependent on the LLM, as well as the quality of your linguistic assets and translation prompt, a significant reduction in the overall TER (Translation Edit Rate) is expected when prompt tooling with RAG is enabled.
Video walkthrough
The following video shows how to set up prompt tooling with RAG, and how to select the Linguistic Packages that will be referenced in your LLM translations.