Checking a chatbot answer
Checking a chatbot answer means finding out if it is true before you use it. A chatbot can invent a fact, a date or a book that does not exist.
If you copy a made-up fact into your work, the mistake becomes yours. A quick check stops that.
By the end of this lesson
Note
I can check a chatbot answer against a second source.
Key words
| Word | What it means |
|---|---|
| Fact | something that is true and can be checked |
| Source | where a piece of information comes from |
| Second source | another place you check the same fact in |
| Made up | invented, not true |
| Out of date | true once, but not any more |
The cells students fill in are left blank in this preview.
A chatbot can make things up
A chatbot is built to write likely words, so it rarely stops to say "I do not know". Ask it about something it has never seen and it may invent an answer.
The next two Runs ask about Lindmere Cross, a village invented for this lesson. Any year or book it names must be made up.
Ask the lab chatbot
Note
Start the lab, then press the two Runs. If your college has no AI switched on, each Run prints a recorded sample, clearly labelled. Treat the sample as a claim to check.
Ask about a village that does not exist
docker exec -w /home/node/project agent node -e "const u=(process.env.AI_URL||'http://ai:4000')+'/v1/chat/completions';const post=(m,t,x)=>fetch(u,{method:'POST',headers:{'content-type':'application/json',authorization:'Bearer lab'},body:JSON.stringify({model:'lab',messages:[{role:'user',content:m}],max_tokens:t,temperature:x})}).then(r=>r.json());post('In which year did the village of Lindmere Cross open its first library? Answer in one short sentence.',40,0.7).then(j=>console.log('Chatbot: '+j.choices[0].message.content)).catch(e=>console.log('Recorded sample (no chatbot answered): Lindmere Cross opened its first library in 1892.'))"Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Ask for a book about it
docker exec -w /home/node/project agent node -e "const u=(process.env.AI_URL||'http://ai:4000')+'/v1/chat/completions';const post=(m,t,x)=>fetch(u,{method:'POST',headers:{'content-type':'application/json',authorization:'Bearer lab'},body:JSON.stringify({model:'lab',messages:[{role:'user',content:m}],max_tokens:t,temperature:x})}).then(r=>r.json());post('Name one book about the history of Lindmere Cross, with its author. Answer in one short sentence.',40,0.7).then(j=>console.log('Chatbot: '+j.choices[0].message.content)).catch(e=>console.log('Recorded sample (no chatbot answered): A good book is The Story of Lindmere Cross by Edith Marlow.'))"Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Check with a second source
A second source is another place that should know the same fact. Pick one that is likely to be right: a textbook, your notes, the college website or a timetable.
If the two agree, you can use the fact. If they disagree, trust the better source and not the chatbot.
Worked example: three claims checked
| A chatbot said | Second source | What it said | Result |
|---|---|---|---|
| The college library opens at 8am | The college website | Opens at 8.30am | Does not match |
| Water boils at 100 degrees at sea level | A science textbook | 100 degrees at sea level | Matches |
| The 42 bus runs every 10 minutes | The bus timetable | Every 20 minutes | Does not match |
| Your friend Sam is 17 | Nowhere you can check | Nothing | Cannot check |
The cells students fill in are left blank in this preview.
Dates and numbers need extra care
A chatbot learned from text written up to a certain date. It may not know about anything newer, so a price or a rule can be out of date.
It can also slip with sums, because it writes numbers as likely words. Check a date against a page with today's date on it. Check a sum yourself.
Check the sums a chatbot gave
# Pretend a chatbot gave these answers. Each is [first, sign, second, its answer].
claims = [
[12, "x", 15, 180],
[48, "+", 27, 85],
[9, "x", 9, 81],
]
for claim in claims:
if claim[1] == "x":
right = claim[0] * claim[2]
else:
right = claim[0] + claim[2]
if right == claim[3]:
print(claim[0], claim[1], claim[2], "=", claim[3], "matches")
else:
print(claim[0], claim[1], claim[2], "=", claim[3], "is wrong, it is", right)
A common mistake
Warning
Many people think a long, detailed answer must be true. Detail is easy for a chatbot to invent. Only a check against a good second source tells you a fact is right.
Going further: ask it to show its working
Some chatbots will say where a fact came from if you ask. That helps, but a named source can be made up too.
Pick one fact from a recent piece of your own work. Find two good sources for it. Did they agree?