Latest / Software Testing with Fexingo: QA, Automation, and Reliable Software Engineering / How to Test AI Without Breaking Trust
Transcript
- Lucas: We spent years teaching engineers how to write deterministic tests. If input A goes in, you expect output B every single time. It was clean, logical, and safe. But now we are deploying systems where the output is probabilistic, not deterministic. And that changes everything about how we verify quality. Luna: Right, because you can no longer just assert equality. You have to define what acceptable variation looks like without knowing exactly what the model will say. Lucas: Exactly. Most teams are still trying to force square pegs into round holes. They run a unit test suite against a generative model and call it good. But if the model generates a slightly different phrasing of the same fact, your test fails even though the product is fine. Or worse, it passes when the model confidently lies to the user. Luna: That second part is the scary one. Passing a test while actively harming the user experience through subtle misinformation is a nightmare scenario for any brand. Lucas: Let's look at a concrete example. Imagine a customer support chatbot trained on company policy documents. In a traditional system, you would test for keyword matches or structured data retrieval. With an LLM, you need to test for semantic correctness. Did it answer the question accurately? Did it stay within the tone guidelines? Did it avoid making up policies that don't exist? Luna: So you are moving from syntax checking to semantics checking. That requires a completely different set of evaluation tools. Lucas: Precisely. One approach some forward-thinking teams are using is adversarial testing. Instead of asking the model what it knows, you try to trick it. You feed it conflicting instructions or ambiguous prompts to see if it breaks character or reveals sensitive internal data. It is basically chaos engineering for text generation. Luna: I have seen companies get burned by prompt injection attacks where users simply typed in jailbreak commands to bypass safety filters. It feels like basic security hygiene now, but many launched before they had those safeguards. Lucas: It does feel like hindsight is twenty twenty. But here is the tricky part: you cannot test for every possible injection vector manually. You need automated red-teaming pipelines that constantly throw edge cases at the model during the CI process. If the model refuses the malicious input correctly, the build passes. If it complies, the build fails immediately. Luna: That sounds expensive to run. Every time you push code, you are spinning up heavy inference engines to test for hallucinations and safety violations. Lucas: It is costly, yes. But compare that to the cost of a PR disaster or a regulatory fine. The question isn't whether you can afford to test it. It is whether you can afford to ship without testing it. And we should probably take a quick break here to talk about how we keep this show running. Luna: If today's tech conversation gave you something usable, consider supporting the network directly. Listener contributions allow us to produce these deep dives ad-free and keep the editorial independence intact. You can find us at buy me a coffee dot com slash fexingo. Thank you for keeping this space sustainable. Lucas: It really makes a difference. When listeners chip in, we can spend more time researching complex topics like this rather than chasing sponsor dollars. Back to the pipeline. Luna: So assuming you have that adversarial layer in place, what else do you test for? Hallucinations seem to be the biggest technical hurdle right now. Lucas: Hallucinations are tough because they are often plausible. The model sounds confident. The grammar is perfect. The structure is logical. But the facts are wrong. To catch this, you need ground truth datasets. These are curated sets of questions where you know the exact correct answer. You run the model against them and measure accuracy. Luna: But maintaining those ground truth datasets is hard. Models evolve quickly, so yesterday's correct answer might be outdated today. How do you keep the test data fresh? Lucas: You automate the update cycle. Some teams use human-in-the-loop review for high-stakes queries. Others use smaller, faster models as judges to validate the outputs of the larger model. It is meta-testing. Model A generates text, Model B critiques it for factual consistency based on a reference document. Luna: That is clever. Using AI to test AI. It creates a feedback loop that scales much better than manual QA reviews. Lucas: It does scale, but you have to be careful about bias. If both models were trained on similar data, they might agree on a falsehood. You need diverse sources for your reference materials and potentially multiple judge models to cross-verify. Luna: What about performance? Traditional load testing measures latency and throughput. Does that change for AI workloads? Lucas: It changes significantly. Latency in AI is non-linear. A simple query might take two seconds. A complex reasoning task might take thirty. You cannot just optimize for average response time. You have to look at the tail distribution. What happens when ten thousand users hit the system simultaneously with heavy requests? Luna: The queue backs up, tokens generate slower, and the user experience degrades gracefully or crashes entirely. So you need graceful degradation strategies. Lucas: Exactly. You might route simple queries to a smaller, cheaper model and reserve the large model for complex tasks. You test these routing decisions rigorously. Does the fallback model provide acceptable service when the primary is overloaded? Is the latency penalty worth the accuracy gain? Luna: Those are business decisions wrapped in engineering constraints. You are balancing cost, speed, and quality in real-time. Lucas: Always. And that brings us to another critical area: data drift. In traditional software, the logic doesn't change unless you deploy new code. In AI, the underlying data distribution changes every day. New slang emerges. Customer preferences shift. Public sentiment alters. Luna: So your model starts behaving differently not because you changed the code, but because the world changed around it. That requires continuous monitoring, not just pre-release testing. Lucas: Correct. You need observability platforms that track input distributions and output patterns over time. If the variance spikes, you alert the team. It is like watching the engine temperature gauge, but for semantic integrity. Luna: I wonder if most companies actually have the maturity to implement this level of monitoring. It feels like a luxury for big tech firms. Lucas: It shouldn't be. Open source tools are emerging rapidly. Tools like LangSmith or Arize provide scaffolding for tracking these metrics. The barrier is lower now. It is less about buying expensive enterprise suites and more about adopting a mindset of continuous verification. Luna: Mindset shift is usually the hardest part. Engineers want to build features, not build dashboards to monitor them. Convincing stakeholders that monitoring is a feature, not overhead, takes work. Lucas: It does. But the alternative is blind deployment. You launch a model, hope for the best, and pray no one notices the weird outputs until it is too late. That is not a strategy. That is gambling with customer trust. Luna: Gambling with reputation. Once you lose that, it is very hard to get back. Especially in the age of social media where a single bad AI interaction can go viral instantly. Lucas: True. So we end up back where we started: testing is not optional. It is the foundation of reliable software. But the tools and techniques must evolve to match the technology. Luna: Agreed. Deterministic tests for deterministic code. Probabilistic evaluations for probabilistic models. We need both paradigms to coexist peacefully in our pipelines. Lucas: Coexistence is key. As we move forward, I suspect we will see even more specialized testing frameworks emerge. Things like fairness audits for bias detection, or toxicity scorers for content moderation. Luna: Ethical testing becoming a standard part of the dev cycle. It is encouraging to see the industry taking that seriously, even if it is slow. Lucas: Slow is better than broken. What do you think is the next big frontier in AI testing? Beyond just accuracy and safety? Luna: I think explainability. Can we test whether the model can justify its own answers? If it gives a recommendation, can it trace back to the evidence? That transparency might be the ultimate quality metric for enterprise adoption. Lucas: Traceable reasoning. That is a tall order for current architectures. But if we get there, it changes the entire value proposition of these systems from magic boxes to transparent assistants. Luna: Transparent assistants. I like that. It puts the control back in the hands of the user. Lucas: It does. And for listeners building these systems today, start small. Get your adversarial testing pipeline running first. Then add the semantic checks. Then tackle the drift monitoring. Step by step. Luna: One layer at a time. Don't try to boil the ocean. Just make sure each layer is solid before you add the next. Lucas: Solid foundations. That is the only way to build software you can truly trust.