Claude-e-Azam

I built an AI that answers as Muhammad Ali Jinnah, using only his own words.

Most of the work went into making sure it can't lie about him.

Claude-e-Azam. Muhammad Ali Jinnah, in his own words, cited.

The idea came to me at three in the morning. My youngest son, Muhammad Umer, or Numnu as I call him, had woken up crying, and once I'd got him back down I couldn't get back to sleep myself. I lay there with a phrase stuck in my head that wouldn't leave: Claude-e-Azam. Just the name. Nothing else yet.

By morning I had two things: total confidence that this was brilliant, and absolutely no ability to explain to myself what it was (three in the morning has a very generous definition of thinking). It turned out I'd wanted a chatbot you could talk to as if you were talking to Quaid-e-Azam, where every real claim it made about his views came with a source you could go and check yourself. His words, from the record. Him, not a version of him filtered through whoever's quoting him.

That last part turned out to be the whole project. Getting a computer to sound like the Quaid is easy, and not that interesting. Getting it to never put words in his mouth that he didn't actually say took almost all the work. There are some ideas that look strangely neglected until you try building one yourself. Then they look appropriately neglected.

The problem I was actually trying to solve

If you ask a normal chatbot, "What did Jinnah think about X?", it'll give you a confident, well-written, perfectly plausible answer. The trouble is you have no way of knowing which parts came from the historical record and which parts it assembled on the spot because an answer seemed preferable to an honest "I don't know." The model doesn't know the difference either, which is the unsettling part.

That's just what these systems are designed to do. They're optimised for producing fluent answers, not faithful ones. They're a bit like that relative who will explain absolutely anything with complete confidence. Undertaker is Kane's real brother. Booker T is the guy in that Kangna Tera Ni video. AI will invent a fact and stand by it, and it is not its fault.

For a public figure whose words already get pulled out of context constantly, a chatbot that improvises is worse than useless. So the rule I set from day one was simple: if it says something substantive about his views, it has to point at a real document, a speech, a letter, a telegram, with a date. And if the record doesn't cover something, it has to say so plainly instead of guessing. No exceptions, no exceptions I liked better later, none.

Everything below is in service of that one rule. Most of it is me discovering, in real time, how many ways a computer can quietly ignore a rule you were sure it understood.

First, a boring bit of housekeeping

The source material is the Jinnah Papers, eighteen volumes of his edited correspondence and speeches, plus a few other collections and one biography for background. Twenty-nine PDFs and a handful of clean text files in total.

Some of those PDFs turned out to be scanned images rather than actual text, the kind of file a computer can display but not read a word of. Nothing dramatic, just the usual thing that happens with old scanned books. I ran them through OCR (software that reads a scanned page and turns it back into text) and checked the results by hand afterward, since "it ran" and "it's accurate" are not the same claim. It came out clean where it mattered. The letters and speeches that answers actually get built from are reliable. A few dense number tables and sideways captions came out messier, so the system knows to flag those and not lean on them.

That's it, that's the whole boring part. On to the parts that were actually hard.

How it finds the right words

Once the whole archive was real text, I could get to the part people actually see.

Here's the actual trick, and it's a really smart one even though the math behind it is quite old. You can turn a piece of text into a set of coordinates, plotted on a map that doesn't have two directions like north and south, it has hundreds, but the idea is the same as any map: things that mean similar things end up as nearby points, and things that don't, end up far apart.

Say "cat" lands at (2, 2). "Dog" might land close by, at (2, 2.5), because cats and dogs show up in similar sentences, both are pets, both have fur, both knock things off tables. "Water" is not going to be anywhere near that neighborhood. It might land way out at (1000, 1100), because it just doesn't get used the way "cat" and "dog" do. Nobody sat down and assigned these numbers by hand. A model reads enormous amounts of text and learns them, the same way you learned which words tend to keep company with which other words, just by reading and listening your whole life. That is it, this is the whole trick behind "AI" as people understand it. So not intelligence, just knowing what to say when (which is also quite rare if you think about it, most people lack this).

So when you ask a question, it gets turned into a point on this same map, and the system looks for whichever real passages in the archive land closest to it. That's the meaning half of the search. It's not perfect on its own, so it runs alongside an ordinary keyword search too, the kind that just looks for the actual words you typed, because sometimes meaning-search drifts off toward things that are merely similar instead of the thing you actually asked about. There's a specific, almost funny way that bit me, below.

Whatever both searches agree is relevant gets handed to the model that writes the answer. Nothing else. The model doesn't get to answer from whatever it already knows about Jinnah. It only gets to answer from the small stack of real, dated passages that were just pulled off the shelf for your specific question. This is called RAG these days, retrieval augmented generation. I despise the way everything is made to sound complex these days when it is really quite simple underneath, so I did not open with that, but worth knowing.

There was a nice, concrete lesson in here about not trusting your assumptions. I asked the early version about the atomic bomb, and it informed me, with total composure, that nuclear weapons didn't exist in Jinnah's lifetime. This would have been news to the residents of Hiroshima. The bomb dropped in August 1945, and Jinnah lived until September 1948, giving the atomic bomb nearly three years to establish itself. The bomb was difficult to ignore. My chatbot had confidently un-invented one of the defining events of the century. The cause, once I found it, was almost sweet in how mundane it was: the 1940s documents say "Atomic Bomb," never "nuclear," so a search for the modern word came back empty-handed even though a real, relevant 1945 letter was sitting right there the whole time. A small vocabulary gap produced a spectacularly wrong result. It's fixed now, and it taught me something useful: the archive speaks in its own era's words, and the search has to meet it there instead of expecting the 1940s to keep up with me.

The bug that scared me, and the thing I built to catch it

Early on I asked the bot why Jinnah believed Muslims needed a separate homeland. It gave me a clear, confident answer in the first person, his view, stated as his own settled conclusion. When I checked the source, my stomach dropped. It was quoting a letter someone had written to Jinnah, making that argument at him, and serving it back to me as his own belief. Someone had written Jinnah a letter, and the bot had cheerfully credited Jinnah with agreeing.

That's exactly the kind of mistake that would poison the whole project, because it looks completely fine. A wrong answer that looks wrong is a nuisance. A wrong answer that looks right is the actual problem.

The model would still slip sometimes. It treated "don't do that" less as a rule and more as an interesting point of view. So I stopped relying on the model to check itself. Every passage in the archive is tagged up front with who was actually speaking in it: Jinnah himself, a correspondent writing to him, or a third party writing about him. After the model writes an answer, a separate mechanical check goes through every claim it made in Jinnah's own voice and looks at the tag behind it. If a claim rests only on a letter someone else wrote to him, that's caught automatically and rewritten. The model doesn't get the final say on whether it followed the rule. Something dumber and stricter than the model checks its work, and being dumber is the point, because it can't be talked out of anything.

One more thing in the same spirit. The bot never retypes a direct quote from memory, since that's exactly when models drift and paraphrase without meaning to. The exact quoted text gets pulled straight from the stored document instead. So a quote you see in quotation marks is genuinely the stored text, not the model's best impression of it.

Why I bothered

Jinnah's own words get flattened into slogans all the time, quoted out of context to prop up whatever argument someone already wanted to make. I wanted something that sends you back to what he actually said, with the source attached, so you can read him instead of the secondhand version. The 11 August 1947 address about religious freedom is the clearest example. People fight about what it meant, and the tool's job is to hand you the actual words and let you sit with them, not to referee an argument that's still going on in Pakistan today. It stays out of the fight and just puts the primary source on the table. It does the same for how his position on Partition changed over the years, from pushing for a united India to the Lahore Resolution of March 1940. It shows you both, with dates, rather than pretending he always believed one thing.

Reading the actual record yourself is still the real thing, and I'd never claim otherwise. This just gets you closer to it, faster, with the citations sitting right next to every answer precisely so you can go check. If it ever makes you want to close the tab and go read the actual volume, honestly, good. That was the goal.

There's more to do. The messy number tables could be read better. Some search gaps remain. But the core promise holds today. It answers from real documents, it shows its sources, and when the record goes quiet, so does it, which is more than I can say for most confident voices on this subject.

You can try it, and if something reads as wrong, there's a report button that comes straight to me. I read every one. Some nights I even read them at 3am, though these days that's usually still Numnu's doing.

Share this
X LinkedIn WhatsApp
Try Claude-e-Azam ↗