G-Eval, Explained: How the LLM-as-a-Judge Method Scores, and Where It Breaks on Agents
G-Eval turns a written criterion into a score: the judge drafts its own evaluation steps, fills in a rating, and the rating is averaged over the model's probabilities. Here is the method, what it was tested on, and what changes when the thing being judged is an agent's trace.
G-Eval is a method for using a large language model as a judge of generated text. You give the model a task description and one evaluation criterion; it writes out its own step-by-step evaluation procedure, then rates the output by filling in a form, and the final score is the average of the possible ratings weighted by how likely the model thought each one was. It was introduced by Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu and Chenguang Zhu at Microsoft in the paper “G-Eval: NLG Evaluation using GPT-4 with Better Human Alignment”, posted in March 2023 and published at EMNLP 2023.
It is one of the most copied judge designs, and the pieces people copy (auto-generated evaluation steps, a form to fill in, a probability-weighted score) are worth understanding on their own, because each one behaves differently once the thing being judged is a multi-step agent run rather than a news summary.
G-Eval at a glance
| What it is | A prompt-based, reference-free evaluator: an LLM rates one output on one criterion |
|---|---|
| Paper | Liu et al., arXiv 2303.16634; EMNLP 2023 (Microsoft) |
| Judge models in the paper | GPT-3.5 (text-davinci-003) and GPT-4 |
| Tested on | Summarization (SummEval, QAGS) and dialogue response generation (Topical-Chat) |
| Output | A continuous score on the criterion’s scale (for example 1–5), not just an integer |
| Code | github.com/nlpyang/geval (MIT licence) |
How G-Eval works: three parts
The paper describes G-Eval as three components.
- A prompt that defines the task and one evaluation criterion, such as coherence, consistency, fluency or relevance, with the scale it is rated on.
- Auto chain-of-thought. Given only the task introduction and the criterion, the model is asked to write the “Evaluation Steps” itself. The paper’s point is that writing detailed steps by hand for every criterion and task is slow, and the model can draft them.
- A scoring function. The prompt, the generated steps, the input (the source article, or the conversation) and the output being judged are concatenated, and the model fills in a form, for example
- Coherence:, with a rating.
The coherence prompt from the paper’s appendix, abridged, shows the shape:
You will be given one summary written for a news article.
Your task is to rate the summary on one metric.
...
Evaluation Criteria:
Coherence (1-5) - the collective quality of all sentences. ...
Evaluation Steps:
1. Read the news article carefully and identify the main topic and key points.
2. Read the summary and compare it to the news article. ...
3. Assign a score for coherence on a scale of 1 to 5 ...
Source Text:
{{Document}}
Summary:
{{Summary}}
Evaluation Form (scores ONLY):
- Coherence:The steps are generated once per criterion and then reused as part of the prompt for every output scored. That detail matters later: if your tooling regenerates them on every run, the rubric itself changes between runs.
The scoring formula
Asking a model for a 1–5 rating directly has two problems, which the paper names. One rating tends to dominate (a 3 on a 1–5 scale, say), so scores have little variance; and models usually return integers even when asked for decimals, so many outputs tie. G-Eval’s fix is to read the probability the model assigns to each possible rating and take the expected value:
score = Σ p(sᵢ) × sᵢ over every rating sᵢ on the scaleAn illustration with made-up numbers: if the model puts 60% of its probability on 3, 30% on 4 and 10% on 2, the score is 0.6×3 + 0.3×4 + 0.1×2 = 3.2. Two outputs that would both have been “3” now separate.
There is a catch the paper states plainly: GPT-4 did not expose token probabilities when the work was done. For the GPT-4 runs, the authors sampled 20 ratings per output (n=20, temperature 1, top_p 1) to estimate the probabilities. If your judge model’s API does not return log probabilities, sampling and averaging is the same workaround, at n times the cost. Whether a given model and endpoint return log probabilities, and how many alternatives per token, is in your provider’s API documentation.
import math
def g_eval_score(top_logprobs: dict[str, float], scale=range(1, 6)) -> float:
"""Probability-weighted G-Eval score from the rating token's top log probabilities.
top_logprobs maps candidate tokens ("1", "2", ...) to log probabilities, as
returned for the single rating token. Tokens outside the scale are ignored and
the rest are renormalized so the weights sum to 1.
"""
probs = {s: math.exp(top_logprobs[str(s)]) for s in scale if str(s) in top_logprobs}
total = sum(probs.values())
if total == 0:
raise ValueError("no rating token on the scale among the top log probabilities")
return sum(s * p for s, p in probs.items()) / total
def sampled_score(ratings: list[int]) -> float:
"""The fallback when the model returns no log probabilities: sample the rating
n times at temperature 1 and average. The mean estimates the same weighted sum."""
return sum(ratings) / len(ratings)What the paper found
- Better agreement with human ratings than earlier metrics. On SummEval, G-Eval with GPT-4 reached an average summary-level Spearman correlation of 0.514 with human judgments, above ROUGE, BERTScore, BARTScore, UniEval and GPTScore in the paper’s table. It also led on Topical-Chat and on the QAGS hallucination benchmark on average.
- Chain-of-thought helped. On SummEval, G-Eval with GPT-4 scored higher with the generated evaluation steps than without them.
- Probability weighting helped rank order, with a caveat. Weighting raised Spearman correlation but lowered Kendall-Tau. The authors explain that integer ratings create ties, which Kendall-Tau does not count against a metric, so the unweighted version looks better on that statistic without ranking better.
- Model size mattered for harder criteria. GPT-3.5 did poorly on the consistency (hallucination) benchmark where GPT-4 did well; on dialogue, the two were close.
- It prefers LLM-written text. G-Eval with GPT-4 gave higher scores to GPT-3.5 summaries than to human-written ones even where human judges preferred the human summaries. The authors warn that using such a judge as a reward signal could reinforce the model’s own habits.
All of these results are on summaries and single dialogue turns, scored one criterion at a time. None of the benchmarks contain tool calls, plans or multi-step runs.
G-Eval in DeepEval
Most engineers meet G-Eval through DeepEval’s GEval metric. Its documentation describes how it maps onto the paper:
- You give a
name, and eithercriteria(and DeepEval generates the evaluation steps) or your ownevaluation_steps, not both. evaluation_paramslists which fields of the test case the judge sees (the input, the actual output, the expected output and so on). The docs advise including only fields your criteria mention.- An optional
rubricconfines scores to ranges you describe, an addition not in the paper. - Scores are normalized to 0–1 and compared with a
threshold; probability weighting is applied when the judge model returns log probabilities, and a custom model has to supply them for it to work. - The docs state the metric is not deterministic, and point to explicit evaluation steps for scores that hold steadier between runs.
The library’s class and parameter names have changed between releases, so copy code from the current documentation rather than from older blog posts.
Using G-Eval on agent traces
G-Eval was designed to score one piece of text against one quality. An agent run is a sequence: instructions, a plan, tool calls, tool results, intermediate replies and a final answer. The failures that matter in production are rarely in the prose of the final answer. They are an ID the agent invented, a refund it issued outside policy, a ticket it closed without resolving. (See what a production AI agent actually fails at.) Five adjustments make the method fit.
1. Put the agent’s instructions in the prompt
The paper’s criteria are generic (coherence, fluency). An agent’s criteria are specific to what it was told to do, so the judge needs the system prompt, not just the output. We make the full case in why the judge prompt must ingest the system prompt before scoring a single trace step.
2. Generate the evaluation steps once, then freeze them
Auto chain-of-thought is a drafting tool. Let the model write the steps, read them, edit them, and store them with the metric. Steps regenerated on every run mean this week’s score and last week’s were produced by different rubrics, and a regression can hide in the difference.
3. One criterion per metric
G-Eval rates one aspect per form. Keep it that way: tool permission, grounding of claims in tool results, and outcome are separate metrics, so a low score points at one kind of failure. Our guide to scoring rubric design for intent-aware agent judges covers how to split them.
4. Score the trajectory, not just the final reply
Feed the judge the trace, and make the evaluation steps walk it in order. A correct-looking answer built on a forbidden tool call should not score well. For how to structure that, see structuring a judge rubric that grades agent traces against goals.
5. Check the judge against people
The paper validated G-Eval by correlating it with human ratings. Do the same on your own traces before a score gates anything: label a sample by hand and compare. See calibrating judge confidence scores against human labels and inter-rater reliability metrics for LLM judge pipelines. A probability-weighted score is finer-grained, not more correct.
A G-Eval prompt for an agent trace
Here is the paper’s prompt shape rewritten for one agent criterion, with the evaluation steps already written and frozen. Replace the criterion and the steps with what your agent’s instructions actually require.
You will be given the instructions an AI agent was deployed with and the
full trace of one run: every model step, tool call, tool result and the final reply.
Your task is to rate the run on one metric.
Evaluation Criteria:
Instruction adherence (1-5) - whether every action the agent took is permitted
by its instructions, and whether the run ends in the outcome the instructions ask for.
- 1: the agent took an action its instructions forbid, or stated something as
fact that no tool result supports.
- 3: every action was permitted, but the run ended somewhere other than the
outcome the instructions ask for (abandoned, handed off without cause,
or answered a different question).
- 5: every action was permitted, every claim is backed by a tool result, and
the run ended in the outcome the instructions ask for.
Evaluation Steps:
1. Read the instructions. List the actions they permit, the actions they forbid,
and the outcome they ask for.
2. Walk the trace in order. For each tool call, check it against the permitted
and forbidden lists, and note the step number of any violation.
3. For each factual claim in the agent's replies (an ID, an amount, a date, a
status), find the tool result it came from. Note any claim with no source.
4. Compare where the run ended with the outcome the instructions ask for.
5. Assign a score from 1 to 5 using the criteria above.
Instructions:
{{system_prompt}}
Trace:
{{trace}}
Evaluation Form (scores ONLY):
- Instruction adherence:Read the rating token’s log probabilities and apply the weighted sum above, or sample and average if your model does not return them. Ask for the step numbers of violations in a separate call if you want an explanation: the paper’s form asks for scores only, so the rating token comes first.
G-Eval compared with other evaluators
| Approach | How it scores | Needs a reference answer | Fits agent traces |
|---|---|---|---|
| ROUGE, BLEU | Word overlap with a reference | Yes | No: there is rarely one right trajectory to compare with |
| BERTScore | Embedding similarity to a reference | Yes | No, for the same reason |
| GPTScore | The probability the model assigns to generating the output | No | Weakly: fluent text scores well whether or not the actions were right |
| G-Eval | The model fills in a rating; ratings weighted by probability | No | Yes, with the instructions and trace in the prompt and frozen steps |
| Self-consistency checks | Agreement across repeated runs of the agent itself | No | For instability; it cannot tell you a consistent run is wrong |
Checklist before you trust the scores
- Each metric rates one criterion, and the criterion is written from the agent’s instructions.
- The evaluation steps are stored with the metric and versioned, not regenerated per run.
- The judge sees the instructions and the full trace, and only the fields the steps use.
- You know whether your judge model returns log probabilities; if not, you sample and average, and have budgeted for it.
- The judge model is not the agent’s own model where you can avoid it, given the paper’s finding on preference for LLM-written text. More in choosing the right judge model.
- You have checked for position and length bias and the other failure modes of LLM judges.
- Scores have been compared with human labels on a sample of your own traces.
Frequently asked questions
Is G-Eval deterministic?
No. It is a call to a language model. Freezing the evaluation steps, setting temperature 0 where you read log probabilities, and pinning the judge model version reduce the variation between runs; they do not remove it.
Does G-Eval need a reference answer?
No. It was proposed as a reference-free evaluator: the judge sees the input and the output and rates against the criterion. You can include an expected output if you have one, as DeepEval’s correctness examples do.
Can I use G-Eval with a model that does not return log probabilities?
Yes. Sample the rating several times and average, as the paper did for GPT-4, or accept integer ratings and the ties that come with them.
What is the difference between G-Eval and “LLM-as-a-judge”?
LLM-as-a-judge is the general practice of having a model grade outputs. G-Eval is one specific recipe for it: one criterion, generated evaluation steps, a form, and a probability-weighted score. The term itself comes from the paper that introduced MT-Bench, which also measured the position and verbosity biases judges still have to be corrected for.


