ConstraintIR (generation/structured_ir.py)

Sponsio · sponsio/generation/structured_ir.py · python · Apache-2.0
ai

Structured Intermediate Representation for NL → LTL extraction. Instead of asking the LLM to generate raw LTL formula strings (which Req2LTL shows yields ~49% accuracy for zero-shot GPT-4o), this module defines a structured IR that the LLM fills out as a JSON form. Deterministic

# Source: https://github.com/SponsioLabs/Sponsio | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Structured Intermediate Representation for NL → LTL extraction.

Instead of asking the LLM to generate raw LTL formula strings (which
Req2LTL shows yields ~49% accuracy for zero-shot GPT-4o), this module
defines a structured IR that the LLM fills out as a JSON form.
Deterministic rules then compile the IR **directly into LTL AST nodes**
using the formula primitives (G, F, U, Not, Implies, _called, etc.).

The IR layer is **self-contained** — it does not route through
``_PATTERN_REGISTRY`` or ``library.py`` pattern functions.  Each IR
relation has its own synthesis function that direc

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key