Reflection is an agentic design pattern in which a model (or another reviewer) critiques an initial output and uses that feedback to generate an improved version. The reflection loop continues until the output satisfies predefined criteria or a maximum number of iterations is reached. LLMs rarely produce the best answer on the first attempt. Reflection gives an opportunity to identify the mistakes and gaps before the revised response.
We can understand this in two ways.
Objective feedback
In objective evaluation, an external system verifies whether the generated output is correct.
Coding agent
Let's suppose we are building a Python code generator that generates functions for a given task
Just see the image above that shows a coding agent that generates code v1 in the first pass; then the runner runs the code. If any error comes, then with the error and code v1 passes to the LLM again, based on the feedback, produce a result again, and so on until the code runs or to max iterations.
Subjective feedback example
An agent that writes an essay
In this case, the reviewer or critic is an LLM, not any external tool; the input reviewer could be the same model(self), some other model, or a human.
Eval methods to evaluate the reflections
Objective Evals
We prepare a benchmark dataset containing inputs and expected outputs; if that passes, we consider the agent is ready.
e.g.
Above code-based example
Build a dataset and evaluate on that (SQL): We create an agent that generates the SQL queries.
Subjective Evals
Since quality is subjective, we provide the evaluator with clear evaluation criteria or a rubric so that it reviews the response consistently.
e.g.
Use an LLM as a guide to evaluate
Rubric-based, where you would define the rules step by step
Ref: Andrew Ng course



