Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
AI & ML

Semantic Entropy Confidence Flags for LLM Answers in Urdu and English

Build a layer that sits behind a language model, asks the same question several times, groups the answers by meaning and flags the ones where the model disagrees with itself, so a support bot can say it is not sure instead of inventing an answer. The method comes from published research on detecting confabulation, but it has barely been tested in Urdu, where meaning comparison is harder. The project measures how well the flags catch wrong answers in both languages and what they cost.

Difficulty

Advanced

Needs a team, real planning, and a supervisor who knows the area.
Effort

2 semesters · 2 students

Deliverables

7 to ship

4 optional extras

Suggested stack

PythonHugging Face TransformersA multilingual NLI modelOne hosted LLM API and one open modelFastAPIpandas and matplotlib
A suggestion, not a requirement. Swap anything for what you already know.

What you should ship

  • A service that samples several answers to a question, clusters them by meaning and returns the answer with a confidence flag
  • Meaning comparison using a multilingual entailment model, checked by hand on Urdu and English answer pairs
  • An evaluation set built from public Urdu and English question answering data, with gold answers
  • Baselines: the model's own stated confidence, token probabilities where available, and simple answer agreement
  • Measurements of how well each method separates correct from wrong answers, in each language
  • A cost and latency study showing how results change with the number of samples
  • A demo support bot that abstains and offers a human hand-off when the flag is raised

If you have time left

  • Roman Urdu questions and answers
  • A cheaper probe trained to predict the flag from a single answer, compared with full sampling
  • Applying the flag to retrieval-based answers, where the question is answered from documents
  • A dashboard showing which topics trigger the most uncertainty

The problem: confident answers that are wrong

Banks, telecom companies, universities and clinics in Pakistan are adding language model assistants to their websites and WhatsApp channels, often in Urdu as well as English. The models answer fluently, which is the danger: a wrong answer about a fee, a deadline or a policy sounds exactly as sure as a right one. Customers act on it.

A useful assistant needs to know when it does not know, and say so, or hand over to a person. Asking a model "how confident are you?" does not work well. A better signal is consistency: if you ask the same question several times and get answers that mean different things, the model is probably making it up.

What already exists and the gap

  • Evaluation tools such as promptfoo and DeepEval test model outputs before release, but they do not decide, live, whether to trust one answer.
  • Guardrail products check answers for policy breaches and leaks, not for whether the content is likely invented.
  • Research on uncertainty for language models is active, almost entirely in English.

The gap is a working, measured confidence layer for Urdu and English that a team can put behind its assistant, with honest numbers on how many wrong answers it catches and what it costs in extra calls.

Inspiration

"Detecting hallucinations in large language models using semantic entropy" by Sebastian Farquhar, Jannik Kossen, Lorenz Kuhn and Yarin Gal, published in Nature in June 2024, samples several answers, groups those that entail each other into meaning clusters and measures the entropy over clusters. High entropy signals confabulation. The method needs no labelled examples of hallucination. Your project tests whether it holds up in Urdu, where the entailment step is the weak link.

What you build

  • Teams building assistants call your service with a question and get back an answer plus a flag: confident, uncertain or abstain.
  • End users see "I am not sure about this, here is how to reach a person" instead of an invented answer.
  • Researchers get an Urdu and English evaluation of a published method, with code.

The technically interesting part

  • Comparing meaning in Urdu. Two Urdu answers can say the same thing with different word order, spelling variants and borrowed English words. You need a multilingual entailment model, and you must check by hand how often it gets Urdu pairs right, because every error there flows into the flag.
  • Cost. Sampling five or ten answers multiplies cost and delay. Study how few samples you can get away with and whether a cheap first pass can decide when the full check is needed.
  • Short versus long answers. The method works best on short factual answers. Long answers need splitting into claims first; decide whether that is in scope.
  • Thresholds. A flag that abstains too often is useless; one that rarely abstains misses errors. Show the trade-off curve and let the team pick.

How to evaluate it

  • Separation of right and wrong answers: area under the ROC curve for each method, per language.
  • Selective accuracy: accuracy of the answers the system chooses to give, at different abstention rates.
  • Entailment quality: agreement of the entailment model with human judgement on a sample of Urdu answer pairs.
  • Cost and latency: extra calls and seconds per question for each sample count.
  • Demo test: volunteers ask the support bot real questions; count wrong answers given with and without the flag.

Suggested plan

  • Weeks 1 to 4: read the paper, reproduce a small English result with an open model.
  • Weeks 5 to 9: build the Urdu evaluation set from public question answering datasets such as UQA and UQuAD, and check gold answers.
  • Weeks 10 to 14: Urdu entailment checks, the full pipeline and baselines.
  • Second semester, weeks 1 to 5: cost study, thresholds, and the service.
  • Weeks 6 to 10: demo support bot and volunteer test.
  • Weeks 11 to 14: report and release.

Path to a product

Any company running an assistant in Urdu needs a way to reduce wrong answers it cannot catch by hand. A hosted confidence service or an open library with paid integration is realistic, and the evaluation set is a contribution in its own right. The project is strong preparation for AI engineering and evaluation roles.

Scope warning

Do not build your own language model or your own entailment model from scratch. Keep to short factual answers in the first semester. Report results honestly even when the method works worse in Urdu; that finding is useful. Watch API costs: cap the number of questions per run.

Learn what you need on Sefism

Get help with this idea

The risk is spending the year on infrastructure and never reaching the Urdu results. Tauseef can help you scope the evaluation set, plan the cost study and keep the work focused on the research question. If you are new here, create a free account first.

Ideas and guidance, not finished projects

These are project ideas and scoping guidance, published free for students to use as a starting point. I do not build, write, or sell final-year projects, and I do not complete coursework for anyone. Take an idea, make it yours, and build it.

Not sure this one fits you?

I help students pick an idea that matches their skills and their deadline, then scope it down until it is finishable. Guidance only, never done for you.

Discuss this idea
Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.