AI
Interactive Questioning Can Boost AI Formal Specifications, But Not Always With the Same Model
A study finds that having an AI agent ask clarifying questions before formalizing code specifications improves accuracy in some cases, but results vary significantly depending on which language models are involved.
Large language models can translate natural-language task descriptions into formal Lean specifications, but the initial descriptions often lack crucial details or miss edge cases that matter to verification systems. Researchers set out to test whether an AI-driven elicitation agent could improve this process by asking targeted questions before formalizing.
How the Approach Works#
The elicitation agent breaks down tasks into components, spots gaps in the specification, poses clarification questions (up to a budget of either 3 or 10 per task), and incorporates the answers into a refined natural-language specification. This polished version is then fed to an LLM formalizer, which converts it to Lean code that can be machine-checked.
Mixed Results Across Configurations#
Testing on 189 Lean 4 specification tasks revealed a nuanced picture. When using the same model throughout (Claude Sonnet 4.6), the elicitation step actually decreased pass rates—a finding that upends the assumption that more information always improves outputs. However, when a Sonnet 4.6 agent elicited information for GPT-5.6 or Gemini 3.8 Flash to formalize, accuracy gains appeared. The strongest result came from the Sonnet-to-GPT pipeline at the higher question budget, reaching 65.6%—a gain of 6.3 points over single-shot generation.
Where Gains Vary#
Success differed between simpler and more complex tasks. Advanced-level problems saw larger improvements when the Sonnet elicitation agent paired with GPT-5.6 as the formalizer, jumping from 42.0% to 50.6%. Six of eight test conditions showed positive results when counting only outputs that at least compiled, though gains were generally smaller in that metric.
The Specification Gap#
The analysis pinpointed postconditions—the properties that should hold after a function executes—as a frequent source of failure. This suggests that even with clarification, translating developer intent into formal logical statements remains a bottleneck.
The researchers conclude that future autoformalization systems should treat elicited specifications as intermediate artifacts and co-optimize for both semantic correctness and faithful encoding of clarified requirements into formal logic.

