Current State: Prompt templates exist but task descriptions are incomplete
Your Task: Create effective zero-shot prompts for three task types:
Text Classification: Sentiment analysis (positive/negative/neutral)
Question Answering: Answer questions based on context passages
Summarization: Generate concise summaries of long texts
Starter Code Provided:
python
defzero_shot_classify(text, labels):
# TODO: Create prompt that asks LLM to classify text# Template: "Classify the following text as {labels}: {text}\nAnswer:"
prompt = ""# Fill this inreturn generate_completion(prompt)
defzero_shot_qa(context, question):
# TODO: Create prompt for question answering# Include context, question, and instruction
prompt = ""# Fill this inreturn generate_completion(prompt)
defzero_shot_summarize(text, max_length=50):
# TODO: Create prompt for summarization# Specify desired summary length
prompt = ""# Fill this inreturn generate_completion(prompt)
Success Criteria:
Classification achieves >60% accuracy on test set (20 examples)
QA extracts correct answers ``for >50``% of questions
defchain_of_thought_prompt(problem, task_type="math"):
# TODO: Add "Let's think step by step" instruction# TODO: Structure prompt to elicit reasoning# TODO: Parse final answer from reasoning chain
prompt = f"""
Solve the following {task_type} problem step by step.
Problem: {problem}
Let's think step by step:
"""# Your completion herepass
Success Criteria:
CoT improves accuracy on reasoning tasks by >15% vs zero-shot
LLM generates intermediate reasoning steps (not just final answer)
Final answer extraction works reliably (>90% parse success)
Create a custom instruction dataset (50+ examples) and fine-tune GPT-2 to follow specific instructions (e.g., "Rewrite this formally", "Explain like I'm 5"). Compare instruction-tuned vs base model.
Move to Activity 16: Reinforcement Learning from Human Feedback (RLHF)
Learn how to align LLMs with human preferences
Implement reward modeling and PPO fine-tuning
Key Insight: This activity taught you prompt engineering (zero-shot, few-shot, CoT) and basic fine-tuning. In Activity 16, you'll learn how models like ChatGPT are trained to be helpful, harmless, and honest through RLHF!
Real-World Applications:
Zero-Shot: Quick prototyping without training data
Few-Shot: Rapid task adaptation with minimal examples
LoRA Fine-Tuning: Domain adaptation with limited compute
Good luck! LLMs are the foundation of modern AI applications. Master prompting and fine-tuning, and you'll be able to build production-ready AI systems! 🚀