What is supposed to be included in the "system" section of the Azure OpenAI fine-tuning format?

Mason 25 Reputation points
2024-11-30T01:56:23.3033333+00:00

In my RAG model, the following is being used by it:

  1. Prompt
  2. Context
  3. User question
  4. Chat History

The following link has the documentation on the finetuning: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/fine-tuning?tabs=azure-openai%2Cturbo%2Cpython-new&pivots=programming-language-studio#multi-turn-chat-file-format-azure-openai. What does the 'system' section of the JSONL file need? Just the prompt and the context?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,108 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 50,895 Reputation points MVP Volunteer Moderator
    2024-11-30T02:01:35.23+00:00

    In the fine-tuning JSONL file format for Azure OpenAI's multi-turn chat models, the system section represents the instructions or setup provided to the model before interacting with the he system section typically includes:

    1. Prompt: Instructions about the role the model should take or the task it should perform (e.g., "You are a helpful assistant.").
    2. Context: Background information relevant to the conversation to help the model understand the user's question better and provide accurate responses.

    In your RAG model, since you're working with Prompt and Context specifically, these elements should be encapsulated in the system section. Here's an example structure:

    {
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant. Here is some context to assist you: {Insert Context}"
            },
            {
                "role": "user",
                "content": "User question goes here"
            },
            {
                "role": "assistant",
                "content": "Model's response goes here"
            }
        ]
    }
    
    • Include Prompt and Context as part of the system role to define the model's behavior and provide necessary background.
    • The system role does not need the user question or chat history—these belong to the user and assistant roles, respectively, in subsequent turns.
    • If you want chat history for continuity, include it explicitly in the user or assistant roles in the conversation.

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.