Skip to contentমূল লেখায় যান

Topic 11 · AI/ML testingটপিক 11 · AI/ML testing

Model Comparison and Regression Testing

A model upgrade is a code change with no diff. The only way to know what it broke is to run the same questions through it and compare.

6 min read6 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 3 sources3টি সোর্স · updated Nov 2026আপডেট: Nov 2026

The average hides the failing categoryগড় ব্যর্থ ধরনটাকে লুকিয়ে রাখে

Switch from one overall score to a per-category table and see where a cheap model breaks.একটা সামগ্রিক স্কোর থেকে ধরন অনুযায়ী টেবিলে যান আর দেখুন সস্তা মডেল কোথায় ভাঙে।

2 min2 মিনিট7 steps7টি ধাপ
  • Golden pairsগোল্ডেন জোড়া50
  • Modelsমডেল3
Goldenগোল্ডেনdatasetdataset50 fixed pairs50টি নির্দিষ্ট জোড়াsonnetsonnethaikuhaikulunaluna

You’ll learnআপনি শিখবেন

  • Why the dataset must stay stabledataset কেন স্থিতিশীল থাকতে হবে✓
  • How one config compares several modelsএকটা config কীভাবে কয়েকটা মডেল তুলনা করে
  • How the average hides a failing categoryগড় কীভাবে ব্যর্থ ধরন লুকায়
  • Why a weak category is a routing decisionদুর্বল ধরন কেন routing সিদ্ধান্ত
  • How a diff by category shows a regressionধরন অনুযায়ী diff কীভাবে regression দেখায়

In plain words

A golden dataset is a fixed set of question-and-expected-fact pairs that stays the same for the whole life of the feature. Fifty pairs is a reasonable start. The pairs do not need to be exhaustive; they need to be stable, so that two runs, weeks apart, are comparing the same thing.

Model comparison runs that dataset against more than one model and puts the scores side by side. Promptfoo does this with a list of providers in one config, so the comparison is one command Source 1সোর্স 1.

Regression testing is the same dataset run again after a change, to see what the change broke. The changes that matter here: a model version bump, a prompt edit, a retrieval change, a chunking change, a temperature change, and a change to the safety settings. Any of these can move the score without anyone touching the feature's visible behaviour on purpose. Even a trivial formatting change, such as switching answer options from (A) to (1), is reported to change an evaluation's results Source 2সোর্স 2.

The report has to be broken down by category. An overall score across a mixed dataset hides the failure: a model that is perfect on short factual questions and invents facts on multi-hop ones still has a good average, and the average is the number everyone looks at first.

সহজ English

A golden dataset is a fixed list of questions, each paired with the facts the answer must contain. It stays the same for the whole life of the feature. Fifty pairs is a good start. The list does not need to cover everything. It needs to be stable. Then two runs, weeks apart, compare the same thing.

Model comparison runs that dataset against more than one model. It puts the scores side by side. Promptfoo does this with a list of providers in one config. So the comparison takes one command Source 1সোর্স 1.

Regression testing runs the same dataset again after a change. It shows what the change broke. Six kinds of change matter here. They are a model version bump, a prompt edit, and a retrieval change. The others are a chunking change, a temperature change, and a change to the safety settings. Any of these can move the score, even if nobody meant to change what users see.

Even a trivial formatting change can matter. One example is switching answer options from (A) to (1). This is reported to change an evaluation's results Source 2সোর্স 2.

Break the report down by category. One overall score across mixed questions hides the failure. Say a model is perfect on short factual questions but invents facts on multi-hop ones. Its average still looks good. And the average is the number everyone looks at first.

বাংলা ব্যাখ্যা

Golden dataset হলো প্রশ্ন আর প্রত্যাশিত তথ্যের একটা নির্দিষ্ট তালিকা, যেটা ফিচারের সারা জীবন ধরে একই থাকে। পঞ্চাশটা জোড়া দিয়ে শুরু করা যুক্তিসঙ্গত। এগুলোর সম্পূর্ণ হওয়ার দরকার নেই; স্থিতিশীল হওয়া দরকার, যাতে কয়েক সপ্তাহ পরের দুটো run একই জিনিস তুলনা করে।

Model comparison সেই dataset একাধিক model-এর ওপর চালিয়ে স্কোর পাশাপাশি রাখে। Promptfoo একটা config-এ provider-এর তালিকা দিয়ে এটা করে, তাই তুলনা একটা কমান্ড Source 1সোর্স 1।

Regression testing হলো পরিবর্তনের পরে একই dataset আবার চালানো, যাতে দেখা যায় পরিবর্তন কী ভাঙল। যেসব পরিবর্তন গুরুত্বপূর্ণ: model version বাড়ানো, prompt সম্পাদনা, retrieval বদল, chunking বদল, temperature বদল, আর safety setting বদল। এগুলোর যেকোনোটাই ফিচারের দৃশ্যমান আচরণ ইচ্ছাকৃতভাবে না বদলেও স্কোর সরাতে পারে। এমনকি একটা তুচ্ছ formatting বদল, যেমন উত্তরের option (A) থেকে (1) করা, একটা evaluation-এর ফল বদলে দেয় বলে জানানো হয়েছে Source 2সোর্স 2।

রিপোর্ট ধরন অনুযায়ী ভাগ করতে হবে। মিশ্র dataset-এর সামগ্রিক স্কোর ব্যর্থতা ঢেকে দেয়: ছোট তথ্যমূলক প্রশ্নে পারফেক্ট আর multi-hop প্রশ্নে বানানো model-ও গড়ে ভালো স্কোর পায়, আর সেই গড়টাই সবাই প্রথমে দেখে।

How it works

One config, several providers, one test list:

providers:
  - id: anthropic:messages:claude-sonnet-4-6
    label: sonnet-4-6
  - id: anthropic:messages:claude-haiku-4-5
    label: haiku-4-5
  - id: openai:chat:gpt-6-luna
    label: gpt-6-luna

tests: file://evals/golden-cases.yaml

One run produces one row per case per provider. The useful comparison is not the average but the per-category breakdown, because different models fail differently:

category         cases   sonnet   haiku   luna
short fact         12     0.98    0.96    0.91
policy lookup      18     0.95    0.94    0.72
multi-hop          10     0.91    0.68    0.55

That table tells you the cheap model is fine for most traffic and useless for multi-hop questions, which is a routing decision, not a model decision.

Regression tracking is the same command over time, with the output files diffed (--output writes the results file Source 3সোর্স 3):

npx promptfoo eval --output runs/2026-11-01.json
# by_category.py prints the per-category table (below) as JSON
diff <(python by_category.py runs/2026-11-01.json) <(python by_category.py runs/2026-11-08.json)

Two costs belong in the report, because they decide whether a quality gain is worth it: token usage and latency per case. A model that scores 0.95 instead of 0.90 and costs three times as much may be right for one case and wrong for ten thousand.

সহজ English

Here is one config with several providers and one test list:

providers:
  - id: anthropic:messages:claude-sonnet-4-6
    label: sonnet-4-6
  - id: anthropic:messages:claude-haiku-4-5
    label: haiku-4-5
  - id: openai:chat:gpt-6-luna
    label: gpt-6-luna

tests: file://evals/golden-cases.yaml

One run gives one row per case per provider. Do not rely on the average. Look at the per-category breakdown instead. Different models fail in different ways.

category         cases   sonnet   haiku   luna
short fact         12     0.98    0.96    0.91
policy lookup      18     0.95    0.94    0.72
multi-hop          10     0.91    0.68    0.55

This table shows the cheap model is fine for most traffic. It is useless for multi-hop questions. That is a routing decision, not a model decision.

Regression tracking is the same command run over time. You then diff the output files (--output writes the results file Source 3সোর্স 3):

npx promptfoo eval --output runs/2026-11-01.json
# by_category.py prints the per-category table (below) as JSON
diff <(python by_category.py runs/2026-11-01.json) <(python by_category.py runs/2026-11-08.json)

Put two costs in the report: token usage and latency per case. They decide whether a quality gain is worth it. A model may score 0.95 instead of 0.90 and cost three times as much. That may be right for one case and wrong for ten thousand.

বাংলা ব্যাখ্যা

একটা config, কয়েকটা provider, একটা test তালিকা:

providers:
  - id: anthropic:messages:claude-sonnet-4-6
    label: sonnet-4-6
  - id: anthropic:messages:claude-haiku-4-5
    label: haiku-4-5
  - id: openai:chat:gpt-6-luna
    label: gpt-6-luna

tests: file://evals/golden-cases.yaml

একটা run থেকে প্রতি কেস প্রতি provider-এর একটা সারি। কাজের তুলনা গড় নয়, ধরন অনুযায়ী ভাগ, কারণ ভিন্ন model ভিন্নভাবে ভাঙে:

category         cases   sonnet   haiku   luna
short fact         12     0.98    0.96    0.91
policy lookup      18     0.95    0.94    0.72
multi-hop          10     0.91    0.68    0.55

ওই টেবিল বলে দেয় সস্তা model বেশিরভাগ ট্রাফিকে ঠিক আর multi-hop প্রশ্নে অকেজে, যেটা একটা routing সিদ্ধান্ত, model সিদ্ধান্ত নয়।

Regression tracking একই কমান্ড সময়ের সাথে, আউটপুট ফাইল তুলনা করে (--output results ফাইল লেখে Source 3সোর্স 3):

npx promptfoo eval --output runs/2026-11-01.json
# by_category.py prints the per-category table (below) as JSON
diff <(python by_category.py runs/2026-11-01.json) <(python by_category.py runs/2026-11-08.json)

দুটি খরচ রিপোর্টে থাকতে হবে, কারণ সেগুলোই ঠিক করে মানের উন্নতি সার্থক কি না: প্রতি কেসে token ব্যবহার আর latency। 0.90-এর বদলে 0.95 দেয় কিন্তু তিনগুণ খরচ করে এমন model একটা কেসের জন্য ঠিক আর বাকি দশ হাজারের জন্য ভুল হতে পারে।

In practice

Build the golden dataset with the category as a field:

# evals/golden-cases.yaml
tests:
  - description: Return window, simple lookup
    vars:
      policy: file://fixtures/return-policy.txt
      question: How long do I have to return a laptop?
      category: short-fact
    assert:
      - type: contains
        value: "30 day"

Produce the per-category breakdown:

import json
from collections import defaultdict


def by_category(result_file: str) -> dict[str, dict[str, float]]:
    data = json.load(open(result_file))
    scores: dict = defaultdict(lambda: defaultdict(list))
    # results.outputs, provider and pass follow Promptfoo's JSON example; "vars" is assumed. Confirm all of them against your own results file
    for output in data["results"]["outputs"]:
        category = output["vars"]["category"]
        passed = 1.0 if output["pass"] else 0.0
        scores[category][output["provider"]].append(passed)
    return {
        c: {p: sum(v) / len(v) for p, v in ps.items()}
        for c, ps in scores.items()
    }

Keep the run files; they are the regression history:

npx promptfoo eval --output runs/$(date +%F).json
git add runs/ && git commit -m "chore(evals): golden run $(date +%F)"

The golden dataset rots: a case the model has learned, or a policy that has changed, makes the case wrong. Review it on a schedule and version it with the policy it tests.

সহজ English

Build the golden dataset with the category as a field:

# evals/golden-cases.yaml
tests:
  - description: Return window, simple lookup
    vars:
      policy: file://fixtures/return-policy.txt
      question: How long do I have to return a laptop?
      category: short-fact
    assert:
      - type: contains
        value: "30 day"

Then produce the per-category breakdown:

import json
from collections import defaultdict


def by_category(result_file: str) -> dict[str, dict[str, float]]:
    data = json.load(open(result_file))
    scores: dict = defaultdict(lambda: defaultdict(list))
    # results.outputs, provider and pass follow Promptfoo's JSON example; "vars" is assumed. Confirm all of them against your own results file
    for output in data["results"]["outputs"]:
        category = output["vars"]["category"]
        passed = 1.0 if output["pass"] else 0.0
        scores[category][output["provider"]].append(passed)
    return {
        c: {p: sum(v) / len(v) for p, v in ps.items()}
        for c, ps in scores.items()
    }

Keep the run files. They are the regression history:

npx promptfoo eval --output runs/$(date +%F).json
git add runs/ && git commit -m "chore(evals): golden run $(date +%F)"

The golden dataset rots. A case the model has learned can become wrong. So can a case about a policy that has changed. Review the dataset on a schedule. Version it with the policy it tests.

বাংলা ব্যাখ্যা

golden dataset বানান category-কে একটা field হিসেবে রেখে:

# evals/golden-cases.yaml
tests:
  - description: Return window, simple lookup
    vars:
      policy: file://fixtures/return-policy.txt
      question: How long do I have to return a laptop?
      category: short-fact
    assert:
      - type: contains
        value: "30 day"

ধরন অনুযায়ী ভাগ বের করুন:

import json
from collections import defaultdict


def by_category(result_file: str) -> dict[str, dict[str, float]]:
    data = json.load(open(result_file))
    scores: dict = defaultdict(lambda: defaultdict(list))
    # results.outputs, provider and pass follow Promptfoo's JSON example; "vars" is assumed. Confirm all of them against your own results file
    for output in data["results"]["outputs"]:
        category = output["vars"]["category"]
        passed = 1.0 if output["pass"] else 0.0
        scores[category][output["provider"]].append(passed)
    return {
        c: {p: sum(v) / len(v) for p, v in ps.items()}
        for c, ps in scores.items()
    }

run ফাইলগুলো রাখুন; ওগুলোই regression-এর ইতিহাস:

npx promptfoo eval --output runs/$(date +%F).json
git add runs/ && git commit -m "chore(evals): golden run $(date +%F)"

golden dataset পচে যায়: model যে কেস শিখে ফেলেছে, বা যে policy বদলেছে, সেই কেস ভুল হয়ে যায়। নির্ধারিত সময়ে পর্যালোচনা করুন আর যে policy পরীক্ষা করে তার সাথে version করুন।

Common mistakes

Mistake 1: one overall score. The average hides the category that broke.

Mistake 2: no held-out cases. A golden dataset you also tuned the prompt on measures memorisation.

Mistake 3: comparing only against the current model. A new model is only interesting against alternatives, including the cheaper one.

Mistake 4: no cost column. A quality gain that costs five times more is a business decision the tester has to surface.

Mistake 5: the dataset never changes. A case that became wrong makes every future run look like a regression.

Mistake 6: comparing free-text answers exactly. Use a metric for prose and an exact match only for structured output.

সহজ English

Mistake 1: one overall score. The average hides the category that broke.

Mistake 2: no held-out cases. You tuned the prompt on the golden dataset too. Then it measures memorisation.

Mistake 3: comparing only against the current model. A new model is only interesting next to alternatives. Include the cheaper one.

Mistake 4: no cost column. A quality gain that costs five times more is a business decision the tester has to surface.

Mistake 5: the dataset never changes. A case that became wrong makes every future run look like a regression.

Mistake 6: comparing free-text answers exactly. Use a metric for prose. Use an exact match only for structured output.

বাংলা ব্যাখ্যা

ভুল ১: একটাই গড় স্কোর। গড় ঢেকে দেয় কোন ধরন ভাঙল।

ভুল ২: held-out কেস নেই। যে dataset-এর ওপর prompt টিউন করেছেন তা মুখস্থ মাপে।

ভুল ৩: শুধু বর্তমান model-এর সাথে তুলনা। নতুন model কেবল বিকল্পগুলোর তুলনায় আগ্রহজনক, সস্তাটাও তার মধ্যে।

ভুল ৪: খরচের কলাম নেই। পাঁচগুণ বেশি খরচে পাওয়া মান উন্নতি একটা business সিদ্ধান্ত, টেস্টারকে সংখ্যাটা দেখাতে হবে।

ভুল ৫: dataset কখনো বদলায় না। ভুল হয়ে যাওয়া কেস পরের প্রতিটা run-কে regression দেখায়।

ভুল ৬: ফ্রি-টেক্সট উত্তর হুবহু তুলনা। গদ্যের জন্য metric, structured output-এর জন্য হুবহু তুলনা ব্যবহার করুন।

What a tester can check

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Store the category in the test data, not in a spreadsheet beside it.
  • Commit the run files. They are the history of quality.
  • Report the per-category table and the cost per category together.
  • Date the golden dataset and review it on the same schedule as the policy.
  • Keep one known-bad case per category, so the scores mean something.
  • Compare against the model you would switch to, not only the one you run.

সহজ English

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Store the category in the test data, not in a spreadsheet beside it.
  • Commit the run files. They are the history of quality.
  • Report the per-category table and the cost per category together.
  • Date the golden dataset and review it on the same schedule as the policy.
  • Keep one known-bad case per category, so the scores mean something.
  • Compare against the model you would switch to, not only the one you run.

বাংলা ব্যাখ্যা

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • category রাখুন test data-তে, পাশের spreadsheet-এ নয়।
  • run ফাইলগুলো commit করুন। ওগুলোই মানের ইতিহাস।
  • ধরন অনুযায়ী টেবিল আর প্রতি ধরনের খরচ একসাথে রিপোর্ট করুন।
  • golden dataset-এ তারিখ দিন আর policy-র সাথে একই সময়ে পর্যালোচনা করুন।
  • প্রতি ধরনে একটা known-bad কেস রাখুন, যাতে স্কোরের মান বোঝা যায়।
  • যে model-এ বদলাতে চান তার সাথে তুলনা করুন, শুধু যেটা চালাচ্ছেন তার সাথে নয়।

Key words

WordWhat it means
Golden datasetA fixed, versioned set of question-and-answer pairs kept for comparisons
Model comparisonRunning the same dataset against several models and comparing scores
Regression testingRe-running the dataset after a change to catch what broke
Per-category scoreThe score for one class of question, which is what the breakdown needs
Token costThe number of tokens a case consumed, which belongs beside the score
Held-out setCases not used while tuning, so the score is not memorisation

Reels on this topicএই টপিকের রিলস

Short videos from other creators, picked for this topic. They are not part of this page's fact-checked text. Nothing loads from YouTube until you press Play.অন্য ক্রিয়েটরদের বানানো ছোট ভিডিও, এই টপিকের জন্য বাছাই করা। এগুলো এই পেজের ফ্যাক্ট-চেক করা লেখার অংশ নয়। চালান বাটন চাপার আগে YouTube থেকে কিছুই লোড হয় না।

  1. [1]
    Configuration reference

    Promptfoo (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  2. [2]
    Challenges in evaluating AI systems

    Anthropic (Research) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  3. [3]
    Output formats

    Promptfoo (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01