You cannot improve what you do not measure. Ask the model questions with known answers, compare fairly, and count.
AI · beginner · 7 min · 19 steps · free
# How good is a model? Ask it questions with known answers, and count.
tests = [("capital of france", "paris"), ("2 + 2", "4"), ("largest planet", "jupiter"), ("author of hamlet", "shakespeare")]
model_says = {"capital of france": "Paris", "2 + 2": "4", "largest planet": "Saturn", "author of hamlet": "Shakespeare "}
questions = [q for q, _ in tests]
results = []
for question, expected in tests:
answer = model_says[question].strip().lower() # compare fairly: ignore case and spaces
results.append(1 if answer == expected else 0)
accuracy = sum(results) / len(results)
print("accuracy:", accuracy)question is created with the value 'capital of france'. expected is created with the value 'paris'.question changes from 'capital of france' to '2 + 2'. expected changes from 'paris' to '4'.answer changes from 'paris' to '4'.question changes from '2 + 2' to 'largest planet'. expected changes from '4' to 'jupiter'.answer changes from '4' to 'saturn'.question changes from 'largest planet' to 'author of hamlet'. expected changes from 'jupiter' to 'shakespeare'.results points to.for question, expected in tests.Answer: 0.75. 18 ÷ 24 = 0.75.
Answer: Rerun the same eval and compare. Same test set, before and after: the numbers show the effect.
← Agents: A Model in a Loop · Prompt Injection: When Data Gives Orders →