Skip to content
CodeKruPro

Bias checks and an evidence table

78/99

Module · Security, safety and evidence

advanced

about 40 min

What this lesson teaches

The idea

Bias is tested with pairs: change only one thing that should not matter, such as the customer's name or language, and check the decision stays the same.

Why a tester cares

Results go into an evidence table with the risk, the test, the result and an owner. Testers record evidence; legal judgements belong to others.

Words you will meet

Counterfactual test:
a pair of requests that differ in one detail only.
Evidence table:
a table of risks, tests, results and owners.
Hinglish:
Hindi and English mixed in one message.

What you will do

  1. 1Pair names
  2. 2Pair languages
  3. 3Fill the evidence table
  4. 4Submit
Jump to practice

Bias in an AI feature is tested the same way as everything else: with pairs. Take a request, change only one thing that should not matter, such as the customer's name or the language they write in, and check the decision does not change. These are counterfactual tests, the metamorphic tests of lesson 14 applied to fairness.

Results go into an evidence table: the risk, the test, the result and who owns it. Testers record evidence; they do not give legal verdicts. Whether something breaks a law is for the people whose job that is.

Your task

  1. Write paired tests for names and for Hinglish. On submit they run against a fair build, a build whose decisions depend on the customer's name, and one that answers Hinglish wrongly.
  2. Fill in the evidence table with at least three rows, and no legal conclusions.

Sign in to practise

The lesson is free to read. A free account lets you talk to the practice bots, run your code and save your score. You will come back to this lesson.

1

Your code

against RefundBot

How this is checked: When you submit, your tests run against 3 versions of RefundBot: 1 correct and 2 with a planted fault. Good tests pass on every correct version and fail on every faulty one. Run tries them on the practice copy first; the result table shows each version.

2

Write it up

How this is checked: When you submit, the server checks that it is valid Markdown and follows the rules in the task. Your result names any rule it breaks. This is a harder check: it earns the second 50 points once the core checks pass.

Core checks earn 50 points and the harder checks the other 50. You can submit as many times as you like.

About this lesson

Counterfactual bias testing for chatbot decisions, with an evidence table and no legal verdicts

AI Testing for QA EngineersAdvancedSecurity, safety and evidence

How it works

Bias in an AI feature is tested with pairs. Take a request, change only one thing that should not matter, such as the customer's name or the language they write in, and check that the decision does not change. These are counterfactual tests, the metamorphic relations of lesson 14 applied to fairness.

Results go into an evidence table: the risk, the test, the result and who owns it. Testers record evidence; they do not give legal verdicts. Whether something breaks a law is for the people whose job that is.

About the assignment

Write paired tests for names and for Hinglish across several day counts, and fill an evidence table with at least three complete rows and no legal conclusions.

What you will do

  1. Keep everything but the name, or the language, identical in each pair.
  2. Use several name pairs and several day counts on both sides of the window.
  3. Write what was tested and what happened in each table row.

Common mistakes

  • Changing more than one thing

    If the wording also changes, a different decision proves nothing about names.

  • Legal words in the table

    Terms such as compliant or unlawful are conclusions, not evidence.

In a real test suite

Fairness evidence is often requested by product, legal and compliance teams together. A table that states exactly what was tested makes those conversations faster and more honest.

Choose pairs that a real customer base would produce, including the languages and naming patterns of your users. Generic name lists can miss exactly the groups a product serves most.