Periagoge
Concept
3 min readself knowledge

Few-Shot Learning: Teaching AI Your Subject by Example

Few-shot learning with AI means providing a small number of examples that teach the model how to engage with your subject — the specific register, terminology, level of detail, and type of question most useful for your learning. This is more efficient than general prompting for learners with specialized needs. This concept covers few-shot prompting as a technique for rapidly calibrating AI to your specific learning context.

Hypatia
Why It Matters

Few-shot learning is a technique where you provide a small number of examples (typically 2-5) to show an AI model a pattern, and it learns to continue in that style without formal training. In educational contexts, this is powerful: you give the AI a few example problems solved by your professor, a few exam questions in your professor's style, or a few summaries at your preferred detail level, and it then generates new materials matching that pattern.

Unlike fine-tuning (which requires retraining the model on your data), few-shot learning works through in-context learning—the examples are included in the prompt itself, so the model adapts its behavior just for that conversation. This is immediate, requires zero technical infrastructure, and works with any language model.

Why Examples Beat Instructions

Telling an AI "generate questions like my professor does" is vague. Your professor might use multiple-choice, ask about applications rather than definitions, emphasize calculation over theory. These patterns are easier to show than to describe. Providing 3 exam questions from your professor, then asking "Generate 5 more questions in this style," gives the AI concrete patterns to match.

This works because language models are fundamentally pattern-matching systems. They're trained to predict the next token given context. When you include examples in the context, those examples become the most recent pattern the model has seen, so subsequent generations tend to match that pattern.

How to Structure Effective Few-Shot Prompts

Format consistency matters. If you provide examples like: "[Question] [Answer] [Explanation]," then provide the same structure for new prompts. The model learns the template from examples.

Diversity within examples helps. If all examples are easy, the model generates easy content. If examples vary in difficulty, the model tends to generate varied content. Three examples covering easy, medium, and hard cases often beats five examples all at the same level.

Label examples clearly. Instead of just showing a question and answer, explicitly mark them: "Example 1: [Question about photosynthesis (easy)]" makes patterns more obvious to the model.

When Few-Shot Works Brilliantly

Mimicking professor style: Show the model 3 past exams, ask it to generate new practice problems. Result: Practice problems matching your professor's preference for numerical vs. conceptual questions, specific topics emphasized, and difficulty calibration.

Preference learning: Show examples of summaries you liked versus summaries you didn't. The model learns your aesthetic (verbose vs. concise, examples-heavy vs. theory-focused, technical vs. approachable).

Terminology and context: Show the model how your textbook or professor uses specific terms, and it adapts. Economics courses define "utility" differently than philosophy courses. Few examples establish context.

Limitations and Why Few-Shot Isn't Perfect

Models tend to overgeneralize from examples. Provide two calculus integration problems solved by substitution, and the model might try to use substitution for every integral, ignoring when other techniques are more efficient. Few-shot learning creates strong patterns that sometimes become rigid.

Examples that contain errors get propagated. If you show an example with a subtle mistake, the model learns and reproduces that mistake. This is why using verified materials (actual past exams rather than your attempts) matters.

Few-shot also works better for format and style than for deep conceptual understanding. You can teach the model to generate questions in your professor's format. You can't easily teach it your professor's conceptual priorities with just examples.

Technical Note: Token Efficiency and Context Windows

Each example consumes tokens in the context window. A longer context window lets you include more examples (more patterns for the model to learn), but costs more. A 3-example prompt costs about 30% more than a zero-shot prompt. A 10-example prompt costs 100% more. Most educational use cases benefit from 3-5 examples; beyond that, diminishing returns.

Try this: Collect 4 practice problems from your course that you solved well. Ask ChatGPT: "I'll show you 4 example problems I did well on. Use these to understand my professor's style and what kind of problems I should practice. [Insert 4 examples]. Now generate 5 new practice problems matching this style." Compare the generated problems to recent assignments. Does the model capture the style? Difficulty? Topics? Experiment with different example selections and see how output changes.

Helpful guides
Hypatia
Daily Life & Decisions
Related Concepts
Peri
Questions about Few-Shot Learning: Teaching AI Your Subject by Example?

Peri can explain this concept, give practical examples, help you decide whether it applies to your situation, or recommend a journey if appropriate.

Ready to work on Few-Shot Learning: Teaching AI Your Subject by Example?

Explore related journeys or tell Peri what you're working through.