How Few-Shot Prompting Can Transform Language Learning With ChatGPT
Get exactly the type of answer you want, in the format you want
New developments in AI keep surprising me. From the incredible images we can get from Dall-E 3 and the new version of Adobe Firefly, to the countless possible use cases of ChatGPT-Vision and ChatGPT-Voice,1 it’s all evolving incredibly fast. And I’m here for it.
But the new isn’t the only thing worth digging into. The “old2” shouldn’t be forgotten.
Because using these tools well means relying on basic known techniques.
One of those is few-shot prompting.
Zero-One-few-waytoomany shots
The most basic research into learning to prompt will get you to expressions like zero-shot and few-shot prompting.
What is it?
Basically, this is about giving examples of how you want the AI to respond. A “shot” could be called an example.
Zero-shot prompting means you’re only asking your question and letting the AI free reign regarding how to reply. This can be useful sometimes but, we’re often looking for specificity when using tools like ChatGPT.
Let’s say I’m learning to figure out genders in German more easily. As a French speaker, I know a few endings can be typical of a gender and I’m curious about this. I can ask ChatGPT for help:
I got my answer but it’s also a lot of text, vague tips, and 3 tips about noun endings. Fine but not great.
A one-shot prompt is, you guessed it, a prompt in which one example was given. It’s a nudge to the system you want the answer in a certain way.
For example, I could show what matters to me by giving a “shot” of French:
Now. I got my answer and more about noun endings. Great. But can’t we get better?
Few-shot prompting comes to the rescue.
No need to dive too much into what it is. You already got it. It’s just about giving more examples. Let’s see how it goes when I add Italian:
Now that’s more like it. It follows the requested style and gives me the information in shorter bullet points.
Is this the easiest way to get this answer? Not in this case—see at the bottom for an easy prompt to get an even clearer answer.
And yet, few-shot prompts can be a great tool when format matters to you. The more “shots” you give, the more likely the AI will respond in the exact format with the type of information you’ve requested.
For this example, I later tried adding Spanish as an example too, and got the patterned answer more often. Adding more would have made it even more consistent.
As a self-learner, you have to decide and experiment with how many shots become too time-consuming for you. I usually stick to around 4 but you could add even more and save them to reuse easily in the future!
Language learning on steroid shots
Now, let’s talk about two examples I think every language learner could add to their arsenal.
One of my favorite ways to practice my conversation skills with ChatGPT is to have a conversation with it on a number of topics. It’s an easy way to use the language, make errors, and not feel ashamed one bit—or at least not in front of someone.
But what happens when you want to have feedback on what you say? Do you have to stop the conversation or ask in another one? Not automatically. There’s another way:
Prompt: [Sentence in target language]
ChatGPT:
Feedback: [Correction of my sentence if it's not using the highest level of politeness possible]
Answer: [Answer]
Question [New question on the topic to keep the conversation going]
Prompt: [Sentence in target language]
ChatGPT:
Feedback: [Correction of my sentence if it's not using the highest level of politeness possible]
Answer: [Answer]
Question [New question on the topic to keep the conversation going]
Prompt: ENTER YOUR SENTENCE TO START THE CONVERSATION
By giving a few shots as examples, I can make sure every time ChatGPT answers me, I’ll first get a correction of my sentence before getting the answer and follow up on the conversation.
If a correction brings questions to me, I can choose:
to keep going in the language and learn directly in my target language
to ask in English about the change and, once I understand the change, come back to my prompt to edit it and restart the conversation where I had left it.
Obviously, a learner of a new language might struggle even to create the sentence itself. You can then ask ChatGPT to give you both the language you’re learning from and your target languages in each answer:3
Prompt: [Sentence in English]
ChatGPT:
Translation: [Sentence in TARGET LANGUAGE]
Answer: [Answer to the sentence in TARGET LANGUAGE]
Question [New question on the topic to keep the conversation going in TARGET LANGUAGE]
[Translation of Answer]
[Translation of Question]
Prompt: [Sentence in English]
ChatGPT:
Translation: [Sentence in TARGET LANGUAGE]
Answer: [Answer to the sentence in TARGET LANGUAGE]
Question [New question on the topic to keep the conversation going in TARGET LANGUAGE]
[Translation of Answer]
[Translation of Question]
Prompt: [YOUR SENTENCE IN ENGLISH TO START THE CONVERSATION]
As mentioned in a previous piece, you can now choose to enter these directives into the Custom Instructions. While not required, doing this makes GPT-3.5 follow this rule much more consistently throughout a long conversation. GPT-4 would follow it quite well either way.
Final thoughts
Few-shot prompting is a simple technique that can be used for pretty much anything. It’s a convenient way to force structure onto a conversation or—if you decide it to be—a study session.
I gave you two examples but don’t hesitate to let your mind run wild. This can be used for pretty much anything you could imagine. Here are a few more potential use cases:
Getting a simplified summary for a text you enter — great for working on tough texts
Getting a longer sentence for your prompt
Getting a more/less polite version of sentences
Getting sentences transformed into another tense
Getting example sentences for grammar patterns
And many more!
So, if you’ve only ever asked direct questions or had simple conversations with ChatGPT in your target language, why not bring your experience to the next level?
Cheers for reading!
Have you ever used one-shot or few-shot prompting? Did you find a useful way to make the best of it for language learning or some other application? Let me know!
Side note: GPT-4 is much more capable of noticing the patterns. As a result, fewer shots are needed to get an answer in a specific pattern.
Currently, unfortunately, limited to Premium users but, one day, open to all.
I mean, are techniques only a few years old really “old”? I guess in this space, that’s the case but you know what I mean.
Experiment and don’t hesitate to regenerate a few times at first so you get the format you want as an answer. Also, don’t forget to replace the capital text with what you want.