How do you validate AI-generated solutions?
Using a scientific mindset to validate AI-generated code with evidence, not trust.

How do you validate AI-generated solutions? This is a hard question for me. How do you validate any solution at all? If you really think about it, this question is not as simple as it sounds and poses a deeper question philosophically: How do you know something is sound and correct?
I won’t pretend I know the general answer to it. Obviously, I don’t. However, from my daily job as a frontend developer and by observing trends in my professional industry, I can share one mindset that I’ve been applying in my work that helps me feel more confident in evaluating AI-generated code and my own: the scientific mindset.
Scientific Methodology 101
Scientific methodology is the method that scientists have been using for centuries to incrementally expand human knowledge. The significant growth in technology in recent history suggests that it works very well for them. Let me explain just four key concepts before showing why and how they help us validate a solution.
- Falsification: turning your solution into concrete claims that are falsifiable, i.e. they can be proven wrong. For example, “This UI doesn’t break in iOS 27’s Safari” is a falsifiable claim, whereas “This UI works in all mobile browsers” is not. The takeaway here is that proving something right or correct universally is often very hard, sometimes even impossible, while proving something wrong is much, much easier: it only takes one unexpected output to prove the claim wrong.
- Evidence beats authority: A claim doesn’t become true because an expert, professor, or famous person says it. The evidence has to survive scrutiny.
- Correlation ≠ causation: Man! I can’t stress how often people misidentify a bug’s root cause because they don’t review their observations to see whether they show causation or merely correlation. Correlation means two things change together. Causation means changing X actually produces a change in Y. Revamping a website using Next.js and seeing all performance metrics improve does not mean Next.js is better for performance. That is correlation, not causation. Reimplementing a website in Next.js often means changing a lot of things together: CSS solutions, rendering strategy, etc. A WordPress project plus Tailwind CSS might as well bring the same benefits.
- Reproducibility: This means someone else should be able to follow your procedure and get a reasonably similar result. How? In a scientific paper, people describe their exact procedure in detail: the environment of the experiment, how many samples they tested, the equipment used to measure, etc. The goal is to say, “If you test it the exact same way I did, you should get the same result.”
Why does scientific methodology help?
Why am I mentioning these concepts? Because they give you a disciplined way to build confidence in a solution.
You actively try to find cases where the solution is wrong through falsification. You gather enough evidence to show that the solution is addressing the actual root cause rather than something that merely correlates with it. You are able to produce evidence instead of relying on authority, and other people can verify that evidence themselves through reproducibility.
None of these principles proves that a solution is universally correct. A solution passing 100 tests does not mean the 101st test cannot break it. But staying within these principles allows you to progressively build confidence in a solution and move forward without having to simply trust a teacher, an expert, AI, or even yourself.
How to apply it and examples?
Falsification: Whenever you have questions like “Can I implement it this way?”, “Is this AI-generated code correct?”, “Is this the right fix for the bug?”, or “Is this the right library choice?”, go make a test that can help you verify it.
If you care about correctness, define a list of test cases with expected outcomes. If you’re afraid of poor performance, make a test that benchmarks it. If you’re worried about high memory usage, write a test that measures it.
With AI, it becomes much easier to write tests that can verify things for you. The difficulty now shifts to knowing what specifically you should check.
Correlation ≠ causation: When diagnosing bugs or performance issues, list two to four possible causes and ask AI to create test scripts that can disprove them one by one. This helps you narrow down the plausible causes. Then design another test that checks whether the strongest remaining hypothesis actually predicts what happens.
The art here is picking the right tests that can distinguish one hypothesis from another.
Evidence beats authority: Someone tells you that using useEffect is bad practice, while someone else says it is perfectly fine. Instead of blindly following either opinion, look at the evidence in your own codebase. Review the useEffects that caused bugs or made code harder to maintain, find the common patterns, and decide for yourself when using useEffect is actually a problem.
Another example: someone says that using useMemo for a component can improve your app's performance. Test it with and without useMemo and observe the Performance tab.
Be careful when collecting evidence, though. In frontend development, reliable evidence is usually the evidence closest to how end users actually experience the application. Compiled CSS saying that some text is red is not evidence that the browser will actually render it red — another rule might have higher precedence. An element existing in the DOM tree and having a non-zero size is still not evidence that users can see it — it might have zero opacity.
Reproducibility: The manifestation of this principle in software development is tests: unit tests, integration tests, E2E tests, or scripts that other developers can rerun.
Before the AI era, it could require a lot of effort from developers to create and maintain them. Nowadays, instead of testing something repeatedly by clicking or typing things manually, you can leverage AI to write automated scripts — using tools like Playwright or agent-browser — for you.
AI makes producing solutions cheaper and faster, but that also means we need to get better at evaluating them. I don’t think scientific methodology gives us a magical way to know whether something is absolutely correct. What it gives us is a disciplined way to become more confident: make claims testable, challenge our explanations, look for observable evidence, and make the verification reproducible.
Instead of asking, “Do I trust this AI-generated solution?”, I find it more useful to ask: “What evidence would convince me that this solution actually works?”
Originally published at https://tien8436.substack.com on September 15, 2026.