Skip to content

Instantly share code, notes, and snippets.

@Haste171
Last active December 16, 2022 03:15
Show Gist options
  • Save Haste171/594afdb25d497319cc71f53f638bf237 to your computer and use it in GitHub Desktop.
Save Haste171/594afdb25d497319cc71f53f638bf237 to your computer and use it in GitHub Desktop.
A Guide to Prompt Engineering

Before you read this you might ask 'why would learning how to prompt engineer be beneficial to me'?

Overall, prompt engineering plays a crucial role in the development and maintenance of text-based AI systems, as it helps to ensure that the prompts used by the system are effective at eliciting meaningful and accurate responses.

Additionally, prompt engineering will allow you to get a sufficient and legitimately useful response from an AI

Definition

Prompt engineering is the process of designing and constructing prompts for machine learning models, such as natural language processing (NLP) models. A prompt is a piece of text or a sequence of words that is used to generate a response from an NLP model. The goal of prompt engineering is to create prompts that are effective at eliciting meaningful and accurate responses from the model.

Key Considerations:

Ensuring that the prompt is clear and unambiguous

Choosing words and phrases that are representative of the content and purpose of the model

Structuring the prompt in a way that is easy for the model to understand and generate a response to

Testing and iterating on the prompt to improve its effectiveness

Prompt engineering is a critical aspect of building and maintaining machine learning models, as the quality and effectiveness of the prompts can have a significant impact on the accuracy and usefulness of the model. By carefully designing and constructing prompts, it is possible to improve the performance and capabilities of an NLP model and make it more useful for a variety of applications.

Here are some specific examples of prompt engineering for natural language processing models (Like ChatGPT):

Creating a prompt for a language translation model: In this case, the prompt might be a sentence or phrase in one language that the model should translate into another language. For example: "The cat sat on the mat." (English) => "Le chat était assis sur le tapis." (French)

Designing a prompt for a customer service chatbot: In this scenario, the prompt might be a question or statement from a customer that the chatbot should respond to. For example: "I'm having trouble logging into my account. Can you help me?"

Constructing a prompt for a language generation model: In this case, the prompt might be a set of keywords or a topic that the model should use to generate a piece of text, such as a news article or a social media post. For example: "How to make the perfect grilled cheese sandwich"

Developing a prompt for a sentiment analysis model: In this scenario, the prompt might be a piece of text, such as a review or a comment, that the model should analyze to determine the sentiment (positive, neutral, or negative) expressed in it. For example: "I had a terrible experience at this restaurant. The service was slow and the food was overcooked." (negative sentiment)

These are just a few examples of the types of prompts that can be designed and constructed as part of the process of prompt engineering for natural language processing models. The specific details and requirements of the prompts will depend on the specific goals and capabilities of the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment