AI & Machine Learning

Stop Building Prompts Like You're Guessing, In-Context Learning is Actually a Skill

A

Adil Sher

Author

Nov 2, 2026
4 min read
0 views
Stop Building Prompts Like You're Guessing, In-Context Learning is Actually a Skill

I spent three weeks last month rebuilding a content classification system because I kept treating my LLM like a magic box. I'd throw different prompts at it, get inconsistent results, then blame the model. Then I realized I wasn't actually teaching it anything, I was just hoping. That's when in-context learning clicked for me, not as a concept, but as a practical discipline.

Most developers I know treat LLM prompts like we treat Stack Overflow, ask, get an answer, move on. But there's a real difference between getting lucky with a prompt and actually understanding how to guide a model toward consistent behavior. In-context learning isn't some exotic AI concept. It's the operational reality of how we interact with these models every single day.

What In-Context Learning Actually Is (And Why It Matters to Us)

In-context learning means you're not modifying the model itself. You're showing it examples directly in your prompt, and the model patterns-matches its way to an answer based on what you've demonstrated. No retraining, no fine-tuning, no waiting for infrastructure, just examples in, prediction out.

The key insight: the model's internals stay frozen. It's not learning permanently. It's contextually adapting. That distinction matters because it means every prompt is isolated. Add new examples tomorrow, and yesterday's prompt is meaningless to the model. This is liberating and limiting at the same time.

Compare this to traditional model fine-tuning, where you'd feed hundreds of labeled examples to actually update the model's parameters. That's expensive, slow, and requires ML infrastructure. In-context learning is basically "show, don't tell, and do it in the prompt where the model can see it."

How This Actually Works in Production

Here's what I've learned from building with this in mind. When I needed to classify customer support tickets by urgency, I couldn't just say "classify this as urgent or not." The model would guess randomly or use its training bias.

So I built a prompt with three examples:

import anthropic

client = anthropic.Anthropic(api_key='YOUR_API_KEY')

prompt = """Classify support tickets by urgency level: high, medium, or low.

Example 1:
Ticket: "The payment system is down and no one can checkout"
Urgency: high

Example 2:
Ticket: "I'd like to request a feature to export reports as PDF"
Urgency: low

Example 3:
Ticket: "I'm getting random timeout errors when uploading files"
Urgency: medium

Now classify this ticket:
Ticket: "Our API integration keeps returning 500 errors intermittently"
Urgency:"""

response = client.messages.create(
 model="claude-3-5-sonnet-20241022",
 max_tokens=10,
 messages=[
 {"role": "user", "content": prompt}
 ]
)

print(response.content[0].text.strip())

The pattern is simple: I showed the model what "high," "medium," and "low" look like in context. Then it classified the new ticket by pattern matching. No retraining. No API calls to fine-tune endpoints. Just demonstration through examples.

My Take: Where This Breaks Down

Here's what the article doesn't emphasize enough: in-context learning is brittle. It works beautifully for simple, well-defined patterns. Classification with clear examples? Great. But when your task is ambiguous or your examples are inconsistent, the model will confidently produce garbage.

I tried using in-context learning for sentiment analysis on product reviews last month. The problem: sentiment is subjective. My examples captured my interpretation, not necessarily the right one. The model followed my bias perfectly. That's not a feature, that's a failure mode.

The other limitation that hits in production: token limits. If you need dozens of examples to establish a reliable pattern, your prompt balloons. LLMs have finite input lengths. You can't just keep adding examples infinitely. Eventually, you hit the wall and have to fine-tune or accept worse performance.

That said, I'm bullish on in-context learning for rapid iteration. Before committing to fine-tuning infrastructure, I can prototype almost anything with good examples. It's the fastest feedback loop for LLM-based features.

The Question I'm Still Wrestling With

If in-context learning is just sophisticated pattern matching from examples, how do I know when I have enough examples? I've seen the model nail classification with three examples and fail spectacularly with five bad ones. There's no formula. It's intuition built on experimentation.

What's your experience? Are you building with in-context learning in production? Have you hit the wall where you realized you needed actual fine-tuning?

Source: This post was inspired by "Day 43: In-Context Learning Explained" by Dev.to. Read the original article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

Why Your AI Project Will Fail at Scale (And How to Stop It Before It Does)
AI & Machine Learning Nov 1

Why Your AI Project Will Fail at Scale (And How to Stop It Before It Does)

Last year, I watched a team in our organization build what looked like a brilliant AI chatbot. The PoC was genuinely impressive, answered questions, integrated with their knowledge base, demoed perfectly to stakeholders. Three months later, it was quietly shelved. Not because the...

We're All Living in Someone Else's Model Now
AI & Machine Learning Oct 30

We're All Living in Someone Else's Model Now

Last month, I was debugging a feature in our API layer when a colleague asked me a question that stuck with me: "If we expose our endpoint responses, can someone just scrape them and build a competitor?" I laughed it off, we're a small fintech team in Islamabad, not OpenAI. But th...