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

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

AI Quality Metrics and Reporting

A number nobody reads is not a metric. The report is the part of the eval suite most teams skip, and it is the part that gets the next sprint funded.

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

Average hides the slow tailগড় ধীর লেজ লুকিয়ে রাখে

Slide the slow share and watch the average stay calm while P95 jumps.ধীর অনুরোধের ভাগ স্লাইড করুন আর দেখুন গড় শান্ত থাকে কিন্তু P95 লাফ দেয়।

2 min2 মিনিট8 steps8টি ধাপ
  • Test casesটেস্ট কেস20
scores 0–1স্কোর 0–1eval runeval runAggregateএকত্রmean / P95গড় / P95Dashboardড্যাশবোর্ডstored rowsজমা সারি

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

  • Hallucination rate is 1 - mean scoreHallucination rate হলো 1 - গড় স্কোর
  • Why to tag model and prompt versionকেন model ও prompt version ট্যাগ করবেন
  • Why the average hides slow requestsকেন গড় ধীর অনুরোধ লুকায়
  • What P95 shows that the average does notP95 যা দেখায় গড় যা দেখায় না
  • How cost comes from token countsটোকেন গণনা থেকে খরচ কীভাবে আসে

In plain words

An eval suite produces per-case scores. A quality dashboard turns many of those scores into a small number of trend lines that answer "is this getting better or worse" at a glance. The metrics that belong on it:

hallucination rate      derived from the Hallucination score (1 - mean score)
faithfulness score      how well the answer sticks to its retrieved context
answer relevancy        does the answer address the actual question
toxicity rate           derived from the Toxicity score (1 - mean score)
latency P95             the response time 95% of requests beat
cost per session        tokens in and out, priced, summed per conversation

Hallucination rate, toxicity rate, faithfulness, and answer relevancy are built from DeepEval's metrics Source 1সোর্স 1. Each metric returns a 0 to 1 score per test case, but DeepEval's Hallucination and Toxicity scores are higher-is-better, so a dashboard that shows a rate must invert them (rate = 1 - mean score). The dashboard's job is to aggregate these scores, not invent new ones. Faithfulness is shared with Ragas's RAG-specific metrics Source 2সোর্স 2 and only applies when the app retrieves context; Ragas's current docs name the relevancy metric "Response Relevancy" rather than "Answer Relevancy", same concept, different label depending on the tool.

Cost per session needs a token count, not a guess: both the input and output token counts for every call in a conversation, summed and priced (the Messages API response reports them in its usage object; the token-counting endpoint estimates input tokens before sending) Source 3সোর্স 3. Latency P95 needs the full distribution of response times, not the average — an average hides the slow 5% that the users actually complain about.

সহজ English

An eval suite gives a score for each test case. A quality dashboard turns many scores into a few trend lines. These lines show at a glance if quality is getting better or worse. These metrics belong on it:

hallucination rate      derived from the Hallucination score (1 - mean score)
faithfulness score      how well the answer sticks to its retrieved context
answer relevancy        does the answer address the actual question
toxicity rate           derived from the Toxicity score (1 - mean score)
latency P95             the response time 95% of requests beat
cost per session        tokens in and out, priced, summed per conversation

Hallucination rate, toxicity rate, faithfulness, and answer relevancy are built from DeepEval's metrics Source 1সোর্স 1. Each metric gives a 0 to 1 score for every test case. But DeepEval's Hallucination and Toxicity scores are higher-is-better. To show a rate, invert them (rate = 1 - mean score). The dashboard only combines scores. It does not invent new ones.

Ragas also has a faithfulness metric for RAG Source 2সোর্স 2. Faithfulness only applies when the app retrieves context. Ragas's current docs call the relevancy metric "Response Relevancy" instead of "Answer Relevancy". It is the same idea with a different label in each tool.

Cost per session needs real token counts, not a guess. Take the input and output tokens for every call in the conversation. Add them up and price them (the Messages API response reports them in its usage object; the token-counting endpoint estimates input tokens before sending) Source 3সোর্স 3.

Latency P95 needs the whole spread of response times, not the average. An average hides the slowest 5%, and those are the cases users complain about.

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

একটা eval suite প্রতি কেসে score তৈরি করে। একটা quality dashboard সেই অনেক score-কে অল্প কিছু trend line-এ রূপান্তর করে যা এক নজরে বলে "এটা ভালো হচ্ছে নাকি খারাপ"। যে metric-গুলো সেখানে থাকা উচিত:

hallucination rate      derived from the Hallucination score (1 - mean score)
faithfulness score      how well the answer sticks to its retrieved context
answer relevancy        does the answer address the actual question
toxicity rate           derived from the Toxicity score (1 - mean score)
latency P95             the response time 95% of requests beat
cost per session        tokens in and out, priced, summed per conversation

Hallucination rate, toxicity rate, faithfulness, আর answer relevancy DeepEval-এর metric থেকে বানানো হয় Source 1সোর্স 1। প্রতিটা metric প্রতি test case-এ ০ থেকে ১ score দেয়, কিন্তু DeepEval-এর Hallucination আর Toxicity score যত বেশি তত ভালো, তাই rate দেখাতে হলে উল্টে নিতে হয় (rate = 1 - গড় score)। dashboard-এর কাজ হলো score একত্র করা, নতুন বানানো নয়। Faithfulness Ragas-এর RAG-নির্দিষ্ট metric-এর সাথে শেয়ার্ড Source 2সোর্স 2 আর শুধু তখনই প্রযোজ্য যখন app context retrieve করে; Ragas-এর বর্তমান docs relevancy metric-টাকে "Answer Relevancy" না বলে "Response Relevancy" বলে, একই concept, টুল অনুযায়ী আলাদা নাম।

Cost per session-এর একটা অনুমান নয়, একটা token গণনা দরকার: একটা conversation-এর প্রতিটা call-এর input আর output token উভয় গণনা, যোগ আর দাম নির্ধারণ করা (Messages API response-এর usage object এই সংখ্যা দেয়; token-counting endpoint পাঠানোর আগে input token অনুমান করে) Source 3সোর্স 3। Latency P95-এর response time-এর পুরো বিতরণ দরকার, গড় নয় — গড় সেই ধীর ৫% লুকায় যা ব্যবহারকারীরা আসলে অভিযোগ করে।

How it works

The pipeline from a single eval run to a dashboard point:

eval run          each test case scored by DeepEval / Ragas metrics
aggregate         mean (or P95, for latency) across the run's cases
store             one row: date, metric name, value, model, prompt version
chart             each metric as a line over time, model and prompt as filters

Storing the model and prompt version alongside every point is what makes the dashboard answer "did the last change help" instead of just "is the number going up". Without it, a metric drop after a deploy and a metric drop from normal variance look the same.

Cost per session is computed, not scored, directly from the token counts in each response's usage object Source 3সোর্স 3:

session cost = sum over every call in the conversation of
               (input_tokens * input_price + output_tokens * output_price)

Executive-level reporting is a second layer on top of the same data: instead of 50 lines on a chart, a one-page summary with the current value, the trend arrow, and the gate status for each metric that matters to a release decision.

সহজ English

Here is the path from one eval run to one point on the dashboard:

eval run          each test case scored by DeepEval / Ragas metrics
aggregate         mean (or P95, for latency) across the run's cases
store             one row: date, metric name, value, model, prompt version
chart             each metric as a line over time, model and prompt as filters

Always store the model and prompt version with every point. This lets the dashboard answer "did the last change help?" Without it, you only learn if the number is going up. A drop after a deploy and a drop from normal variance would look the same.

Cost per session is calculated, not scored. It comes straight from the token counts in each response's usage object Source 3সোর্স 3:

session cost = sum over every call in the conversation of
               (input_tokens * input_price + output_tokens * output_price)

Reports for executives sit on top of the same data. Instead of 50 lines on a chart, they get a one-page summary. For each metric that matters to a release decision, it shows the current value, a trend arrow, and the gate status.

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

একটা একক eval run থেকে একটা dashboard point পর্যন্ত pipeline:

eval run          each test case scored by DeepEval / Ragas metrics
aggregate         mean (or P95, for latency) across the run's cases
store             one row: date, metric name, value, model, prompt version
chart             each metric as a line over time, model and prompt as filters

প্রতিটা point-এর পাশে model আর prompt version সংরক্ষণ করাই dashboard-কে "শেষ পরিবর্তন কি সাহায্য করেছে" উত্তর দিতে দেয়, শুধু "সংখ্যা বাড়ছে কিনা" নয়। এটা ছাড়া, deploy-এর পরে একটা metric কমে যাওয়া আর স্বাভাবিক variance থেকে কমে যাওয়া একই রকম দেখায়।

Cost per session গণনা করা হয়, score দেওয়া নয়, সরাসরি প্রতিটা response-এর usage object-এর token count থেকে Source 3সোর্স 3:

session cost = sum over every call in the conversation of
               (input_tokens * input_price + output_tokens * output_price)

Executive-level reporting একই data-র ওপর একটা দ্বিতীয় স্তর: chart-এ ৫০টা লাইনের বদলে, একটা এক-পৃষ্ঠার সারাংশ যাতে বর্তমান মান, trend arrow, আর release সিদ্ধান্তের জন্য গুরুত্বপূর্ণ প্রতিটা metric-এর gate status থাকে।

In practice

Aggregate a run's per-case scores into one dashboard row:

from statistics import mean
import numpy as np

def summarise_run(cases: list[dict], model: str, prompt_version: str) -> dict:
    return {
        "date": today(),
        "model": model,
        "prompt_version": prompt_version,
        "hallucination_rate": 1 - mean(c["hallucination"] for c in cases),  # DeepEval score: higher is better
        "faithfulness": mean(c["faithfulness"] for c in cases),
        "latency_p95_ms": float(np.percentile([c["latency_ms"] for c in cases], 95)),
        "cost_per_session_usd": mean(c["cost_usd"] for c in cases),
    }

Per-call cost from token counts Source 3সোর্স 3:

PRICE_PER_1K = {"input": 0.003, "output": 0.015}  # illustrative, check current pricing

def call_cost(input_tokens: int, output_tokens: int) -> float:
    return (input_tokens / 1000) * PRICE_PER_1K["input"] + (output_tokens / 1000) * PRICE_PER_1K["output"]

An executive summary from the same stored rows:

def executive_summary(latest: dict, previous: dict, gates: dict) -> str:
    lines = [f"Quality report — {latest['model']} / {latest['prompt_version']}"]
    for metric, gate in gates.items():
        value, was = latest[metric], previous[metric]
        arrow = "UP" if value > was else "DOWN" if value < was else "FLAT"
        status = "PASS" if gate(value) else "FAIL"
        lines.append(f"  {metric}: {value:.3f} ({arrow} from {was:.3f}) — {status}")
    return "\n".join(lines)

Tutorial advice

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

  • Store every run's raw per-case scores, not just the aggregate. The aggregate hides which specific case regressed.
  • Put a gate status (pass/fail) next to every number on the report; a raw number with no gate invites debate instead of a decision.
  • Review the report with whoever owns the release decision, not just the testers who ran the suite.

সহজ English

This code turns a run's per-case scores into one dashboard row:

from statistics import mean
import numpy as np

def summarise_run(cases: list[dict], model: str, prompt_version: str) -> dict:
    return {
        "date": today(),
        "model": model,
        "prompt_version": prompt_version,
        "hallucination_rate": 1 - mean(c["hallucination"] for c in cases),  # DeepEval score: higher is better
        "faithfulness": mean(c["faithfulness"] for c in cases),
        "latency_p95_ms": float(np.percentile([c["latency_ms"] for c in cases], 95)),
        "cost_per_session_usd": mean(c["cost_usd"] for c in cases),
    }

This code works out the cost of one call from its token counts Source 3সোর্স 3. The prices in it are only illustrations, so check current pricing:

PRICE_PER_1K = {"input": 0.003, "output": 0.015}  # illustrative, check current pricing

def call_cost(input_tokens: int, output_tokens: int) -> float:
    return (input_tokens / 1000) * PRICE_PER_1K["input"] + (output_tokens / 1000) * PRICE_PER_1K["output"]

This code writes an executive summary from the same stored rows:

def executive_summary(latest: dict, previous: dict, gates: dict) -> str:
    lines = [f"Quality report — {latest['model']} / {latest['prompt_version']}"]
    for metric, gate in gates.items():
        value, was = latest[metric], previous[metric]
        arrow = "UP" if value > was else "DOWN" if value < was else "FLAT"
        status = "PASS" if gate(value) else "FAIL"
        lines.append(f"  {metric}: {value:.3f} ({arrow} from {was:.3f}) — {status}")
    return "\n".join(lines)

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

  • Store the raw per-case scores of every run, not just the aggregate. The aggregate hides which case got worse.
  • Put a pass/fail gate status next to every number. A raw number with no gate leads to debate, not a decision.
  • Review the report with the person who owns the release decision, not only the testers who ran the suite.

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

একটা run-এর per-case score একটা dashboard সারিতে একত্র করুন:

from statistics import mean
import numpy as np

def summarise_run(cases: list[dict], model: str, prompt_version: str) -> dict:
    return {
        "date": today(),
        "model": model,
        "prompt_version": prompt_version,
        "hallucination_rate": 1 - mean(c["hallucination"] for c in cases),  # DeepEval score: higher is better
        "faithfulness": mean(c["faithfulness"] for c in cases),
        "latency_p95_ms": float(np.percentile([c["latency_ms"] for c in cases], 95)),
        "cost_per_session_usd": mean(c["cost_usd"] for c in cases),
    }

Token count থেকে per-call খরচ Source 3সোর্স 3:

PRICE_PER_1K = {"input": 0.003, "output": 0.015}  # illustrative, check current pricing

def call_cost(input_tokens: int, output_tokens: int) -> float:
    return (input_tokens / 1000) * PRICE_PER_1K["input"] + (output_tokens / 1000) * PRICE_PER_1K["output"]

একই সংরক্ষিত সারি থেকে একটা executive সারাংশ:

def executive_summary(latest: dict, previous: dict, gates: dict) -> str:
    lines = [f"Quality report — {latest['model']} / {latest['prompt_version']}"]
    for metric, gate in gates.items():
        value, was = latest[metric], previous[metric]
        arrow = "UP" if value > was else "DOWN" if value < was else "FLAT"
        status = "PASS" if gate(value) else "FAIL"
        lines.append(f"  {metric}: {value:.3f} ({arrow} from {was:.3f}) — {status}")
    return "\n".join(lines)

Tutorial advice

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

  • প্রতিটা run-এর কাঁচা per-case score সংরক্ষণ করুন, শুধু aggregate নয়। aggregate লুকায় কোন নির্দিষ্ট case খারাপ হয়েছে।
  • রিপোর্টে প্রতিটা সংখ্যার পাশে একটা gate status (pass/fail) বসান; gate ছাড়া একটা কাঁচা সংখ্যা সিদ্ধান্তের বদলে বিতর্ক ডেকে আনে।
  • যে suite চালিয়েছে তাদের সাথে না, release সিদ্ধান্তের মালিকের সাথে রিপোর্ট review করুন।

Common mistakes

Mistake 1: averaging latency instead of using a percentile. The average hides the slow tail that users notice; P95 or P99 does not.

Mistake 2: no model or prompt version on the data point. Without it, a regression cannot be traced back to the change that caused it.

Mistake 3: inventing a custom metric instead of using DeepEval's or Ragas's. A custom score with no definition cannot be compared across teams or tools. This is the tutorial's own advice; DeepEval Source 1সোর্স 1 and Ragas Source 2সোর্স 2 publish metric definitions you can reuse.

Mistake 4: a dashboard nobody reviews on a cadence. A metric that degrades silently between reviews is a metric that is not actually gating anything.

Mistake 5: reporting cost without the token breakdown. A total dollar figure with no input/output split cannot be used to find which part of the pipeline is expensive Source 3সোর্স 3.

সহজ English

Mistake 1: using the average for latency instead of a percentile. The average hides the slow tail that users notice. P95 or P99 shows it.

Mistake 2: no model or prompt version on the data point. Without it, you cannot trace a regression back to the change that caused it.

Mistake 3: making up a custom metric instead of using DeepEval's or Ragas's. A custom score with no clear definition cannot be compared across teams or tools. This is the tutorial's own advice; DeepEval Source 1সোর্স 1 and Ragas Source 2সোর্স 2 publish metric definitions you can reuse.

Mistake 4: a dashboard that nobody reviews on a regular schedule. If a metric slips quietly between reviews, it is not really gating anything.

Mistake 5: reporting cost without the token breakdown. A single dollar total with no input and output split cannot show which part of the pipeline is expensive Source 3সোর্স 3.

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

ভুল ১: percentile-এর বদলে latency-র average নেওয়া। average ধীর লেজ লুকায় যা ব্যবহারকারীরা লক্ষ্য করে; P95 বা P99 করে না।

ভুল ২: data point-এ model বা prompt version নেই। ছাড়া, একটা regression যে পরিবর্তন কারণ হয়েছে তার কাছে ফিরে track করা যায় না।

ভুল ৩: DeepEval বা Ragas-এর বদলে custom metric বানানো। সংজ্ঞা ছাড়া একটা custom score দল বা টুলের মধ্যে তুলনা করা যায় না। এটা টিউটোরিয়ালের নিজস্ব পরামর্শ; DeepEval Source 1সোর্স 1 আর Ragas Source 2সোর্স 2 পুনরায় ব্যবহারযোগ্য metric সংজ্ঞা প্রকাশ করে।

ভুল ৪: dashboard যা কেউ নিয়মিত review করে না। review-এর মাঝে নীরবে খারাপ হওয়া একটা metric আসলে কিছুই gate করছে না।

ভুল ৫: token breakdown ছাড়া খরচ রিপোর্ট করা। input/output ভাগ ছাড়া একটা মোট ডলার সংখ্যা pipeline-এর কোন অংশ ব্যয়বহুল তা খুঁজে বের করতে ব্যবহার করা যায় না Source 3সোর্স 3।

What a tester can check

Tutorial advice

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

  • Use a percentile for every latency number on the dashboard, never a plain average.
  • Tag every stored run with its model name and prompt version, no exceptions.
  • Keep the raw per-case scores, not just the aggregate, for at least one regression cycle.
  • Put a pass/fail gate status next to every metric on the executive report.
  • Review the dashboard on a fixed cadence with the person who owns the release decision.

সহজ English

Tutorial advice

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

  • Use a percentile for every latency number on the dashboard, never a plain average.
  • Tag every stored run with its model name and prompt version, no exceptions.
  • Keep the raw per-case scores, not just the aggregate, for at least one regression cycle.
  • Put a pass/fail gate status next to every metric on the executive report.
  • Review the dashboard on a fixed cadence with the person who owns the release decision.

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

Tutorial advice

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

  • dashboard-এ প্রতিটা latency সংখ্যায় একটা percentile ব্যবহার করুন, সাধারণ average কখনো নয়।
  • প্রতিটা সংরক্ষিত run-কে তার model নাম আর prompt version দিয়ে ট্যাগ করুন, কোনো ব্যতিক্রম নেই।
  • অন্তত একটা regression cycle-এর জন্য কাঁচা per-case score রাখুন, শুধু aggregate নয়।
  • executive রিপোর্টে প্রতিটা metric-এর পাশে একটা pass/fail gate status বসান।
  • release সিদ্ধান্তের মালিকের সাথে একটা নির্দিষ্ট ছন্দে dashboard review করুন।

Key words

WordWhat it means
Quality dashboardA small set of trend lines aggregated from many eval runs
Hallucination rateA rate derived from DeepEval's Hallucination score (rate = 1 - mean score, because a higher score is better)
FaithfulnessHow well an answer sticks to its retrieved context
Latency P95The response time that 95% of requests are faster than
Cost per sessionThe priced sum of input and output tokens across a conversation
Executive summaryA one-page report with the current value, trend, and gate status per metric

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]
    Metrics

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

  2. [2]
    Available metrics

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

  3. [3]
    Token counting

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