> For the complete documentation index, see [llms.txt](https://docs.themspkb.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.themspkb.com/ai-for-msps/foundational-ai-concepts/in-context-learning.md).

# In-Context Learning

### Summary

**In-context learning** is the ability of a [large language model](/ai-for-msps/foundational-ai-concepts/large-language-models.md) to perform a new task purely from instructions or examples placed in its prompt — with **no gradient updates and no retraining**. Named and demonstrated in the 2020 GPT-3 paper, it comes in three flavors: **zero-shot** (just an instruction), **one-shot** (one worked example), and **few-shot** (a handful of examples). It is the reason you can "teach" ChatGPT a format or a classification rule just by showing it a couple of samples in your message. In-context learning is also the practical foundation of **prompt engineering**.

### In plain terms

Before GPT-3, adapting a model to a task meant **fine-tuning** — collecting thousands of labeled examples and retraining a copy of the model (the [BERT](/ai-for-msps/foundational-ai-concepts/bert.md) / [Pretraining and Fine-Tuning](/ai-for-msps/foundational-ai-concepts/pretraining-and-fine-tuning.md) approach). GPT-3 showed a different path: describe the task in plain language, optionally give a few examples, and the model just does it.

* **Zero-shot:** *"Classify this ticket as billing, technical, or sales: …"* — instruction only.
* **One-shot:** the instruction plus a single solved example.
* **Few-shot:** the instruction plus several solved examples the model pattern-matches against.

Nothing about the model changes — the "learning" happens entirely within the single prompt and is forgotten afterward. GPT-3 found that this ability improves dramatically as models get larger: bigger models are far better few-shot learners.

### Why it matters for MSPs

* **It is why AI tools are configurable without code.** When a PSA/RMM feature lets you steer AI behavior with a "prompt" or "instructions" box, you are using in-context learning. No data-science team required.
* **It shapes what you paste into the prompt — and the privacy stakes.** Because the model learns from what is in the prompt, staff naturally paste real client data (tickets, logs, configs) to get better answers. That is exactly the exposure the [Data Handling & Privacy](/ai-for-msps/ai-security/data-handling-and-privacy.md) and [Governance & Acceptable Use](/ai-for-msps/ai-security/ai-governance-and-acceptable-use-policies.md) pages address.
* **It has real limits.** In-context learning is bounded by the model's **context window** (how much text it can consider at once) and is inconsistent — the same few examples can yield slightly different results, reinforcing the [human-in-the-loop verification](/ai-for-msps/ai-in-the-msp-stack/what-it-cant-do-yet.md) principle.
* **It is a cheaper first step than fine-tuning.** Before paying to fine-tune a model on your data, a well-crafted few-shot prompt often gets most of the way there — a useful cost lever for [implementation and ROI](/ai-for-msps/ai-in-the-msp-stack/where-it-shows-up/implementation-and-roi.md).

### Related concepts

[Large Language Models](/ai-for-msps/foundational-ai-concepts/large-language-models.md) · [Pretraining and Fine-Tuning](/ai-for-msps/foundational-ai-concepts/pretraining-and-fine-tuning.md) · [Transformer Architecture](/ai-for-msps/foundational-ai-concepts/transformer.md) · [RLHF and Alignment](/ai-for-msps/foundational-ai-concepts/rlhf-and-alignment.md)

**In the MSP KB:** [Data Handling & Privacy](/ai-for-msps/ai-security/data-handling-and-privacy.md) · [AI vs. Automation](/ai-for-msps/ai-in-the-msp-stack/ai-vs.-automation.md)

### Contradictions & debates

* **In-context learning vs. fine-tuning.** This is the head-to-head with the [BERT](/ai-for-msps/foundational-ai-concepts/bert.md) lineage. GPT-3 explicitly lists the downsides of fine-tuning — it needs task-specific datasets of thousands to tens of thousands of examples, and models can exploit spurious correlations in that data — and offers in-context learning as an alternative that needs neither. BERT's paradigm assumes the opposite: that fine-tuning per task is *the* way to reach state-of-the-art quality. In practice both survive; teams fine-tune when they have data and need consistency, and prompt when they need flexibility and speed.
* **Is it really "learning"?** The GPT-3 paper is careful with the term, and later researchers debate whether the model is genuinely *learning* the task or merely *retrieving and recombining* patterns already absorbed during pretraining. For MSP purposes the practical takeaway is the same: outputs are pattern-driven and must be verified.

### Source paper

Brown et al. (2020), *Language Models are Few-Shot Learners* — <https://arxiv.org/pdf/2005.14165>

***

**Key terms**: *in-context learning*, *zero-shot*, *one-shot*, *few-shot*, *prompt engineering*, *context window*.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.themspkb.com/ai-for-msps/foundational-ai-concepts/in-context-learning.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
