In modern software engineering environments, the use of AI agents (like Cursor, Claude Code, or Copilot) has reversed traditional costs: writing lines of code has become extremely fast and cheap, while reading, understanding, and certifying them is the real bottleneck that consumes time.

Edsger W. Dijkstra noted that tests can show the presence of errors, but not prove their absence (EWD268, Structured Programming). Trusting thousands of generated lines without autonomous validation is a real risk. Traditional tests are effective but cover only the edge cases that the human developer has already considered during writing. What happens when the initial specification has gray areas?

Dossier in Brief

  • The Divergence Test: give the same requirement to multiple independent AI agents that do not communicate. Run the generated code on the same inputs to see where they diverge.
  • What it reveals: where outputs differ, there may be an ambiguous or missing requirement or an error in the generated code.
  • The e-commerce case: in the offline simulation, three educational implementations produce different refunds on the same threshold limits (14 and 30 days).
  • Cost: the comparison can be automated via API, but the cost varies based on the chosen models, the number of calls, and the amount of text processed. The topic is explored in the dossier on Kimi tokens.

The Principle of Divergence

The Divergence Test (or differential testing) consists of a linear procedure: the same exact logical requirement is given to five independent AI models (GPT, Gemini, Claude, Kimi, and a local model via Ollama), allowing them to generate separate implementations without communicating with each other. These parallel implementations are then executed with a wide set of structured test inputs.

When results differ, Divergo shows the point to check. The cause may be an ambiguous or missing requirement, or an error in one of the generated implementations. The comparison helps find the problem before release into production.

The Method

Differential Testing for AI

Use different language models as generators of independent interpretations of the same requirement, treating their logical disagreement as an automatic probe to uncover gaps in software requirements.

An Offline Simulation: Merchandise Return

Divergo includes an educational simulation based on this rule: "free return within 14 days if unused, otherwise 50% refund. Between 15 and 30 days, 60% refund only if unused, beyond 30 days no return." The implementations and results shown here are simulated: they do not represent responses obtained by querying GPT, Kimi, or Claude.

# Implementation A (simulated)
if days_passed < 14:
    return original_price

# Implementation B (simulated)
if days_passed <= 14:
    return original_price

Offline Simulation Results

Tested Input (Return Days) Implementation A Implementation B Implementation C
Day 14 (Threshold) 60.0 (Late Refund) 100.0 (Free) 100.0 (Free)
Day 30 (Threshold) 60.0 (Refund) 60.0 (Refund) 0.0 (No Refund)

The three simulated implementations interpreted "within 14 days" and "beyond 30 days" differently. The comparison shows that the specification must clarify whether thresholds are inclusive or exclusive.

Live Test on July 26, 2026: OpenAI gpt-5.6-sol, Google gemini-3.6-flash, Anthropic claude-sonnet-5, and Moonshot AI kimi-k2.7-code-highspeed produced consistent results. Ollama mistral:latest returned different results in seven cases, which Divergo flagged and analyzed.

Beware of Unvalidated Code: If an implementation mistakenly excludes the fourteenth day, the refund may be calculated incorrectly even if the code is syntactically correct.

Method Limitations

  • Common Error: if all models misinterpret the specification in the same way, no divergence emerges. A review of critical requirements is still needed.
  • Real Costs: querying multiple models requires more calls. Consumption grows with long requirements and large amounts of text.
  • Invalid Code: a model may generate code with errors. Divergo flags it, but in this case, the problem does not necessarily arise from an ambiguous requirement.

Divergo v1.1, Local Validation Tool

We have created an offline utility for Windows called Divergo. It runs locally and allows you to perform divergence tests on any function. Version 1.1 introduces dynamic test generation by analyzing requirement specifications and automatic divergence debate, explaining the logical ambiguity encountered in natural language.

It includes both an offline mode (based on the merchandise return simulation) and live mode with OpenAI, Google Gemini, Anthropic Claude, Moonshot AI Kimi, and local models via Ollama. API keys remain on the user's computer.

Go to Divergo Page