Self-Reflection

Self-reflection, in the language-model sense, is the practice of having a model examine its own output (an answer, a plan, a piece of code, a failed attempt) produce a critique, and then use that critique to try again. Nothing in the model's weights changes: the "learning" lives entirely in the text of the prompt, where the critique is appended so the next attempt can condition on it. The idea borrows its framing from human metacognition, but mechanically it is just a loop of generate, critique, and regenerate, all carried out with ordinary next-token prediction.

Reflexion (Shinn, Cassano, Berman, Gopinath, Narasimhan and Yao, 2023) turned self-reflection into a form of "verbal reinforcement learning" for agents: after a failed trial, the model writes a short natural-language lesson about what went wrong, stores it in an episodic memory buffer, and reads it at the start of the next trial. The signal that triggers reflection comes from the environment, such as a failing unit test, a game that ended badly, or a binary success flag, so the agent is not grading itself from nothing. Reported results covered sequential decision-making tasks, reasoning questions, and code generation, including strong gains on the HumanEval coding benchmark. The key design choice is that the reward is converted into words rather than into gradient updates, which makes the method cheap, inspectable, and usable with a closed API model that cannot be fine-tuned.

Self-Refine (Madaan et al., 2023) showed a related single-model recipe that needs no environment at all: the same model produces an initial output, writes feedback on it, and then rewrites the output using that feedback, iterating until a stopping condition. It was evaluated across seven tasks, including code optimization, dialogue response generation, sentiment reversal, and math reasoning, and judged outputs improved on most of them with strong base models. The pattern works best on tasks where quality is multi-dimensional and easy to critique in words, such as making a response more polite, more readable, or better structured, because the model can often spot a stylistic flaw more reliably than it can avoid it on the first pass.

Attempt 1
model writes code or an answer
Where the critique signal comes from
Reflexion
environment feedback: failed test, lost game, binary reward
Self-Refine
the same model critiques its own output in words
Huang et al. 2023 warning
with no external signal, reasoning often does not improve
Written reflection added to the prompt
weights stay frozen; memory is just text
Attempt 2 conditions on the critique
improves only if the critique was correct

Huang et al. (2023, "Large Language Models Cannot Self-Correct Reasoning Yet") put a hard limit on the whole approach: when a model must decide for itself whether its reasoning is wrong, with no external feedback, performance on reasoning benchmarks generally does not improve and can get worse. Their analysis argued that earlier positive results often leaked information, for example by using ground-truth labels to decide when to stop revising, or by comparing against weak first-pass prompts. When the stopping signal comes from the model itself, it frequently talks itself out of a correct answer as readily as it fixes a wrong one, because the same blind spots that produced the mistake also judge the correction. This is why the literature now distinguishes intrinsic self-correction (no outside signal) from extrinsic self-correction (tests, tools, retrieved facts, or a separate verifier).

The practical lesson is that self-reflection is only as good as the grounding of its critique. Code agents that run a test suite and feed the traceback back to the model gain a lot, because the traceback is real evidence. Pure "check your work" prompts on a math problem gain little, because the checker has no more information than the solver. Neighbouring techniques separate the roles: a verifier-model scores candidate solutions, a reward-model supplies preferences, and reasoning models trained with reinforcement learning learn to backtrack inside a single long chain of thought, which is a trained cousin of reflection rather than a prompt-level trick.

A common misconception is that a model which writes a confident, articulate critique has therefore understood its error. Critiques can be fluent and wrong, can invent flaws that do not exist, and can sycophantically approve flawed work. Each extra round also costs tokens and latency, and long accumulated reflections can drift or contradict earlier ones. A sober engineering default is to reflect only when there is an independent signal to reflect on, to cap the number of rounds, and to measure whether accuracy actually rose against a no-reflection baseline of equal compute.

Read self-reflection as feedback written in words rather than gradients: a model can only improve its next attempt to the degree that the critique carries real information the first attempt lacked, which is why Reflexion's grounded signals tend to help while ungrounded self-correction, as Huang et al. showed, often does not.

Take self-reflection further

Ask the copilot about this term, or have our engineers assess it against your process.