Abdullah Shafique, AI Engineer — Building an LLM Eval Framework That Catches Bad Answers

By Abdullah Shafique, Agentic AI Engineer, based in Sahiwal District, Punjab, Pakistan. I build autonomous agents, RAG systems, and LLM applications.

An LLM that sounds confident is not the same as an LLM that is right. That is why I built an LLM Eval Framework — a small, practical way to test what my agents and RAG systems actually produce, before I trust them in a real task.

What is an LLM eval framework?

An eval framework is a set of test cases with expected behaviour, run against an LLM system, with the results scored and compared over time. Instead of reading a few outputs and guessing, you run the same tests after every change and see whether the system got better, worse, or stayed the same.

My framework follows that idea: define the test, run the system, score the output, keep the record.

Why I built it

I was already building a RAG Document Intelligence System and an Autonomous Research Agent. Both of them generate text from retrieved documents and web sources. Reading a handful of answers by hand was slow, and it missed regressions — a change that fixed one kind of question could quietly break another.

I needed a repeatable check, not a feeling. The eval framework is that check.

How it works

The framework is built around three parts:

  1. Test cases — a question or task, plus what a good answer should contain. For a RAG system, that means the answer should be grounded in the retrieved documents, not invented.
  2. Runs — the system answers each test case, and the run is recorded so it can be compared with earlier runs.
  3. Scores — each answer is scored against the expected behaviour, so I can see which cases pass, which fail, and where the failures cluster.

That is the whole loop: test, run, score, compare, fix, repeat.

What it checks

The framework is aimed at the failures I actually see in LLM systems:

  • Hallucination — the answer states something the sources do not support.
  • Missing grounding — the answer ignores the retrieved documents and falls back to general knowledge.
  • Incomplete answers — the answer covers part of the question and silently drops the rest.
  • Inconsistent answers — the same question gets a different quality of answer on different runs.

These are not exotic failures. They are the ordinary ones, and they are the ones worth catching early.

How it fits my other projects

The eval framework is not a standalone demo. It is the testing layer for the systems I already build:

My portfolio is at https://abdullahshafique.me, my code is on GitHub at https://github.com/abdullahhshafique, and my LinkedIn is https://linkedin.com/in/abdullahhshafique.

What I learned building it

Three things stood out.

First, writing the test cases is the hard part. A vague test gives a vague score. A test with a clear expected answer gives a score I can act on.

Second, a small set of good tests beats a large set of weak ones. Ten tests I trust are more useful than a hundred I do not.

Third, evals change how I build. When I know a change will be tested the same way every time, I make smaller, more careful changes — and I find the regressions before a user does.

What is next

The framework is a working part of my toolkit, not a finished product. The next steps are more test cases for the RAG system and the research agent, and keeping the evals running alongside the monitoring dashboard, so a drop in quality shows up in both places.

If you are building LLM applications and you are still judging them by reading a few outputs by hand, build the eval first. It is the cheapest way to know whether your system is actually getting better.


Abdullah Shafique — Agentic AI Engineer. AI Engineer, Independent Projects (2025–present); previously Graphic Designer (2018–2024). BS Software Engineering, Riphah International University, 2024–2028, GPA 3.99/4.0.

 

Comments

Popular posts from this blog

Hello, I'm Abdullah Shafique — Building AI That Works for People

Abdullah Shafique, AI Engineer — Building a RAG System That Actually Answers

Abdullah Shafique, AI Engineer — Building an Autonomous Research Agent