Uploaded image for project: 'translate5'
  1. translate5
  2. TRANSLATE-4374

RAG-based prompting for LLMs (GPT, OpenAI, Azure AI Foundry, Llama, ect.)

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • translate5 - 7.31.0
    • None
    • AI
    • High
    • Important: The latest translate5 docker image (with PHP 8.3) is required for the updated OpenAI library
    • Hide
      OpenAI Plugin:
      * add RAG-based prompting for LLM based language-resources
      * Improve Icons & prompt layouts
      * add option to use xliff-format for single text translations (InstantTranslate)
      Show
      OpenAI Plugin: * add RAG-based prompting for LLM based language-resources * Improve Icons & prompt layouts * add option to use xliff-format for single text translations (InstantTranslate)

      Problem

      Not all models are trainable (majority is not). And even for trainable models it is often to cost-intensive, to train them.

      Therefore it is necessary to allow AI language resources, that use defined prompt compositions and examples, but send the data with every request.

      Solution

      We introduce "RAG-based prompting". It  a non-trainable Model, where a trainings system-message and examples are sent alongside every translation request. To achieve this, the following adjustments have to be made (the basics are already there):

      • The same training window is used with some changed texts
      • Every model is usable for RAG, it will be added to "specificData" if it is active (to avoid additional queries for index-requests)
      • If you open the training window
        • At the start of the top bar of the window (before display of the name of it) we display:
          • DE: Typ:  As is / RAG-based / Trained|Untrained | NAME_OF_RESOURCE
          • EN: Type: As is / RAG-basiert / Trainiert|Untrainiert | NAME_OF_RESOURCE
        • If resource was not trained yet and is model type is trainable
          • Next to the "Submit training" button a "Save as RAG-based" (DE: "Als RAG-based speichern") button is added
          • If "RAG-based" prompts have been saved,
            • their look and feel stays like before, but a green check-mark is added at before the Prompt-title in the prompt header
            • The "Submit training" button is removed
            • Any time prompts can be edited, new prompts added or existing ones removed
          • If resource is trained,
            • training window looks like it does now and "Save as RAG-based" button is removed
          • Two new Checkboxes - that will be saved in the Assoc:
            • Use examples for RAG-based prompting
            • Use source and target language for RAG-based prompting (by default, only targets are used as reference-translation

      For RAG-based language resources the restriction to have at least 10 examples in the prompts is removed.

      RAG-based language resources use prompts and their examples directly from the prompt management. In case they are changed there, they are changed in the language resources when used next. This is even beneficial because it allows to improve prompts of multiple language resources at once.

      There will be a new table to associate sysmessages with languageresources directly

      LEK_openai_ragbased_assoc 

         columns: ( id | languageresourceId | sysmsgId )
      

            axelbecher Axel Becher
            axelbecher Axel Becher
            Aleksandar Mitrev, Axel Becher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: