TranslateGemma Terminology Control and Context Support for Scientific Translation

#17
by EliasKim - opened

Hi, I am currently using TranslateGemma for scientific / medical paper translation and would like to understand whether the model supports terminology control and document-level context beyond basic prompting.

I have several questions:

  1. Hotword / Forced Terminology Support
    Does TranslateGemma support any built-in mechanism similar to hotwords (like Whisper), forced terminology, keyword biasing, or lexicon constraints during generation?

For example, can I prioritize preferred translations such as:

  • sarcopenia -> 근감소증
  • muscle fat infiltration -> 근육 지방 침윤
  • lean muscle volume -> 제지방 근육 부피
  1. Context / Reference Text Injection
    Is there any supported parameter or recommended input format for providing additional context during translation?

Examples:

  • paper abstract
  • domain background
  • previous paragraph
  • document summary
  • glossary

I would like the model to use context for disambiguation and terminology consistency.

  1. Generation Parameters Beyond Prompting
    Besides prompt engineering, are there Hugging Face Transformers generation parameters that can help terminology consistency or contextual translation?

Examples:

  • forced tokens
  • forced decoder ids
  • prefix constraints
  • prefix_allowed_tokens_fn
  • logits_processor
  • bad_words_ids
  • constrained decoding
  • custom token biasing
  1. Multi-turn / Memory / Document Translation
    For translating long scientific documents, what is the best practice for preserving context across multiple sentences or paragraphs?

Should previous translated segments or previous source paragraphs be included in the prompt?

Does TranslateGemma support document-level translation behavior, or is sentence-by-sentence prompting recommended?

  1. Recommended Best Practice for Scientific Translation
    For domains like medicine, biology, and clinical research, what is the recommended method to improve:
  • terminology consistency
  • abbreviation handling
  • paragraph coherence
  • accurate technical translation

If possible, could you also share a Hugging Face Transformers implementation example for these use cases?

Thank you.

Google org

Hi @EliasKim Apologies for late response
Thanks for the detailed questions. Let me go through each one

  1. Hotword / Forced Terminology Support
    TranslateGemma does not include a built-in hotword or lexical constraint mechanism. It has no equivalent to Whisper's hotwords parameter, and forced_decoder_ids does not apply here . The supported and recommended path for terminology control is prompt-level injection via the text field.

  2. Context / Reference Text Injection
    There is no dedicated context parameter in the chat template. The text property in the content list entry is designed to contain the text to translate. TranslateGemma may respond well to other prompting techniques to support use cases that go beyond the provided chat template, such as Automatic Translation Post-Editing. These should be crafted manually using the special control tokens and structures specified in the Gemma 3 Technical Report, and sent directly to the tokenizer instead of using apply_chat_template().

  3. Multi-turn / Memory / Document Translation
    TranslateGemma has no cross-call memory or document state. Each call is stateless. My recommendation would be to translate paragraph by paragraph .

  4. Recommended Best Practice for Scientific Translation
    Please use apply_chat_template() with do_sample=False . Deterministic decoding directly helps terminology consistency since the model produces the same output for the same input. Always chunk your medical papers into paragraphs well under the 2K token limit.

Thanks

Sign up or log in to comment