Criação de prompts zero-shot e few-shot
Domine técnicas de criação de prompts que não exigem exemplos (zero-shot) ou exigem apenas alguns exemplos (few-shot) para obter o comportamento desejado do modelo.
Criação de prompts zero-shot e few-shot é uma aula grátis de Prompt Engineering & LLM Optimization for Developers no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Prompt Engineering & LLM Optimization for Developers, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Prompt Engineering & LLM Optimization for Developers inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
Guiding LLMs with Examples
LLMs often need guidance. With zero-shot you give the task and no examples; with few-shot you include a few examples to show what you expect.
Zero-shot: Relying on Knowledge
Zero-shot prompting gives a task with no examples - the model leans entirely on its pre-trained knowledge. Efficient, and great for common, straightforward tasks.
Zero-shot in Action: Summarization
Here's a zero-shot summarization prompt: no example summaries, just the task. The model relies on its general grasp of summarizing.
Summarize the following text in one sentence:
"The quick brown fox jumped over the lazy dog. This action demonstrated the fox's agility and the dog's relaxed nature. It was a sunny afternoon, perfect for such playful antics."Zero-shot: Sentiment Analysis
Zero-shot shines for sentiment analysis too - just name the task and the model classifies it. Perfect for quick checks without specialized categories.
Classify the sentiment of the following product review as Positive, Negative, or Neutral:
"The battery life is terrible, but the camera is surprisingly good."When Zero-shot Falls Short
Zero-shot has limits: custom output formats, multi-step reasoning, ambiguous tasks, and consistency across queries can all trip it up. That's where few-shot helps.
Few-shot: Learning from Examples
Few-shot prompting includes a few input-output examples right in the prompt. They demonstrate the pattern, style, or format, boosting accuracy on tricky tasks.
Structuring Few-shot Prompts
A few-shot prompt is: instruction, a couple of input/output examples, then your new input. Keep examples clear, concise, and representative.
Instruction:
Input: Example 1 Input
Output: Example 1 Output
Input: Example 2 Input
Output: Example 2 Output
Input: Your New Input
Output:Few-shot in Action: Structured Output
Want JSON output? Few-shot nails it - the examples below pin down the exact structure for sentiment and confidence, so the model copies the shape.
Classify the sentiment of the following reviews and output as JSON:
Review: "This movie was fantastic!"
Output: {"sentiment": "Positive", "confidence": "High"}
Review: "I didn't like it at all."
Output: {"sentiment": "Negative", "confidence": "High"}
Review: "It was okay, nothing special."
Output: {"sentiment": "Neutral", "confidence": "Medium"}
Review: "The product worked sometimes, but often failed."
Output:Few-shot: Consistent Tone & Style
Few-shot is ideal for tone and style: hard to describe "quirky," easy to show. These examples teach the model a short, punchy headline voice.
Rephrase the following sentences into a short, catchy, and slightly quirky headline:
Original: "A group of scientists discovered a new species of glowing mushroom in the Amazon rainforest."
Headline: "Amazon Glow-Shroom Shines!"
Original: "The city council decided to ban plastic bags to protect the environment."
Headline: "Bag the Bags: City Goes Green!"
Original: "A new study suggests that eating chocolate can improve your mood."
Headline:Zero-shot vs. Few-shot: Choosing Your Tool
Choosing: zero-shot for simple, common tasks and lower cost; few-shot for specific formats, niche knowledge, and when consistency really matters.
Quick Check on Prompting
You need an LLM to extract specific data from customer reviews (e.g., product name, issue type, suggested improvement) and output it as a structured JSON object. Which prompting technique would be most effective?
Recap: Master Your Prompts!
Recap: zero-shot is quick and efficient for general tasks; few-shot uses examples to lift accuracy and consistency on complex ones. Match the tool to the job.
Perguntas Frequentes
A aula “Criação de prompts zero-shot e few-shot” é grátis?
Sim — o texto completo de “Criação de prompts zero-shot e few-shot” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Prompt Engineering & LLM Optimization for Developers, atualize para CoddyKit PRO. O curso de Prompt Engineering & LLM Optimization for Developers inclui 4 aulas no total.
O que vou aprender em “Criação de prompts zero-shot e few-shot”?
Domine técnicas de criação de prompts que não exigem exemplos (zero-shot) ou exigem apenas alguns exemplos (few-shot) para obter o comportamento desejado do modelo. Você pratica Prompt Engineering & LLM Optimization for Developers com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Prompt Engineering & LLM Optimization for Developers?
Nenhuma experiência prévia é necessária. Prompt Engineering & LLM Optimization for Developers no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.
Quanto tempo leva a aula “Criação de prompts zero-shot e few-shot”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Prompt Engineering & LLM Optimization for Developers?
Sim. Cada aula de Prompt Engineering & LLM Optimization for Developers inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Introdução aos LLMs e à criação de prompts
- Estruturas básicas de prompts
- Criação de prompts zero-shot e few-shot
- Armadilhas Comuns na Criação de Prompts e Como Evitá-las