Implementation of prompt techniques#1018
Merged
chakravarthik27 merged 17 commits intorelease/2.2.0from May 11, 2024
Merged
Conversation
…ement-the-prompt-techniques
ArshaanNazir
approved these changes
May 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Few-Shot Prompting:
Few-shot prompting is an advanced technique used to enhance the performance of a large language model (LLM) by utilizing a small number of targeted examples (known as "shots"). These examples comprise specific prompts and are designed to direct the LLM toward desired responses for particular tasks.
The Langtest framework assists in evaluating the LLM model by utilizing multiple datasets with few-shot prompts. The evaluation employs distinct prompt configurations for two datasets, "BoolQ" and "NQ-open". Each dataset uses tailored instructions and designated prompt types to shape the model’s responses, whether for instructional completions or conversational engagements.
BoolQ Configuration:
The BoolQ (Boolean Questions) configuration tests the model’s capability to provide a straightforward 'true' or 'false' response based on the context. The guidelines emphasize the importance of conciseness and accuracy. This configuration includes sample interactions to instruct the model on handling context-dependent questions efficiently.
NQ-open Configuration:
The NQ-open (Natural Questions - open book) setup assesses the model's ability to furnish concise answers to open-ended questions demanding specific information. Similar to BoolQ, this configuration uses an "instruct" prompt type aimed at eliciting direct and relevant responses without superfluous details.
Both configurations use the few-shot prompting approach to teach the model the anticipated response format and depth, enabling it to generalize from limited examples to new, unexplored queries, thereby testing its accuracy and contextual appropriateness with minimal guidance.
Configuration Methods:
Configuration in the Harness class can be done in two ways: using a YAML file or directly passing arguments in dictionary format to the Harness config.
YAML Configuration (saved as
config.yaml):Using the Harness Class:
Execute the following commands to generate, run, and report: