An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Hello Mohamed Darwish,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to know how you can be sure GPT-4 (Azure OpenAI) Includes Original Terms in Parentheses During Translation.
Regarding your scenario and questions, the ChatGPT web interface likely uses a more sophisticated system prompt that enforces structured responses. The deployed Azure version may not have the same system-level reinforcement. The ChatGPT web version retains more conversational context than the Azure OpenAI API, which operates statelessly unless conversation history is managed manually. Azure OpenAI deployments may have different model versions, batch processing constraints, or token limitations that impact the output. These are the reason the ChatGPT Web Interface and Azure OpenAI Service Give Different Result.
The below are methods to improve term retention in parentheses:
- Use a structured system message to enforce terminology retention: For this case- System: You are a professional translator specializing in psychoanalysis. Your task is to translate German psychoanalytic texts into English while ensuring that technical terms remain in parentheses next to their translations. For an example: German: Die Verdrängung ist ein zentraler Begriff in der Psychoanalyse. English: Repression (Verdrängung) is a central concept in psychoanalysis. Instructions:
- Translate the text while retaining the original German psychoanalytic terms in parentheses next to the translated term.
- Ensure proper sentence structure and linguistic accuracy.
- Do not alter the format of parentheses placement. Input: {German_Text} So, this ensures that the system consistently applies the format across translations.
- Instead of relying on the model to always remember to include terms in parentheses, post-process the translation by injecting terms manually using an external glossary. This is an example in Python:
This guarantees that the glossary terms always appear in parentheses, regardless of model inconsistencies.import re glossary = { "Verdrängung": "repression", "Affektregungen": "affective reactions", "Übertragung": "transference" } def enforce_parentheses_translation(text, glossary): for term, translation in glossary.items(): text = re.sub(rf'\b{translation}\b', f'{translation} ({term})', text, flags=re.IGNORECASE) return text translated_text = "Repression is a core concept in psychoanalysis." final_output = enforce_parentheses_translation(translated_text, glossary) print(final_output) - Azure OpenAI allows function calling. You can provide a structured glossary via an external function. For an example OpenAI Function Calling JSON Input:
This method ensure that translations adhere to predefined glossary terms instead of relying solely on the model.{ "name": "translate_psychoanalysis", "description": "Translates German psychoanalytic texts into English while preserving technical terms in parentheses.", "parameters": { "text": "string", "glossary": "dictionary" } } - Now, if prompt engineering and programmatic term insertion do not yield sufficient accuracy, fine-tuning should be considered.
- Create a dataset with aligned source and target texts that demonstrate correct formatting.
- Train a fine-tuned model on Azure OpenAI** with specific focus on formatting and terminology preservation.
- Evaluate performance and adjust the glossary to reinforce consistency. Fine-tuning requires more resources but can provide higher consistency for niche use cases.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.