Prompt template for adding RAG Context block

#13
by rjmehta - opened

How to enable context block in order to answer only from the context?
Currently, I use this. It works fine but talks too much and generates a lot of tokens.

GPT4 Instructions: For the GPT4 User question below, provide an answer from the GPT4 Context. Only answer from GPT4 Context. If the GPT4 User question is unrelated to GPT4 Context, respond 'I dont know'<|end_of_turn|>

GPT4 Context: {context_text_block}<|end_of_turn|>

GPT4 User: {question}<|end_of_turn|>

GPT4 Assistant:

Berkeley-Nest org

Thank you! Could you please try it with the default prompt "GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:"? This "Correct" is also necessary to get the highest possible performance out of the model. There're some code examples in the model card as well.

For this case, you might also want to try different prompting. I think you can try sth like "only provide answer from the context below without outputting any extra word. If no answer present, output "no answer present"". Because during training, the model only sees <|end_of_turn|> followed by GPT Correct Assistant / GPT Correct User. This extra context prompt and additional <|end_of_turn|> might make the model confused.

But it's still likely that the model will output verbose content. We're getting tons of new checkpoints and are picking some better ones for our beta version. Stay tuned!

Was this trained with system messages at all? If so, what's the 'correct' way to inject this into the prompt?

Berkeley-Nest org

In the RLHF phase we did not. I believe the base model Openchat 3.5 also didn't train with system prompt. I'd suggest directly put system prompt at the beginning of user prompt without any other formatting.

What about the Context block for RAG task? Should I include the context in before user as GPT4 Correct Context or add in the GPT4 Correct User block itself?

Berkeley-Nest org

I'd recommend add in the GPT4 Correct User block itself. And maybe point out in natural language specifically that "this paragraph is context" or sth like that.

rjmehta changed discussion status to closed

Sign up or log in to comment