Bridging Natural Language and Formal Specification--Automated Translation of Software Requirements to LTL via Hierarchical Semantics Decomposition Using LLMs
This paper introduces Req2LTL, a modular framework that leverages large language models for hierarchical semantic decomposition and deterministic rule-based synthesis to automatically translate natural language software requirements into syntactically valid and semantically accurate Linear Temporal Logic specifications, achieving superior performance on real-world aerospace datasets.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to give instructions to a very strict, literal-minded robot. You speak in natural, flowing English (like "If the light turns red, wait until it turns yellow before going"). But the robot only understands a rigid, mathematical code called LTL (Linear Temporal Logic). If you make even a tiny mistake in your instructions, the robot might crash the system.
Currently, humans have to act as translators, manually rewriting these instructions into the robot's code. It's slow, boring, and prone to human error.
This paper introduces a new tool called REQ2LTL that automates this translation. Think of it as a "smart translator" that doesn't just guess the code; it breaks the problem down into manageable layers.
Here is how it works, using some creative analogies:
1. The Problem: The "Black Box" Translator
The authors tried using powerful AI models (like GPT-4o) to do the translation directly. They found that while the AI is great at understanding individual words, it often gets lost in the "big picture" logic.
- The Analogy: Imagine asking a student to write a complex legal contract. If you just say, "Write the contract," the student might get the words right but mess up the order of events (e.g., saying "pay the money" before "sign the paper").
- The Result: The AI often produced code that looked correct but had hidden logical traps, like missing a "wait" instruction or confusing "until" with "and."
2. The Solution: The "Onion" Strategy
To fix this, the team created a middle step called OnionL.
- The Analogy: Think of a natural language requirement as an onion. It has many layers: the outer skin (the main goal), the middle layers (conditions and timing), and the core (the specific facts).
- The Innovation: Instead of trying to peel the whole onion at once, the system peels it layer by layer.
- Layer 1 (The Scope): It asks the AI, "Is this happening always? Eventually? Or only when a specific mode is active?" It builds the outer shell of the logic tree.
- Layer 2 (The Details): It then digs deeper into each layer, breaking down complex sentences into smaller, atomic facts (like "temperature > 50" or "light is red").
- The Result: The AI doesn't have to guess the whole structure at once. It just has to organize the layers, which is much easier for it to do correctly.
3. The Safety Net: The "Rule-Based Chef"
Once the AI has peeled the onion and organized the layers into a structured tree (the OnionL), the system passes it to a second part: a deterministic rule-based engine.
- The Analogy: Think of the AI as a creative chef who chops the vegetables (the layers). The rule-based engine is a strict quality control inspector. It doesn't cook; it just checks: "Did you chop exactly two carrots? Is the knife sharp? Is the bowl clean?"
- The Benefit: Because this part follows strict, unchangeable rules, it guarantees that the final code is syntactically perfect (100% correct structure). If the AI made a mistake in the layers, the inspector catches it before the final code is written.
4. The Human Safety Valve
Sometimes, the instructions are just too vague (e.g., "Do this as soon as possible"). The AI might guess wrong.
- The Analogy: The system provides a visual map of the onion layers. If a human expert sees that the AI put the "wait" instruction in the wrong place, they can simply click on the map to fix it. It's like editing a flowchart rather than rewriting a whole paragraph of code.
What Did They Find?
The team tested this on real-world aerospace requirements (instructions for spacecraft navigation and control).
- The Score: Their new system, REQ2LTL, got 88.4% of the meanings exactly right and 100% of the code structure correct.
- Comparison: Previous methods (just asking the AI to translate directly) only got about 44% to 65% right.
- Why it matters: In safety-critical fields like space travel, a 100% structural guarantee is vital. The system successfully bridged the gap between messy human language and perfect machine logic by using the "Onion" method to keep the AI focused and the rule-based engine to ensure safety.
In short, the paper claims that by breaking complex instructions into an "onion" of layers and using a strict rule-checker at the end, we can automate the creation of perfect safety codes for complex machines, something that was previously too difficult for AI to do alone.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.