Track LLM Eval Runs in MLflow and Compare Two Versions

Short answer: an eval score on its own means little. What helps is comparing two runs where you changed one thing. Log each run to MLflow with its settings (model, chunk size), its scores and its cost, then put the runs side by side. The free Evals Lab has a ready `eval_tracker.py` that does this.

Open the Evals Lab

What to log for every run

| Kind | In the lab | Why | |---|---|---| | Parameters | provider, model, chunk method, size, overlap | So you know what changed | | Scores | `score_q0`, `avg_score`, `pass_rate`, `pass_count`, `fail_count` | The result | | Word overlap | `rouge1_f1_avg`, per question | A cheap second opinion with no model | | Cost | tokens in and out per question and in total | What the run costs | | Speed | latency per question, mean, min, max, p95 | Whether it is fast enough | | Reasons | `reasons.txt` on the run | What to fix |

The tracker

The lab's `EvalTracker` is a small class. Starting a run records the settings, the loop logs one value per question, and the summary methods log the averages:

tracker = EvalTracker(threshold=0.7)
tracker.start_run(description="rag_eval")
...
tracker.log_latency(i, duration)
tracker.log_token_usage(i, tokens)
tracker.log_rouge_scores(i, rouge)
...
tracker.log_scores_direct(scores)
tracker.log_reasons(reasons)
tracker.end_run()

Under it are plain MLflow calls: `mlflow.log_param`, `mlflow.log_metric` and `mlflow.log_text`. Open `eval_tracker.py` to read them.

Compare two versions

1. Run `python run_eval.py` once. This is your baseline.

2. Change **one** thing: the chunk size in the Documents tab, a step in `eval_criteria.py`, or the model in the Model tab.

3. Run `python run_eval.py` again.

4. Open MLflow (the MLflow link in the IDE, or `localhost:5050`), select both runs and compare. The chunk settings are in the parameters, so you can see what differed.

Avoid fooling yourself

  • **One change per run.** If you change two things, you cannot tell which one mattered.
  • **Same questions, same judge.** A different judge changes the scale.
  • **Run each setting twice.** If the two baselines differ a lot, the judge is noisy, and a small difference between versions means nothing.
  • **Watch cost with score.** A change that adds a point of score but doubles the tokens may not be worth it.

The MLOps panel

After a run finishes, the IDE opens the MLOps panel: run, status, time, calls, tokens, latency, average score and pass rate, with a link to the exact MLflow run. Each test case costs two model calls (the answer and the judge), so the panel shows what a run really costs.

Open the Evals Lab

Related tool pages

Also try

How to use the Evals Lab: step by step

  1. Run python run_eval.py for a baseline
  2. Change one setting
  3. Run it again
  4. Compare the two runs in MLflow

When to use the Evals Lab

  • Comparing two chunk sizes
  • Testing a prompt change against a baseline
  • Seeing what a run costs in tokens
  • Keeping a history of eval results

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

How do I track LLM eval runs in MLflow?

Log the settings as parameters and the scores, tokens and latency as metrics for every run. The Evals Lab has a ready EvalTracker that does this and an MLflow server that starts with the lab.

How do I compare two eval runs?

Change one thing between runs, keep the questions and the judge the same, then select both runs in MLflow and compare their metrics and parameters.

Where is MLflow in the lab?

At localhost:5050, and from the MLflow link in the Python IDE. Start the lab with port 5050 published.

Tip: Name your runs after the change ("chunk_250", "stricter_steps"). Run names in MLflow are the first thing you read later.