A founder’s four-part framework for A/B testing LLM prompts
After a failed prompt update required an emergency rollback, Kartik NVJK developed a testing methodology using paired inputs, confidence intervals, and strict sample size calculations to separate…
After a failed prompt update required an emergency rollback, Kartik NVJK developed a testing methodology using paired inputs, confidence intervals, and strict sample size calculations to separate signal from noise.
Kartik NVJK shipped a new LLM prompt for a support assistant after a 30-example test showed a small score improvement. Hours later, he was rolling the change back from a Slack thread as the support queue filled with complaints. The initial bump in the score was an illusion, an artifact of a test too small to distinguish a genuine improvement from random chance.
That rollback led to a four-part testing framework designed to prevent self-deception when iterating on prompts. The methodology treats prompt engineering not as an art but as a discipline, demanding statistical rigor before any change is deployed to production. It is a process built to answer one question: is this new version actually better?
Calculate sample size first
A small test can only detect a large effect. Before running an experiment, the framework requires answering two questions: what is the smallest improvement worth shipping, and is the test large enough to reliably see it? The relationship between sample size and detectable effect is not linear. To see an improvement half as large requires four times the data.
Kartik reports that a test with only thirty examples can barely detect anything less than a ten-point swing in performance. He found that seeing a four-point improvement required a few hundred examples, and a two-point improvement needed over a thousand. Below a hundred, you are measuring your scorer's mood, not your prompt.
Use paired testing on identical inputs
Comparing prompt A on one batch of questions to prompt B on a different batch introduces confounding variables. If one batch is inherently easier, the prompt that received it will appear superior regardless of its actual quality. The fix is to run both prompt versions on the exact same set of inputs.
This method, known as a paired test, compares the two outputs for each individual question. The difficulty of the input is canceled out, isolating the performance difference between the prompts. The author claims this approach can deliver the same statistical power with one-quarter of the examples that an unpaired test would require. The only cost is running each input twice.
Report a confidence interval, not an average
A single average, even one labeled “statistically significant,” is insufficient for a ship decision. Statistical significance merely suggests the effect is not zero; it does not quantify its size. A tiny, real improvement may not be worth the risk or cost of a deployment.
Instead, the framework generates a confidence interval, a range for the true improvement. This range provides two decision boundaries. If the range includes zero, the result is inconclusive. If the entire range sits above the predetermined minimum improvement worth shipping, the change can be deployed with confidence. This range must be built from the per-question differences to retain the benefits of paired testing.
Choose between absolute and comparative scoring
The final step is evaluation, which can be structured in two ways. The first is absolute scoring, where each output is graded independently against a fixed rubric. This is useful for enforcing non-negotiable requirements, like whether an answer remained grounded in provided context.
The second method is a side-by-side comparison, where a human or LLM judge is simply asked which of the two outputs is better. This is more reliable for subjective qualities like tone or helpfulness, as direct comparison is less prone to evaluator drift than scoring in a vacuum. The rule is simple: if the question is “is B better than A,” judge them side-by-side.
WHAT WE'D CHANGE
The playbook is a robust system for optimizing an existing, high-volume prompt. Its weakness is its cost. For an early-stage product or a non-critical feature, dedicating the resources to generate and evaluate over one thousand examples to detect a two-point improvement is a premature optimization. The framework is most valuable when small, reliable gains have a significant business impact, as in a core customer support function.
The methodology also does not address the cost of evaluation itself. Whether using human raters or an LLM-as-a-judge, scoring thousands of outputs is a significant operational expense in both time and money. A complete playbook would include a cost-benefit analysis to determine the point at which this level of rigor becomes profitable.
Finally, the value of intensive prompt optimization is relative to the pace of base model improvement. In a fast-moving market, the engineering effort described might be better spent upgrading to a more capable foundation model. This playbook's utility is highest when a model's capabilities have temporarily plateaued, making prompt engineering the primary lever for improvement.
LANDING
The framework is a defense against the illusion of progress. Shipping a new prompt based on a small, noisy test feels productive but often creates operational debt and erodes user trust. NVJK's process forces a clear-eyed assessment of whether an improvement is real and, more importantly, whether it is large enough to actually matter. It replaces gut feel with a verifiable number, turning prompt iteration into a managed engineering process rather than a speculative art.
The investor read
This playbook signals the maturation of AI product development, moving from proofs-of-concept to disciplined engineering. Early-stage AI features were judged on whether they worked at all; scaled products require quantifiable, reliable iteration. Companies that can demonstrate this level of testing rigor are better positioned to manage quality and scale operations, making them more investable. This trend also points to a growing market for LLMOps tooling, specifically for automated evaluation, testing, and versioning. An investment in a product company using AI should now include diligence on their process for measuring and improving model output. A team that hand-waves this is carrying unacknowledged technical and product risk.
Pull quote: “Below a hundred, you are measuring your scorer's mood, not your prompt.”
Every claim ties to a primary source. See our methodology.