Basic Prompt Examples for LLMs

Elvis Saravia · Beginner ·🧠 Large Language Models ·2y ago

Key Takeaways

The video discusses basic prompt examples for Large Language Models (LLMs) and covers common tasks such as text summarization, information extraction, and question answering, using tools like the playground and Chat GPT. It also emphasizes the importance of prompt engineering for optimizing prompts and leveraging LLMs effectively.

Full Transcript

hi everyone so today I want to talk a little bit about some ways you can use large language models so far in our guide we have spoken about basics of prompting getting the right prompt elements and also we covered some general tips for Designing prompts in this particular section the goal is to provide you examples or more concrete examples of what I refer to as foundational tasks that these models are trained to perform really well and from a lot of these tasks we are now using all of us like developers are using these models to create even more complex workflows so these are very important tasks to be familiar with when working with large language moldes I think this is a great way to start to experiment and explore language moldes to understand what these moldes are capable of doing the the thing about working with large language models is that I think it's important for you to test out right what are the capabilities and what are not the capabilities to see if it's really suitable for your application so this is something I love teaching when we teach our course on prompt engineering for llms I love to talk about this the reason is because again as I mentioned if you understand these basic ideas and basic ways you can use these large large language models it could potentially inspire you to think more deeply about what else can you do with these models for your real world use cases so we're going to go through a few of these just to kind of talk more about what you can do with these models and how you might be able to prompt these models and perform some of these tasks and we will use the playground for for our examples so let's start with that so let's do something like basic example of text rization here um and just show you so let's say I want a model to explain to me a concept right so it's very very simple concept I'm going to actually just add it here um again I'm using the playground and um there's nothing too special about the way I'm prompting I'm just asking to explain antibiotics I'm using the right keyword here and then I just use this indicator for the model to just output the answer because that's what I expect the model to be be performing so it actually gave me a summary right so this is not a like a specific prompt it's not meant to be short this is the first iteration of this prompt and there's nothing too special about it but just wanted to show you how powerful these modes are at some things like explaining Concepts and so on that you may use in other more complex applications so that's the text summarization and there are more advanced ways you can do Tex summarization um I'm actually going to show you here another one so I'm going to take this and then I'm going to just past it in a system prompt right typically I start with a system prompt I system roll I really don't really need to get too complex with the prompting here is I really want to show you the capabilities more than anything so now I provided the model some information about antibiotics and then I asked it to explain the above in one sentence so you can think of it of this as an input you know and you can also add more information about antibiotics as context but this is very basic we wanted to keep it very basic just to show you the task of text harmonization and then I said explain the above in one sentence and the thing about this is that these balls are trained to perform this task really well so you have you should have an expectation that they should perform really well and you probably don't need to put a lot of effort into like prompting these models to do something like text summarization because they're expected to be able to do this task really well one thing that you may observe here is that I'm actually asking the model to explain the above in one sentence but I could also say to the model or prompt the model in a different way I could say something like explain the below paragraph in one sentence I could also do that right and this model will understand it's very robust in an understanding that this particular task it's still asking for text rization but notice that I'm asking it at the top instead of at the bottom and again it does perform the task relatively well and the difference here is the positioning of the instruction and as we have been explaining in our previous guides it's beneficial if you add the instruction towards the top of your prompt so our instruction is going to be this one and this is just going to be the input right and this is great because you you can basically Implement some type of standardization in the way you prompt this models and it's very useful there's also a lot of research around large language models that explain that it's better to actually put instructions at the top because these language models they tend to pay more attention to things that are towards the end or towards the beginning of the input data right The Prompt that you're Pro W in it so that's just a tip right there um that I can talk about in this particular um example and we have another one here is information Str this is one of my favorite ways of using large language models actually we use them a lot like for information extraction for a variety of use cases and clients that we work with so I want to take this and I want to show you as well how this works again I'm just copying and I'm pasting right right into my system prompt this is how you can basically start experimenting with some of the prompts that we share in our guide and here I have a similar thing right so I have this piece of context here right I haven't labeled it that this is a context this is this is something that you can improve right for readability purposes um but then at the bottom here I have an instruction that says mention the large language model based product mention in the paragraph above right so there is some kind of product here and if you look at our guide right the output is something like this this is the expected output which is going to be an explanation and then it says okay it's going to be chpt right so chbt is really the product here um but I could also again and I'll show you here I could take this right and I should expect to get the same output these mods are getting really well they understand regardless if the instruction is at the top or at the bottom um where these models actually perform p is when these instructions are layered one on top of each other or you may have an instruction say in the middle of a prompt and sometimes you end up in those situations with your promps because you are probably designing a lot of logic and you're instructing the mod to behave in certain ways or steering the all and you may end up with a bunch of instructions and some instructions that are in the middle of that prompt will probably be uh completely skipped by this mod and that's something that these mods are um kind of failing at and and we're improving them obviously especially for especially for bigger models and models that can handle long context we really need them to be able to perform every bit of instruction and understand what we are asking them to do um let me just hit submit here and let me show you here what so we got chat GPT right and know you can get more creative here and you can tell the model that you want the output to be in a specific format you don't just want the name of the product but you want it in you know maybe in a sentence or complete sentence you can also do that that's something you can do um you know you can either do it towards the bottom here just instruct them all to do it and then you can also do the dop but this is fascinating that these malls can do this it basically picks up the information from this and you you can continue testing this further if you like you can add more of these products right you can add chat GPT you can add Cloud you can continue testing to see how far you can take uh these models for this capability which is very useful and it's one of the more common ways and how we use large language models we talk about information instructure in our course a lot this is one of the areas where we go deep and we cover very Advanced use cases if you're interested in that and one more I wanted to do here is uh question answering there are a bunch of them text classification and so on uh we covered them in the course extensively but here I want to focus on question answering is our last example so I'm going to take this and again for each task notice that I'm providing some inside because each task is doing something different and there are different ways on how you might improve that task right sometimes it's about how you're asking sometimes it's where the instruction is uh sometimes it's how you're passing that data right we're not talking about that yet here this is why promp engineering is kind of really an important skill because that's you know that's where you will learn where to put data efficiently right where to uh how to structure your prom how to um kind of instruct your model to perform a specific task with a specific tone maybe a specific structure that you want there's just so many things that you may want from a task and what I'm covering here is really simple I must have bit but again this is why we cover this topic is of the importance of kind of optimizing your promp and leveraging these Ms in the right way all right so for this one notice that I have a context right so I actually took um this blurb I think it's an abstract or a piece of abstract from a nature paper this a scientific paper talking about um some drug or something like that and what I wanted to do is I actually provided this model some instruction here at the top so there's some expectation um about this model notice that this is a question answering task but I've actually done a bit more work here to refine the behavior that I want from this system because it matters for my application and this is what I want to inspire developers and researchers working with these models right or even if you're just using it for your personal use think about all the things that you can do with these models like these basic task such as you know doing analysis right doing text summarization and how you can combine them so here what I'm doing is I'm instructing this model uh answer the question based on the context below keep the answer short and concise you can literally instruct the model to do that and then respond unsure about answer if not sure about the answer so how is this useful where I'm actually steering the model and telling it the logic and telling it to follow this instruction well it's useful in the context of say something like a chatbot If This Were a chatbot that's actually pretty useful so you can imagine that maybe I'm interacting with some kind of chatbot that can help me you know study about you know these drugs or study about some kind of field like biology or something like that you know it's really useful to be able to instruct them all and steer them all towards the type of responses you want the multo response for your users so that's what I'm doing here so and then there is the question obviously question what was okay okay the tree originally Source from and then the answer would be here now look at how I've structured this right just take a second here to look at this now this was a standalone task right I could easily just test it here um okay and and mice is the right answer by the way so you can infer that mice is is the correct answer but imagine that you were developing a chatbot so how do you go from a very standard prompt like this and design something that would work more for a chatbot this is the entire point of the playground that you have these roles like system rle assistant role and user Ro where you can actually structure your prompt right so that it can support something like a chatbot interface or something like that for your application so how do I do that well you know for this one as I mentioned maybe it was some kind of analysis that I was doing right and and I have a bunch of questions that I want them all to answer but this is a very Standalone task in the sense that you know this doesn't have an interface for users it's not it's not meant to be consumed right it's meant just for me the researcher that's interested in the model helping me answer some questions about some papers or some research so how can I do that um I can go here and I can take this actually actually I'll take both of these and then I'm going to put it here here as part of user and then because I've structured it this way this model understands that the assistant will now just give me the answer to the question so I'm just submit here and look at it it's my it's the same response so I've just structured it a bit different and because I've structured it a bit different right this model is able to infer that okay you know at least in this setting it looks like a chb setting and now it's going to have a dialogue and I can continue asking question questions essentially obviously the way we're interacting with the model is a bit different from the way the user would interact with the model and what I mean by that is here I've added this indicators but really what the user was asking is this question right so that you can imagine there's like a chat interface the user is asking a question uh we get the question we structure the question further to be something like this because we know that these models can take this structure uh you know to their advantage because we know we're going to get more reliable responses so we need to be able to separate things here right we need to be able to separate what's the the input from the user um how we have structured this and how we have leveraged the user role and how we have leveraged the assistant role here and the assistant role as well so there are a couple of things that I said here hopefully it was clear but hopefully that inspires you to understand why it's important to understand these basic you know these basic tasks because they can evolve into something more complex which a lot of people are actually leveraging llms for right they're building chop Bots they're interacting with you know external tools they're interacting with your Enterprise data they're interacting with even their personal files on the computer so there are different efficient ways or effective ways on how you can interact with these models and there's going to be some effort in how you design your prompt to be able to get uh good results so that was the whole point of this video hopefully you got something from it and if you have any questions again as I mentioned just leave them in the comments in the YouTube page and I will be doing more of these so it helps if you like and share the videos as well um and you subscribe to the page that helps a lot so that's going to be it for this video thank you so much for listening again and see you on the next one

Original Description

Use code YOUTUBE20 to get an extra 20% off my new prompt engineering course here: https://dair-ai.thinkific.com/courses/introduction-prompt-engineering IMPORTANT: The discount is limited to the first 500 students. Discusses common basic LLM tasks Full guide: https://www.promptingguide.ai/introduction/examples #ai #llms #chatgpt #machinelearning #promptengineering
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Elvis Saravia · Elvis Saravia · 33 of 60

1 101 ways to solve search (by Pratik Bhavsar)
101 ways to solve search (by Pratik Bhavsar)
Elvis Saravia
2 TLDR Generation of Scientific Documents | ML Interview #1 with Isabel Cachola
TLDR Generation of Scientific Documents | ML Interview #1 with Isabel Cachola
Elvis Saravia
3 Sentiment Analysis: Key Milestones, Challenges and New Directions
Sentiment Analysis: Key Milestones, Challenges and New Directions
Elvis Saravia
4 Discriminative Adversarial Search for Abstractive Summarization (by Thomas Scialom)
Discriminative Adversarial Search for Abstractive Summarization (by Thomas Scialom)
Elvis Saravia
5 Question Understanding: COVID-Q: 1,600+ Questions about COVID-19
Question Understanding: COVID-Q: 1,600+ Questions about COVID-19
Elvis Saravia
6 Getting Started with NLP
Getting Started with NLP
Elvis Saravia
7 Building tools and frameworks for large-scale social media mining (by Dr. Juan M. Banda)
Building tools and frameworks for large-scale social media mining (by Dr. Juan M. Banda)
Elvis Saravia
8 TextAttack: A Framework for Data Augmentation and Adversarial Training in NLP
TextAttack: A Framework for Data Augmentation and Adversarial Training in NLP
Elvis Saravia
9 Dive into Deep Learning (Study Group): Introduction to Deep Learning | Session 1
Dive into Deep Learning (Study Group): Introduction to Deep Learning | Session 1
Elvis Saravia
10 Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Elvis Saravia
11 How I read and annotate ML papers
How I read and annotate ML papers
Elvis Saravia
12 Keep Learning ML  (Session 1) | DSV, CompLex, Modern tools for emotions
Keep Learning ML (Session 1) | DSV, CompLex, Modern tools for emotions
Elvis Saravia
13 Dive into Deep Learning (Study Group): Preliminaries | Session 2
Dive into Deep Learning (Study Group): Preliminaries | Session 2
Elvis Saravia
14 Keep Learning ML #2 | Language-conditioned policy learning, Effective ML Testing, EagerPy
Keep Learning ML #2 | Language-conditioned policy learning, Effective ML Testing, EagerPy
Elvis Saravia
15 Dive into Deep Learning (Study Group): Linear Neural Networks | Session 3
Dive into Deep Learning (Study Group): Linear Neural Networks | Session 3
Elvis Saravia
16 Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Dive into Deep Learning (Study Group): Multilayer Perceptrons | Session 4
Elvis Saravia
17 Keep Learning ML #3 | Contrastively Trained Structured World Models
Keep Learning ML #3 | Contrastively Trained Structured World Models
Elvis Saravia
18 Dive into Deep Learning (Study Group): Deep Learning Computation with PyTorch |  Session 5
Dive into Deep Learning (Study Group): Deep Learning Computation with PyTorch | Session 5
Elvis Saravia
19 Dive into Deep Learning (Study Group): Convolutional Neural Networks | Session 6
Dive into Deep Learning (Study Group): Convolutional Neural Networks | Session 6
Elvis Saravia
20 Dive into Deep Learning (Study Group): Modern CNNs | Session 7
Dive into Deep Learning (Study Group): Modern CNNs | Session 7
Elvis Saravia
21 101 ways to solve neural search with Jina
101 ways to solve neural search with Jina
Elvis Saravia
22 (Hopefully-Reusable) Life Lessons for PhD Students in NLP
(Hopefully-Reusable) Life Lessons for PhD Students in NLP
Elvis Saravia
23 How to save the world and forward your career in 5 easy steps | Women in NLP Talks
How to save the world and forward your career in 5 easy steps | Women in NLP Talks
Elvis Saravia
24 Prompt Engineering Overview
Prompt Engineering Overview
Elvis Saravia
25 Getting Started with the OpenAI Playground
Getting Started with the OpenAI Playground
Elvis Saravia
26 LM-Guided Chain of Thought
LM-Guided Chain of Thought
Elvis Saravia
27 Elements of a Prompt
Elements of a Prompt
Elvis Saravia
28 Reasoning with Intermediate Revision and Search with LLMs #chatgpt #ai #llms #science #programming
Reasoning with Intermediate Revision and Search with LLMs #chatgpt #ai #llms #science #programming
Elvis Saravia
29 General Tips for Designing Prompts
General Tips for Designing Prompts
Elvis Saravia
30 Efficient Infinite Context Transformers #ai #machinelearning #research #llms #science
Efficient Infinite Context Transformers #ai #machinelearning #research #llms #science
Elvis Saravia
31 Best Practices and Lessons Learned on Synthetic Data for Language Models #ai #machinelearning #genai
Best Practices and Lessons Learned on Synthetic Data for Language Models #ai #machinelearning #genai
Elvis Saravia
32 Reducing Hallucinations in Structured Outputs via RAG #chatgpt #ai #llms #programming
Reducing Hallucinations in Structured Outputs via RAG #chatgpt #ai #llms #programming
Elvis Saravia
Basic Prompt Examples for LLMs
Basic Prompt Examples for LLMs
Elvis Saravia
34 LLM In Context Recall is Prompt Dependent  #llms #ai #chatgpt #machinelearning
LLM In Context Recall is Prompt Dependent #llms #ai #chatgpt #machinelearning
Elvis Saravia
35 Zero-shot Prompting Explained
Zero-shot Prompting Explained
Elvis Saravia
36 RAG Faithfulness #llms #ai #gpt4
RAG Faithfulness #llms #ai #gpt4
Elvis Saravia
37 Understanding LLM Settings
Understanding LLM Settings
Elvis Saravia
38 Llama 3 is here! | First impressions and thoughts
Llama 3 is here! | First impressions and thoughts
Elvis Saravia
39 Llama 3 is Here! #ai #llms #llama3
Llama 3 is Here! #ai #llms #llama3
Elvis Saravia
40 Microsoft introduces Phi-3 | The most capable small language model?
Microsoft introduces Phi-3 | The most capable small language model?
Elvis Saravia
41 Microsoft introduces Phi-3! #ai #llms #microsoft
Microsoft introduces Phi-3! #ai #llms #microsoft
Elvis Saravia
42 Make Your LLM Fully Utilize the Context #ai #llms #machinelearning
Make Your LLM Fully Utilize the Context #ai #llms #machinelearning
Elvis Saravia
43 When to Retrieve? #ai #llms #machinelearning
When to Retrieve? #ai #llms #machinelearning
Elvis Saravia
44 Training an LLM to effectively use information retrieval
Training an LLM to effectively use information retrieval
Elvis Saravia
45 State-of-the-art open-source LLM judges #ai #machinelearning #gpt4
State-of-the-art open-source LLM judges #ai #machinelearning #gpt4
Elvis Saravia
46 Better and Faster LLMs via Multi-token Prediction
Better and Faster LLMs via Multi-token Prediction
Elvis Saravia
47 AlphaMath Almost Zero #ai #science #machinelearning
AlphaMath Almost Zero #ai #science #machinelearning
Elvis Saravia
48 SWE-Agent | An LLM-based Software Engineering Agent
SWE-Agent | An LLM-based Software Engineering Agent
Elvis Saravia
49 [LLM NEWS] AlphaFold 3, xLSTM, OpenAI's Model Spec, DeepSeek-V2, OpenDevin CodeAct 1.0
[LLM NEWS] AlphaFold 3, xLSTM, OpenAI's Model Spec, DeepSeek-V2, OpenDevin CodeAct 1.0
Elvis Saravia
50 LLM-powered tool for web scraping #ai #chatgpt #engineering
LLM-powered tool for web scraping #ai #chatgpt #engineering
Elvis Saravia
51 Learn about LLMs in this NEW course #ai #chatgpt #engineering
Learn about LLMs in this NEW course #ai #chatgpt #engineering
Elvis Saravia
52 [LLM NEWS] KANs, Gemma 10M Context, OpenAI Updates?, Automatic Prompt Engineering, Tokenizer Arena
[LLM NEWS] KANs, Gemma 10M Context, OpenAI Updates?, Automatic Prompt Engineering, Tokenizer Arena
Elvis Saravia
53 [LLM News] GPT4-o, Project Astra, Veo, Copilot+ PCs, Gemini 1.5 Flash, Chameleon
[LLM News] GPT4-o, Project Astra, Veo, Copilot+ PCs, Gemini 1.5 Flash, Chameleon
Elvis Saravia
54 Enhancing Answer Selection in LLMs #ai #machinelearning #engineering
Enhancing Answer Selection in LLMs #ai #machinelearning #engineering
Elvis Saravia
55 On exploring LLMs #ai #promptengineering #chatgpt
On exploring LLMs #ai #promptengineering #chatgpt
Elvis Saravia
56 Transformers Can Do Arithmetic with the Right Embeddings #ai #machinelearning #engineering
Transformers Can Do Arithmetic with the Right Embeddings #ai #machinelearning #engineering
Elvis Saravia
57 [LLM News] xAI Series B, Codestral, LLM Guide, AutoGen Course, Symbolic Chain-of-Thought
[LLM News] xAI Series B, Codestral, LLM Guide, AutoGen Course, Symbolic Chain-of-Thought
Elvis Saravia
58 PR-Agent #ai #gpt4 #software
PR-Agent #ai #gpt4 #software
Elvis Saravia
59 Extracting features from Claude 3 Sonnet
Extracting features from Claude 3 Sonnet
Elvis Saravia
60 Has prompt engineering been solved?
Has prompt engineering been solved?
Elvis Saravia

This video teaches the basics of prompt engineering for Large Language Models (LLMs) and covers common tasks such as text summarization, information extraction, and question answering. It emphasizes the importance of designing effective prompts for optimal results. By following the steps and using the tools mentioned, viewers can learn how to craft effective prompts and leverage LLMs for various tasks.

Key Takeaways
  1. Ask the model to explain a concept
  2. Use a system prompt to provide context to the model
  3. Instruct the model to answer a question based on a given context
  4. Structure a prompt with roles like system, assistant, and user
  5. Separate input from the user and how it is structured and leveraged in the prompt
💡 Designing effective prompts is crucial for getting good results from LLMs, and prompt engineering is an important skill for optimizing prompts and leveraging LLMs effectively.

Related AI Lessons

Your LLM Doesn’t Pick Stocks — It Remembers Them
Discover how LLMs remember stock picks rather than making actual predictions, and why this matters for AI-driven investment strategies
Medium · Machine Learning
Word Representation
Learn how word representation works in NLP and its importance in understanding human language, enabling applications like text classification and language translation
Medium · NLP
When Cosine Similarity Approaching Singularity in Google Search AI Mode
Learn how cosine similarity approaching singularity affects Google Search AI and unified knowledge graphs, and why it matters for AI engineers and data scientists
Medium · AI
When Cosine Similarity Approaching Singularity in Google Search AI Mode
Learn how cosine similarity approaching singularity affects Google Search AI and unified knowledge graphs, and why it matters for data science and AI development
Medium · Data Science
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →