Using G-Eval criteria scoring in promptfoo

G-Eval scores each LLM output against criteria you define, with the judge reasoning step by step before it gives a score. This page explains when that beats a plain rubric and how to set it up in promptfoo.

On this page

When teams use G-Eval criteria scoring in promptfoo

An eval suite that passes outputs a human reviewer would reject is usually asking the wrong question. Assertions such as equals, regex or is-json confirm that an output has the right shape, but they cannot tell whether a support reply is courteous, whether a summary covers every required point or whether a answer stays inside your content policy. G-Eval criteria scoring in promptfoo is the approach for those questions: it grades each output against custom criteria you write, using a judge model that reads the output and returns a score. Before you configure it, confirm the exact assertion name, its options and how it turns judge output into a pass or fail result against the current promptfoo assertion documentation, since these details change between releases and this section does not restate them.

Criteria scoring suits dimensions that people can describe but that no string or pattern check can measure. Tone, completeness, policy fit and clarity are the usual candidates. A completeness criterion can name the points a correct answer must cover, a policy criterion can name the topics that must not be discussed or promised, and a clarity criterion can describe the reader who must understand the answer on first reading. Criteria scoring is a poor fit for facts that have a single correct value, such as a product price or an account balance. For those, a deterministic check or a factuality assertion against a reference answer is cheaper and more reliable. It is also a poor fit when a criterion is so vague that two reviewers would disagree on it, because the judge will apply that vagueness inconsistently.

Plan the judge model and the review step before you write criteria. The judge is a separate model call for every graded output, so cost and run time grow with the number of test cases and the number of criteria. The judge model is usually chosen by the team that owns the grading, not by the team that owns the application under test, and its choice affects scores, so record which model graded each run. Start with a small set of outputs that your reviewers have already scored, compare the judge's scores with theirs, and adjust criteria until disagreements are rare and explainable. Ask any vendor or internal team quoting this work to show the judge prompt, the model used, and the reviewed sample used to calibrate it.

Which G-Eval settings fit which quality goal

This table compares the main G-Eval setup choices in promptfoo: criterion wording, judge model, chain-of-thought reasoning, thresholds and reference material. Read each row as a decision: when the option fits, what it adds to judge calls or review time, and what to confirm in the current promptfoo documentation before you rely on it.

SettingWhen it fitsCost in judge calls or review timeWhat to confirm in the docs
Criterion wordingNarrow, observable qualities such as one required fact or one forbidden claimLow judge cost, but vague wording adds review time when scores disagree with human reviewersHow the criterion text is passed to the judge and how scores map to pass or fail
Pass thresholdGating a release where a small set of failures should block a mergeNo extra judge calls, but thresholds set too tight produce noisy failuresWhether the threshold applies to the normalized score and the exact comparison operator
Judge model choiceA stronger or differently built model than the target when the target grades its own output poorlyJudge calls are billed by your provider, so a larger judge raises per-test cost across every runWhich judge models are supported, how to set the judge separately from the target, and any provider-specific limits
Chain-of-thought reasoningCriteria with several conditions where the grader must work through steps before scoringLonger judge outputs increase token spend and run time; reviewers must read the reasoning to audit scoresHow reasoning is enabled for G-Eval, whether it is on by default, and how reasoning appears in results
Reference material in the grader promptChecking answers against policy text, a product catalog or source documentsLarger prompts increase judge cost on every test, and stale references produce wrong verdictsHow reference text is inserted, its size limits, and how to keep it versioned with the test suite
Multiple judge runs or votingHigh-stakes criteria where one judge verdict is not enough to trustMultiplies judge calls and review of disagreements; usually reserved for a small test subsetWhether promptfoo supports multiple graders natively or whether you must aggregate results yourself
Human spot checksAny new criterion before it gates a pipeline, and periodic audits afterwardRecurring reviewer time; the sample size and cadence are set by your team, not the toolNot a promptfoo setting: agree the sample and owner in your own quality process

How a G-Eval grade moves from output to pass or fail

The grade starts with a test case that supplies the input and the target model's output, which promptfoo runs locally against the model under test. The criteria prompt is then sent to a judge model configured separately from the target, so the model being graded never scores its own answer. The judge returns chain-of-thought reasoning and a score, and the only deterministic step is the threshold comparison, which writes a pass or fail result to the eval report. Check that the judge is set apart from the target and that the threshold is the value you expect.

Each step marked as a model call or a deterministic check, with the judge set apart from the target.

What chain-of-thought grading changes for auditability

Chain-of-thought grading matters for auditability because the judge explains its verdict, not just the number. A reviewer can read why an output scored low and see whether the judge applied the criterion as written or misread the answer. That is the fastest way to find a criterion that rewards the wrong thing, such as length, confident tone or polished formatting, before the team builds a threshold on top of it. Read reasoning from several cases before you rely on a score, and treat each misreading you find as a reason to tighten the criterion wording, not as noise.

The trade-offs are real and they land on the budget and the build. Step-by-step judging produces longer judge outputs, so each G-Eval assertion consumes more tokens than a short verdict would, and that cost multiplies across every test case and every rerun. Reasoning also does not make scores fully deterministic. Two runs on the same output can reach different scores, so set thresholds with some margin and rerun borderline cases before you treat a change as a regression. Confirm in the promptfoo documentation whether the reasoning is returned in the results and where it is stored, since that determines whether your reviewers can read it in the web UI, in exported result files or only in the CLI output.

Before you trust a criterion, sample reasoning from both failing and passing cases. Passing cases show whether the judge credits the right evidence, and failing cases show whether it penalizes the right defects. If the reasoning for a passing output cites a feature the criterion never asked for, or a failing output is rejected for a reason the team would accept, rewrite the criterion and rerun the sample. Keep a short record of these reviews alongside the eval config, including the criterion version, the judge model and the date of the review. That record is the evidence an assessor or internal reviewer will ask for when they want to know why a score means what it says.

Choosing G-Eval or a plain rubric for each check

Each check in a promptfoo suite needs a grader that fits what it measures, how fast it must run and how much review the team can give it. The cards below show six common situations, which grader usually fits, and what the choice costs in judge calls and reviewer time.

Clear pass or fail criterion

When the criterion has one unambiguous meaning, such as whether an answer names a required policy, a plain llm-rubric with a tight pass condition is usually enough. G-Eval adds a generated evaluation sequence that is rarely needed for a yes or no question. Check that the rubric rejects a wrong answer, not only a badly formatted one. Ask whether a deterministic assertion can cover part of the criterion first, because a deterministic assertion is often the better first choice when the check allows it.

Promptfoo docs

Multi-part quality judgment

When a single answer must be judged on several dimensions, such as accuracy, tone, completeness and suitability for the audience, G-Eval fits better. Its criteria steps help the judge weigh each dimension before producing a score. The cost is more judge tokens per output and a score that needs a threshold you have to set and justify. Review a sample of scores against human judgment before you rely on the threshold.

Reasoning that must be reviewed

When a reviewer needs to see why an output was scored, G-Eval's chain-of-thought grading produces reasoning alongside the score. That reasoning helps during triage of failures, but it adds review effort because someone must read it to confirm the judge did not reward a fluent but wrong argument. Budget reviewer time for the first runs, then sample. A plain rubric returns a verdict with less material to inspect.

Deterministic speed for high volume

When a check runs across thousands of cases and must return in seconds, a judge call on every output becomes the slowest and most expensive step. Deterministic assertions such as contains, regex or is-json remove judge calls entirely and give repeatable results. Use G-Eval or llm-rubric only for the part of the output a deterministic check cannot read, and confirm the judge cost with your provider's pricing before scaling the suite.

Narrow factual point

When the check asks whether one fact matches a reference, a plain rubric or the factuality assertion is usually more direct than a multi-step G-Eval evaluation. A broad criteria sequence can drift into judging style or length instead of the single fact. Keep the reference answer inside the test so the judge has the source it needs. Confirm the grader against cases where the phrasing differs but the fact is correct.

Check running in every CI build

A check that gates every pull request sets the recurring cost of the choice. A G-Eval check with several criteria steps multiplies judge calls across every test case on every build, and results can vary between runs. Keep the blocking set small and deterministic where possible, and move slower G-Eval scoring to scheduled runs. Ask your team to estimate judge calls per build before adding the check to the pipeline.

Setting up a G-Eval assertion in an existing eval

This sequence adds a G-Eval criteria check to a promptfoo eval you already run, so each output is scored against a written criterion with a threshold. You finish with a small sample that you have checked by reading the grader's reasoning and scores before the suite grows.

  1. Confirm the promptfoo version

    Run promptfoo --version on the machine or CI runner that executes your eval, and compare it with the current release notes on the promptfoo GitHub releases page before you change anything. Confirm that your Node.js version meets the minimum stated in the release notes, since the npm package sets its own requirement. Upgrade only if you need a newer G-Eval option, and note the version in your eval config so later runs are reproducible. The step is done when the version is recorded and an existing eval still runs cleanly.

  2. Add a judge provider separate from the target

    Open the eval configuration and set a grading provider that differs from the model under test, so the model is not scoring its own output. Your security or platform team should confirm which judge models your data handling rules allow, because the judge receives the full output text. Check the exact provider and grading configuration keys in the current promptfoo documentation, since these keys can change between releases. The step is done when a dry run shows the judge provider configured in the run output and the target provider unchanged.

  3. Write one criterion per assertion

    Add a G-Eval assertion to the test case or defaults block, and give it a single, testable criterion such as whether the answer cites only the supplied policy text. Keep one quality dimension per assertion so a failure points to a specific cause, and use separate assertions for tone, accuracy and format. Avoid criteria that reward length or polish alone. The step is done when each assertion has a short, plain-language criterion that a reviewer could apply to the same output and reach the same verdict.

  4. Set the scoring threshold

    Define the score a response must reach to pass, using the threshold option supported by your promptfoo version. Start with a value you can justify from a few reviewed outputs rather than from a default you have not examined. Record the threshold next to the criterion so the team knows why it was chosen. The step is done when the config shows the threshold on each G-Eval assertion and a deliberately weak output scores below it.

  5. Run a small sample of test cases

    Limit the run to a handful of test cases that cover clearly good answers, clearly bad answers and borderline cases, and run promptfoo against them. Confirm in the logs or provider usage that the judge provider was called for each G-Eval assertion, not only the target. The step is done when every sampled case shows a G-Eval result and the judge calls appear in the run output.

  6. Deliberately fail a bad output

    Add or select a known-bad output, such as an answer that ignores the source material or breaks the required format, and confirm the G-Eval assertion marks it as failed. This check tests the grader itself, so a suite that passes everything is caught early. If a bad output passes, tighten the criterion or adjust the threshold and rerun the sample. The step is done when the bad output fails with the threshold you set and the failure is visible in the report.

  7. Read reasoning and scores in the report

    Open the results view or output file and read the grader's reasoning and numeric score for each sampled case, checking that the reasoning refers to the criterion rather than unrelated details. Note any cases where the score and your own verdict disagree, and adjust the criterion wording before expanding. Confirm the scores appear in the report for every row. The step is done when your reviewers agree with the grader on the sample, and the disagreements are either resolved or documented.

  8. Expand the suite after review

    Add more test cases only after the sample behaves as expected, and run the full suite in your normal environment. Keep the judge model, criterion text and threshold under version control so changes are traceable. Ask your team to confirm the judge's cost and rate-limit impact for the larger run, since each G-Eval assertion adds a model call. The step is done when the full suite runs with G-Eval results in the report and the configuration is committed.

Writing criteria that the judge can apply consistently

A single criterion works best when it asks the judge one yes or no question about one observable property of the output. The judge needs to know what a passing output looks like and what a failing one looks like, so the criterion should name the property and the boundary. Words such as "good", "clear", "helpful" or "professional" give the judge nothing to check, and two runs can disagree on them without either being wrong.

  • Name one property: Illustrative: "The answer states the refund window in days." is checkable. "The answer is helpful." is not.
  • State the boundary: Say what counts as a miss, such as a missing number or a window given in weeks.
  • Replace adjectives with observable tests: Swap "concise" for a limit such as "no more than three sentences".
  • Keep the criterion short: One sentence the judge can hold in mind while reading the output.
  • Pin edge cases: Decide in advance whether an answer that refuses to respond passes or fails.

Before relying on a criterion, run it against a few outputs you have already labeled by hand and check that the judge agrees with your labels.

Security risks in judge-based scoring

G-Eval sends your target outputs, criteria and reasoning to a judge model, which creates risks that a plain deterministic assertion does not. The cards below cover what can go wrong in that path and the control to put in place for each one before the judge runs against real data.

Injected instructions reach the judge

The judge reads the target's output as part of its grading prompt, so a response that contains text such as an instruction to award a top score can influence the result. Treat every output as untrusted input to the judge. Keep the grading instructions in the criteria, separate them clearly from the output being graded, and include red team cases in which the target returns instructions aimed at the grader to confirm the judge ignores them.

Promptfoo red teaming docs

Test data leaves your boundary

Each judge call sends the output, the reference material and the criteria to the judge provider. promptfoo runs locally and talks directly with the model you configure, but the provider you pick applies its own data terms to what it receives. Confirm those terms with the provider and your legal team before you send customer records, personal data or regulated content as test cases.

Judge reasoning spreads sensitive content

G-Eval asks the judge to explain its reasoning, and that explanation, along with the prompt and output, can end up in result files, CI logs, shared web views and exported reports. A sensitive detail in one test may then reach people who were never meant to see it. Decide which outputs are written to disk, restrict who can open reports, and set a retention rule for result files before the first shared run.

Self-hosting docs

Judge API keys need the same care

The judge model needs its own API key, and that key can spend budget, access a private model deployment or expose data when it leaks into a repository or pipeline variable. Store the key in your secrets manager or CI secret store, scope it to evaluation use, and rotate it on the same schedule as other production keys. Avoid placing it in configuration files that get committed.

Judges can be steered by output text

A target can produce wording that makes a judge score a weak answer favorably, such as confident phrasing, invented citations or copied criteria language. This is a grading integrity problem, not only an injection problem. Pair G-Eval with objective assertions where a check is possible, use a judge model separate from the target, and sample graded results by hand to confirm the scores match your criteria.

Keeping criteria scores stable across releases

G-Eval scores drift for reasons that have little to do with your application getting better or worse. The judge model is the first source: a provider can update a hosted model behind the same name, and a score that held last month can move without any change on your side. The second is criterion wording. Editing a sentence in the criterion, adding an example or tightening a scale changes what the judge is asked to measure, so the new scores cannot be compared directly with the old ones. The third is threshold changes, which alter the pass rate even when the underlying scores are identical. The fourth is sampling variation, because the judge is itself a model that produces chain-of-thought reasoning and a score, and repeated runs of the same output can differ. Your job is to separate these four causes before you decide a regression is real.

Build a fixed set of reviewed reference outputs, each with a score that your team has agreed is correct under the criterion. Run the judge against this set whenever the judge model, the criterion or the promptfoo version changes, and check that its scores still fall within the range your reviewers would accept. If they do not, recalibrate the criterion or the threshold before trusting any comparison. Store criteria in version control next to the prompts and test configuration they grade, so a criterion change is reviewed and tagged like any other change. Record the judge model identifier, the criterion version and the promptfoo version with every run, so a later reader can tell whether two result sets were produced under the same conditions.

Confirm how your judge is pinned before relying on any of this. Ask your model provider whether the judge model identifier points to a fixed snapshot or to an alias that can change, and check whether your deployment can use a dated version. Then measure repeat-run variation in your own environment: run the same outputs through the same judge several times, record the spread of scores, and set your threshold with that spread in mind. The promptfoo documentation describes how to configure the grading provider, and you should verify the options your installed version supports before writing them into a pipeline.

Limits to confirm before relying on G-Eval scores

G-Eval scores are only as useful as the scale, repeatability and coverage behind them. The cards below list the points to verify in the promptfoo docs, in a pilot run on your own data, or in your judge provider's documentation before a score gates a release.

Scoring scale and pass mapping

Confirm the exact range the G-Eval assertion returns and how a threshold converts that number into pass or fail. A threshold set against a scale you have not verified can silently accept weak outputs or block good ones. Run a handful of outputs you already know are good and bad, and check that the scores separate them at the threshold you plan to use. Record the mapping in your suite so reviewers can reproduce it.

promptfoo docs

Repeatability across runs

A judge model with sampling can return different scores for the same output on different runs. Confirm in the promptfoo docs which judge settings are exposed, such as temperature, and whether they are passed through to the provider. Then run the same suite several times in your environment and measure how far scores move. A threshold that sits inside that spread will produce flaky builds.

Token use and run time at scale

Each G-Eval check usually makes a separate model call that includes the criteria, the output and the reasoning steps. Cost and duration therefore grow with the number of test cases, assertions and judge runs. Confirm the call count per assertion with your judge provider's pricing and rate limits, then pilot a suite at your expected size. Plan for caching and rate-limit handling before you expand the suite.

Long outputs and long criteria

Judges have context windows, and very long outputs or criteria can be truncated or weighted poorly. Confirm the input limit of your chosen judge model in its provider documentation, and check how promptfoo passes the output and criteria to it. Test with your longest real responses, and split criteria into shorter, separate checks when the judge loses track of them.

Output types the assertion accepts

Confirm whether G-Eval handles the formats your application returns, such as plain text, Markdown, JSON, tool calls or multi-turn transcripts. Structured output may need to be serialized to text before grading, which changes what the judge sees. Check the promptfoo docs for supported input shapes and run one case per output type before writing the full suite.

Exporting results to other tools

Confirm which result formats promptfoo writes for G-Eval scores, including the score, reasoning and pass state per test. Check whether these fields survive export into your dashboards, data warehouse or ticketing system. Run an export from a pilot suite and open it in the tool your reviewers use before depending on it for audit or release records.

Questions teams ask before setting up G-Eval scoring

How much effort does a first G-Eval suite take?

A first suite is mostly judgment work, not configuration. The effort depends on how many criteria you score, how much of the judge's chain-of-thought reasoning someone reads, and how long it takes to calibrate the judge against outputs your team has already graded. Each criterion needs a clear definition, a few examples of passing and failing outputs, and an agreed threshold. Start with two or three criteria tied to real failure modes, because every added criterion adds grading work to review and maintain. Ask your team to estimate effort from the number of criteria, the number of test cases per criterion, and the number of people who must sign off on the rubric.

What drives the cost of running G-Eval in promptfoo?

The main cost components are judge model calls, reruns and reviewer time. G-Eval makes a model call for each test case and criterion, and chain-of-thought grading usually produces longer responses, so cost rises with the number of tests, criteria and runs. Reruns add cost when you retune thresholds or repeat evals to check stability. Reviewer time is often the largest cost because someone must read judge reasoning and confirm the grader agrees with people. Caching and smaller test sets reduce model spend, while a judge model that is cheaper but less accurate can increase review work. Ask any partner to price these components separately in a written quote.

How long does a G-Eval pilot take to reach a trusted threshold?

A pilot reaches a trusted threshold when the judge's scores agree with your reviewers on a reference set that covers both good and bad outputs. Timing depends on how quickly your criteria owners agree on what a passing answer looks like, how many reference outputs they can review, and how often the threshold needs adjusting after the first runs. Teams that settle criteria early usually spend most of the pilot on calibration rather than on setup. Plan the pilot as a series of review rounds, and treat the threshold as trusted only after several rounds show stable agreement. Confirm the exact schedule against your own reviewer availability.

What does the team need to provide for G-Eval scoring?

The work needs three things from your side: named criteria owners, reviewed reference outputs and CI access. Criteria owners are the people who decide what a good answer means for a feature, and they must be available to write definitions and resolve disagreements. Reference outputs are examples your reviewers have already graded, which anchor the judge and expose where it misreads intent. CI access lets promptfoo run the suite on each change, so regressions are caught in the pipeline instead of by hand. You also need the model endpoints the suite will call and a decision on where judge and target models run. Confirm access requirements with your platform team before the pilot begins.

Can an internal engineer set up G-Eval scoring alone?

An engineer can set up the configuration alone, but calibration usually needs more than one person. promptfoo is open source under the MIT license and runs locally from the command line, so a single engineer can write a G-Eval test, run it and read the output. The harder part is deciding whether the criteria are correct and whether the judge agrees with domain reviewers, which requires product, quality and sometimes compliance input. A solo engineer can build a working suite for a narrow feature, but risks building a rubric that reflects their own assumptions. Pair the engineer with at least one reviewer who knows the feature well.

When should we bring in an outside partner for G-Eval?

Bring in a partner when the suite must be defensible to people outside the build team, or when your own team lacks time to calibrate it. Common triggers include an evaluation that supports a customer security review, a regulated feature where criteria must be traceable, several applications sharing one evaluation approach, or a pilot that has stalled on disagreement about thresholds. DeployOpen implements promptfoo inside the client's own infrastructure and prepares evaluation evidence for reviews, but it does not issue audit reports or certifications. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, so ask for that scope in writing before comparing options.

How DeployOpen works on this

DeployOpen scopes G-Eval criteria scoring as part of a wider promptfoo evaluation setup, so the criteria, judge model and thresholds are agreed before any suite is written. The work runs inside your own infrastructure and ends with a suite your team can read, run and change. Engagements are fixed-scope, with the deliverables and timelines set out in writing before work starts.

How we scope

  • Agree which outputs get G-Eval scoring and which stay on deterministic assertions.
  • Write down each criterion, its scoring scale and the pass threshold before any tests are built.
  • Confirm the judge model, its hosting location and whether it may receive your production data.

How we build

  • Write criteria prompts with chain-of-thought grading and test them against labeled good and bad outputs.
  • Check the judge for consistency by rerunning the same outputs and recording score variance.
  • Wire the suite into your local runs or pipeline so thresholds fail builds predictably.

How we hand over

  • Deliver the promptfoo configuration, criteria files and labeled example set in your repository.
  • Document each criterion's intent, known limits and the reasons behind each threshold.
  • Walk your engineers through running, reading and updating the suite before the engagement closes.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover.
  • Review judge model changes and promptfoo upgrades against the existing criteria and baselines.
  • Confirm with us during scoping which support level and response terms apply to your environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.