Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt fix for empty intermediate steps in summarization #660

Conversation

vertinski
Copy link
Contributor

@vertinski vertinski commented Jan 20, 2023

Adding quotation marks around {text} avoids generating empty or completely random responses from OpenAI davinci-003. Empty or completely unrelated intermediate responses in summarization messes up the final result or makes it very inaccurate.
The error from OpenAI would be: "The model predicted a completion that begins with a stop sequence, resulting in no output. Consider adjusting your prompt or stop sequences."
This fix corrects the prompting for summarization chain. This works on API too, the images are for demonstrative purposes.
This approach can be applied to other similar prompts too.

Examples:

  1. Without quotation marks
    Screenshot from 2023-01-20 07-18-19

  2. With quotation marks
    Screenshot from 2023-01-20 07-18-35

Adding space before {text} and quotation marks around it avoids generating empty responses from OpenAI davinci-003. Empty responses in summarization messes up the final result or makes it very inaccurate. 
The error from OpenAI would be: "The model predicted a completion that begins with a stop sequence, resulting in no output. Consider adjusting your prompt or stop sequences." 
This fix corrects the prompting for summarization chain. Can be applied for other prompts too.
Same as for map_reduce (see commit commentary).
Same as for map_reduce prompting (see commit commentary).
Removed the space before \n\n"{text}" as it turns out it is not needed for correct response.
Removed the space before \n\n"{text}" as it turns out it is not needed for correct response.
Removed the space before \n\n"{text}" as it turns out it is not needed for correct response.
@hwchase17 hwchase17 merged commit 65f3a34 into langchain-ai:master Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants