DeepEval G-Eval: How to Write Evaluation Steps That Score Fairly
Short answer: G-Eval is a DeepEval metric where you describe how to grade in plain English and a judge model returns a score from 0 to 1 and a reason. Write the grading as a few numbered `evaluation_steps`, pass only the fields those steps use, and read the reason for every score. You can run a ready example in the free Evals Lab.
What G-Eval does
You give G-Eval a name, what to check and which parts of the test case to look at (the input, the answer, the expected answer). A judge model grades each answer and explains why. The [DeepEval docs](https://deepeval.com/docs/metrics-llm-evals) say the judge writes a score from 0 to 10, which DeepEval divides by 10, so every score is between 0 and 1.
Criteria or evaluation steps?
You can pass `criteria` (a sentence) or `evaluation_steps` (a numbered list). The docs say to use one of them, not both. With only criteria, G-Eval writes the steps itself, and they can differ from run to run. With `evaluation_steps`, you decide, and the scoring is steadier. A good routine: start with a short criteria, look at the steps it generates, then write them down as your own `evaluation_steps`.
The lab's Correctness metric
This is `eval_criteria.py` in the Python IDE:
steps = [
"1. Check if the actual output contains the key information from expected output.",
"2. Check if the actual output contradicts any facts in expected output.",
"3. Extra information beyond expected output is acceptable.",
"4. If all key information is present and nothing is contradicted, score high.",
]
GEval(
name="Correctness",
criteria="Is the actual output correct based on expected output?",
evaluation_steps=steps,
evaluation_params=[LLMTestCaseParams.ACTUAL_OUTPUT, LLMTestCaseParams.EXPECTED_OUTPUT],
threshold=0.7,
model=judge,
)Each step is one small check. Step 3 says what is allowed, so a long answer is not punished for being helpful. Step 4 says what a high score means.
Rules for good steps
- **One idea per step.** "Check facts and tone and length" gives a muddy score.
- **Say what is allowed.** If extra detail is fine, say it.
- **Pass only the fields the steps use.** If no step looks at the input, do not pass it; extra fields can make the judge less accurate.
- **Describe the top score.** The judge needs to know what a 10 looks like.
- **Use one metric for one question.** Make a second metric (Relevancy, Faithfulness) instead of one metric that checks everything.
The threshold
The threshold is the score at or above which a case passes. The DeepEval default is 0.5. The lab uses 0.7. Do not pick it by feel: grade 20 cases yourself, see where the judge disagrees with you, and move the threshold until the pass and fail lines match your own. Then lock it.
Read the reason
Every score comes with a reason, and `run_eval.py` saves them to the Results tab and to MLflow. If a reason is vague, or praises an answer without naming the facts, tighten the steps. See five ways to check your judge.
Try it
Open the Python IDE in the Evals Lab, open `eval_criteria.py`, change one step and run `python run_eval.py` again. The DeepEval [quickstart](https://deepeval.com/docs/getting-started) is a good next read.
Related tool pages
- LLM as a Judge Playground: Grade AI Answers Free: Try LLM as a judge free on your laptop: write a judge prompt or a DeepEval G-Eval metric, run it on every test question and read a score and a reason for each answer.
- RAG Evaluation Playground: Test Chunking and Retrieval: Evaluate a RAG app free on your computer: chunk a document into ChromaDB, test retrieval by meaning, grade every answer and compare chunk sizes side by side in MLflow.
- DeepEval Playground: Try G-Eval Free on Your Laptop: Learn DeepEval hands-on, free: a Python IDE with a ready G-Eval project, goldens.csv, your own Gemini, Claude or OpenAI key and MLflow tracking. Runs in Docker.
- Chunk a Document Into ChromaDB: Free Local Vector DB: Upload a document, pick a chunking method and see every chunk and vector stored in ChromaDB, free in Docker. Then connect your own AI agent to that database. No API key.
Also try
How to use the Evals Lab: step by step
- Open eval_criteria.py in the Python IDE
- Change or add one evaluation step
- Run python run_eval.py
- Compare the scores and reasons with the last run
When to use the Evals Lab
- Writing a custom metric for your own app
- Making judge scores steadier between runs
- Learning DeepEval with a ready project
- Calibrating a pass threshold
Example
Input: northwind_support_handbook.txt, chunked and stored in ChromaDB
Output: A score and a reason for every answer, and each run logged in MLflow
Frequently asked questions
What is G-Eval in DeepEval?
A metric where you describe the grading in plain English. A judge model returns a score from 0 to 1 and a reason for each test case.
Should I use criteria or evaluation_steps?
Use one, not both. Criteria lets G-Eval write the steps, which can vary between runs. evaluation_steps gives you control and steadier scores.
What threshold should I use?
DeepEval defaults to 0.5. Calibrate it on cases you graded yourself, then keep it fixed so runs stay comparable.
Can I try G-Eval without installing anything?
Yes. The free Evals Lab runs DeepEval in Docker with a ready G-Eval project. You only need Docker and a model key.
Tip: Change one step at a time and run the same questions again. If the scores move, you know which step did it.