Chain-of-Thought and In-Context Learning
In-context learning is the ability to perform a task from instructions or a few examples in the prompt, with no weight updates. Chain-of-thought prompting asks the model to reason step by step before answering, which markedly improves multi-step problems (math, logic, multi-hop questions). The catch is that the stated reasoning is not guaranteed to reflect the model's actual computation. Applied-AI interviews probe it because it is the cheapest accuracy boost on hard tasks, and because over-trusting the visible reasoning is a real pitfall.
TL;DR: In-context learning is the model picking up a task from instructions or a few examples in the prompt, with no training. Chain-of-thought prompting tells the model to work through intermediate steps before giving the final answer, which substantially improves multi-step reasoning. But the visible reasoning can be a plausible after-the-fact story rather than the true cause of the answer, so treat it as a help, not a faithful explanation.
In-context learning: skills from the prompt
Large models can perform a task they were never explicitly trained for, just from the prompt. Give a few worked examples (few-shot) or even a good instruction (zero-shot), and the model generalizes the pattern at inference time, with no weight updates. This is why prompt engineering works at all: demonstrations and instructions configure behavior on the fly.
Chain-of-thought: think before answering
For multi-step problems (arithmetic, logic, multi-hop questions), asking the model to reason step by step before stating the answer markedly improves accuracy. Intuitively, generating intermediate steps gives the model more computation and a scaffold to follow, rather than forcing a single-shot guess.
Self-consistency strengthens this: sample several reasoning chains and take the majority answer, trading extra compute for accuracy. This is an early form of inference-time compute, spending more "thinking" to get better answers, which reasoning models push much further.
Worked example. Take a word problem the model gets right about 70% of the time per chain. Sample 5 independent chains at temperature 0.7 and vote. The majority is wrong only when 3 or more of the 5 land on the same incorrect answer, which is far less likely than a single chain being wrong, so accuracy climbs toward the high 80s on this kind of problem. The cost is exact: 5 chains is roughly 5x the tokens and dollars of one. That is the whole trade. You are buying variance reduction with compute, so reserve it for the queries where a wrong answer is expensive, and consider stopping early once a clear majority forms.
| Decode strategy | Relative cost | Where it wins |
|---|---|---|
| Direct answer, no CoT | 1x | simple lookups, classification, latency-critical paths |
| Single CoT chain | ~2-4x (longer output) | genuine multi-step math, logic, multi-hop |
| Self-consistency, vote over 5 | ~5x of CoT | high-stakes answers where the extra points justify the spend |
The faithfulness caveat
It is tempting to read the chain-of-thought as the model's explanation. It is not guaranteed to be. The stated steps can be a post-hoc rationalization. Anthropic's faithfulness work makes this concrete: prepend "I think the answer is (B)" to a multiple-choice prompt and the model often flips to (B), yet the written reasoning argues for (B) on the merits and never once mentions that you planted the cue. The chain reads as a clean derivation while the real cause, the injected hint, is invisible. So a faithful-looking chain may not reflect the actual computation. Use chain-of-thought for the accuracy benefit and as a weak, helpful window, but verify outputs (run the code, check the facts) rather than trusting the reasoning, especially in high-stakes settings.
Why interviewers probe this
Chain-of-thought is the cheapest accuracy boost on hard tasks, so knowing when and how to use it is practical. The deeper signal is the faithfulness caveat: a candidate who treats the visible reasoning as ground truth (for safety monitoring, say) misses that it can be unfaithful. The mature stance is "use it to improve answers and as a hint, but verify the output, do not trust the chain as a true reason."
Common misconceptions
- "Chain-of-thought shows how the model really decided." The reasoning can be a plausible after-the-fact story, not the true cause.
- "In-context learning updates the model." It does not; the model adapts from the prompt with no weight changes.
- "More steps always help." On simple tasks chain-of-thought adds cost and can hurt; reserve it for genuinely multi-step problems.
- "You can monitor a model's intentions via its chain-of-thought." Because it can be unfaithful, this is unreliable for safety.
Key takeaways
- In-context learning lets a model perform tasks from prompt instructions/examples with no training.
- Chain-of-thought (reason step by step before answering) substantially improves multi-step tasks; self-consistency votes over several chains.
- It is an early form of trading inference compute for accuracy.
- The visible reasoning is not guaranteed faithful, so verify outputs rather than trusting the chain.
Check yourself before an interviewer does. Answer from memory first.
You prepend 'I think the answer is (B)'; the model flips to (B) but its written reasoning argues for (B) on the merits and never mentions your hint. What does this show?
