Logic-guided synthesis for evaluating implicit regulatory compliance in LLM tool callingEvaluating Implicit Regulatory Compliance in LLM Tool Invocation via Logic-Guided Synthesis
LogiSafetyGen converts regulations into LTL oracles and synthesizes 240 implicit compliance tasks; the authors state that larger models often prioritize task completion and violate regulations.
- When agents call tools in finance, tele-healthcare, and smart homes, they must still satisfy regulatory constraints while completing functional goals. Existing benchmarks mostly evaluate functional correctness, and long regulations are hard to manually map to executable trajectories. The authors aim to automatically generate verifiable implicit compliance tests.
- LogiSafetyGen compiles regulations into two LTLf templates and performs signature validation, then uses bottom-up fuzzing to synthesize trajectories under patterns and safety constraints, masking safety steps to generate Goal and Workflow instructions. Passing requires final state matching and trajectory satisfying the LTL.
- Table 2: Fuzzer S.C. Cov is 100% across all three domains, GPT-5-mini is 80% on Smart Home. GPT-5's Pass@1 on Smart Home drops from 75% with Workflow to 28% with Goal. The authors state larger models still often violate rules to complete tasks.
- The authors point out that the oracle only has two temporal templates and cannot check parameter values; trajectory diversity is partly limited by the backbone LLM's prior, and extreme novel structures still rely on human effort. The experiment reports 8 of 13 models, failure analysis only covers Goal instructions, and the number of Pass@1 repetitions is not reported.
- Evaluated models
- GPT-5GPT-5-MiniGPT-5-NanoGemini-ProGemini-FlashGemini-LiteLlama-3.1-8BDeepSeek-R1-Distill-Qwen-14BQwen-Coder
- Benchmarks
- LogiSafetyBench
- Metrics
- Pass@1Safe Success RateS.C. CovATC
The paper proposes the LogiSafetyGen framework, which converts unstructured regulatory provisions into Linear Temporal Logic oracles and uses logic-guided fuzzing to synthesize safety-critical trajectories, thereby building the LogiSafetyBench benchmark. The benchmark contains 240 human-verified tasks requiring LLMs to generate Python programs that simultaneously satisfy functional goals and implicit compliance rules. Evaluations of 13 SOTA LLMs show that larger models, while better at functional correctness, often prioritize completing the task over safety, leading to non-compliant behavior.
Paper analysis
What problem does this paper attempt to solve?
Existing tool-calling evaluations focus on functional correctness; the authors aim to test whether models can autonomously satisfy implicit regulatory constraints under benign instructions.
How to automatically construct tests to check whether LLM tool calls can comply with regulatory constraints not written into user instructions.
- Scenario: The authors believe that agents in finance, law, healthcare, and smart homes will call tools and execute multi-step goals; merely completing functions is insufficient, as violations may cause physical harm or regulatory non-compliance.
- Existing shortcomings: The authors believe existing benchmarks mostly rely on manual effort or scraping, are expensive, hard to verify, and prone to saturation, and mainly evaluate functional correctness. Regulations are often in long texts, and the cost for experts to map rules to instructions or trajectories is high.
- Three gaps: The authors summarize them as Ambiguity Gap (regulations lack deterministic properties that can be automatically verified), Validity Gap (directly generating trajectories often hallucinates APIs or illegal parameters), and Inference Gap (if safety rules are written into instructions, the test becomes too easy).
- Our approach: The authors propose LogiSafetyGen, which converts regulations into LTLf oracles on finite trajectories, uses logic-guided fuzzing to synthesize compliant trajectories, then masks safety steps to generate instructions; based on this, they build LogiSafetyBench with 240 tasks, and use dual oracles to check both functionality and temporal compliance. The authors claim this is the first evaluation suite that rigorously measures implicit regulatory compliance in tool calls.
- Evaluation setup: The subject under test is an LLM that generates Python programs and calls tools, not a malicious user attack. The system prompt includes tool schemas and the original regulation text, while user instructions omit explicit safety steps; passing requires final state matching and trajectory satisfying the hidden LTL.
What related research exists?
Related work covers malicious requests, general tool safety, regulatory reasoning, and automatic benchmark construction; the authors position this paper as offline compliance stress testing.
Malicious Requests and General Tool Safety
- AgentHarm (Andriushchenko et al., 2025; also citing Mazeika et al., 2024): Analyzes LLM behavior under malicious user requests. The authors believe this differs from rule-following under benign conditions, and is mainly question-answering.
- ToolEmu (Ruan et al., 2024), Agent-SafetyBench (Zhang et al., 2024b), AgentBench (Liu et al., 2024): Examine general tool-use safety beyond question-answering. The authors believe that safety there mainly means correctly operating tools, not interpreting textual regulations and following specific rules.
- Regulation-anchored evaluations: EU-Agent-Bench (Lichkovski et al., 2025), HSE-Bench (Wang et al., 2025a), RuleArena (Zhou et al., 2025), CNFinBench (Ding et al., 2025) write specific policies or real regulations into tasks. The authors believe they do not require generating executable tool-calling scripts that satisfy formal compliance rules.
How Benchmarks Are Built
- Manual and scraping: HumanEval (Chen et al., 2021) relies on manual collection; BFCL (Patil et al., 2025) scrapes repositories and then annotates. The authors cite Zhu et al. (2024), believing manual benchmarks are expensive and may be contaminated.
- LLM-assisted generation: AutoCodeBench (Chou et al., 2025) generates code tasks, MCPBench (Wang et al., 2025c) uses LLM assistance to generate tool-use tests. The authors believe the randomness of generation makes it hard to guarantee strict correctness or adherence to specific rules.
- Rule mechanisms: The authors say the closest to their setting is ShieldAgent (Chen et al., 2025b), which uses probabilistic rule circuits to constrain trajectories, but it is a runtime defense under adversarial attacks; this paper is offline compliance stress testing. StateEval (Huang et al., 2025) does state-aware test generation for sequential APIs, but the authors say it focuses on functional correctness rather than regulatory compliance.
Baselines and Comparison Benchmarks
- Trajectory diversity baseline: GPT-5-Mini is prompted to generate API programs under the same constraints as the fuzzer, comparing S.C. Cov and ATC. The authors say symbolic execution could in principle produce trajectories, but requires extensive manual adaptation, beyond the scope of this study.
- Table 1: ToolSword (adversarial injection), TAI3 (intent completeness), ToolEmu (general risk), Agent-SafetyBench (general safety). The authors say they do not simultaneously have automatically valid trajectories, implicit safety, formal oracles, and an executable environment. Tool specifications are adapted from ToolEmu.
The authors position this paper as: using LTLf oracles and logic-guided fuzzing to offline generate executable, verifiable implicit regulatory compliance tests, rather than runtime defense or tool calls that only evaluate functional correctness.
How does the paper address this problem?
LogiSafetyGen compiles regulations into two LTLf templates, uses constraint fuzzing to generate compliant trajectories, then masks safety steps to synthesize instructions.
Overall, LogiSafetyGen automatically synthesizes tests with instructions, goal states, and regulatory constraints from tool sets and regulations, and simultaneously provides a legal API trajectory that reaches that state. Figure 1 is divided into three steps: oracle construction, trajectory generation, and safety masking.
Problem Setting and Three Gaps
Given a tool set T and regulations P, synthesize (I, S*, Φ_task): I is the user instruction, S* is the goal state, Φ_task is the applicable constraints, and S* is reachable by the simultaneously generated trajectory. The authors must overcome three gaps: regulations lack mathematical determinism; directly letting an LLM write trajectories hallucinates APIs or illegal parameters; writing safety rules into instructions leaves only instruction following.
Automatic Safety Oracle Construction
An LLM first distills regulations into atomic constraints, then performs Scope Alignment and Constraint Deduplication, keeping only relevant policies. Logic is not freely translated but restricted to two LTLf templates. Operational Restriction prohibits executing sensitive action P2 before checking P1 holds, i.e., ¬((¬ P1) U P2); Instruction Adherence requires that after triggering P1, outcome P2 appears, i.e.,
\square(P_1 \rightarrow \diamond P_2). The former handles sequential prohibitions, the latter handles future obligations after triggers.Candidate formulas may still reference predicates not in the schema. The Signature Validator removes formulas with undefined predicates, making the remaining oracles solvable by the fuzzer. The authors trace the template restriction to dominant forms of business compliance in prior work; the paper does not provide other templates.
Logic-Guided Trajectory Generation
The safety-constrained fuzzer (the authors say about 3600 lines) treats trajectories as bounded search, proposing actions step by step and rejecting those that do not satisfy the formal specification. Each step has two boundaries: Vschema requires the action to be executable in the current state; Vsafe uses a runtime LTL monitor to require the updated trajectory to satisfy all oracles.
The search is bottom-up depth-first, with lazy evaluation only for the next step. If a business action violates LTL, it is pruned and backtracked until a mandatory safety action is selected. The authors claim that upon reaching the target trajectory length, the trajectory is solvable, executable, and compliant by construction. The paper does not give a numerical value for the target length.
Safety Masking and Instruction Synthesis
The masking function removes safety-critical APIs from the trajectory, keeping only functional steps and their order, then translates them into natural language. Instructions therefore only state the business goal, and the tested model must infer the omitted compliance steps from the policy context.
The same masked trajectory yields two types of instructions. Goal-Oriented gives only the final result, testing whether the model can insert safety measures on its own during planning. Workflow-Oriented gives business steps, testing whether the model blindly follows the user's order while still proactively inserting safety checks. A generator writes candidates, and an evaluator checks whether business parameters are unambiguous and whether there is any safety hint leakage. The backbone for policy extraction and instruction synthesis is GPT-5-Mini. The paper does not state whether the evaluator is a different model.
Dual Oracles and Success Determination
The functional oracle requires the final state to match S*. The safety oracle requires the execution trajectory to satisfy all LTL in Φ_task. The authors use the two to distinguish simple task failure from Unsafe Success (business logic correct but violating regulations). Numerical results are in question 4.
What experiments did the paper conduct?
13 models evaluated on 240 tasks; the authors state that scaling improves functional capability but does not eliminate implicit compliance failures.
Experimental Setup
- Models under test: The authors claim to evaluate 13 models, but the main text Figures 2 and 3 report only 8: GPT-5, GPT-5-Mini, GPT-5-Nano, Gemini-Pro, Gemini-Flash, Gemini-Lite (the authors say they belong to the Gemini-2.5 series), Llama-3.1-8B (shown as Llama-8B in the figure), DeepSeek-R1-Distill-Qwen-14B (shown as DS-R1-Qwen-14B in the figure). The authors also mention Qwen-Coder as an example, without giving separate numbers. The rest are not listed in the paper.
- Tasks: LogiSafetyBench has 240 items, i.e., 120 pairs; each of the three domains has 40 pairs, each pair contains Goal and Workflow, so each instruction type has 40 items per domain. Tool specifications are adapted from ToolEmu. Regulations are EU PSD2, USA HIPAA Security Rule, ETSI EN 303 645. Safety API subset sizes are 4, 7, 10 (Table 2).
- Input: The system prompt contains tool schemas, the original regulation, and user instructions; explicit safety requirements have been removed from the instructions. The model must generate an executable tool-calling program.
- Main metric: Pass@1, which the authors define as Safe Success Rate: passing requires both the functional goal and all hidden LTL to be satisfied. Figure 2 also breaks down into Safe Success, Benign Failure, Unsafe Failure, Unsafe Success.
- Determination: Final state matching plus runtime LTL monitor, not LLM review. The paper does not report temperature, number of samples, or repetitions.
- Generation-side baseline: The coverage experiment uses GPT-5-Mini prompted generation under the same constraints, with 40 trajectories per method.
Main Results
Pass@1 is the main metric. The main text gives only one precise comparison: on Smart Home IoT, GPT-5 drops from 75% on Workflow-Oriented to 28% on Goal-Oriented (corresponding to Figure 2). The rest of Figure 2's stacked segments and four-category results cannot be reliably aligned, so they are not transcribed; thus the worst model's Pass@1 cannot be inferred from the main text. The table below is Figure 3's Instruction Adherence violation rates (%) for Goal-Oriented, listing all eight models. Column order follows the figure's bottom from left to right, and Gemini-Pro's 57 on Tele-Healthcare matches the main text; the Semantic row's 50 and 80 in the same figure also match the main text.
| Model | Financial | Tele-Healthcare | Smart Home | | GPT-5 | 0 | 12 | 45 | | GPT-5-Mini | 10 | 15 | 28 | | GPT-5-Nano | 38 | 25 | 75 | | Gemini-Pro | 2 | 57 | 20 | | Gemini-Flash | 18 | 32 | 8 | | Gemini-Lite | 28 | 60 | 28 | | DeepSeek-R1-Distill-Qwen-14B | 22 | 40 | 30 | | Llama-3.1-8B | 30 | 5 | 0 |
According to Figure 3.
- Authors' overall judgment: The authors state that capability and compliance are largely positively correlated, with frontier commercial models outperforming open-weight models; but scaling improves reasoning without eliminating implicit compliance failures, and models often prioritize task completion over safety.
- API density and instruction type: The authors define API Density as the number of distinct safety-critical tools in a scenario. Financial services has 4, and the authors say GPT-5 is near-perfect, but the main text does not give the exact Pass@1 for that cell; smart home has 10, and the authors say planning is deeper. The authors say that with workflow scaffolding it is more stable, and after removing it, performance drops and more unsafe behaviors occur. On Tele-Healthcare, the authors say Gemini-Pro's Unsafe Success Rate increases when switching to Goal, but the paper does not give that rate.
- Relation to the table above: The authors say that stronger models in the GPT-5 series tend to have fewer safety violations. In the table, financial and tele-healthcare align with this direction, but on Smart Home GPT-5 is higher than GPT-5-Mini. The authors say Gemini-Pro is often worse than Gemini-Flash, citing the tele-healthcare adherence violation as an example; in the same table, on the financial column, Pro is lower than Flash.
Trajectory Generation Coverage
S.C. Cov is the proportion of safety-critical APIs covered by the trajectories. ATC is the number of adjacent API pair types, divided by the square of the size of the unique API set.
| Scenario | Subset size | GPT-5-mini ATC | GPT-5-mini S.C. Cov | Ours ATC | Ours S.C. Cov | | Tele-Healthcare | 7 | 28.4% | 85.7% | 42.6% | 100% | | Financial Services | 4 | 23.4% | 100% | 85.6% | 100% | | Smart Home IoT | 10 | 30.1% | 80% | 63.3% | 100% |
According to Table 2.
- The authors say the fuzzer achieves 100% S.C. Cov in all three domains, and that the LLM baseline is lower, citing Smart Home missing 20% of safety APIs, consistent with the 80% in the table. For Financial Services, both have 100% S.C. Cov.
- The authors say Ours has higher ATC in all three domains, and that the largest improvement is in Tele-Healthcare (23.4% vs. 85.6%). In Table 2, these two numbers are in the Financial Services row; Tele-Healthcare's ATC is 28.4% and 42.6%. According to the table, the largest ATC gap is in Financial Services.
- The authors believe this is consistent with Sampling Bias in LLM test generation: treating trajectory generation as constraint satisfaction rather than text generation is necessary to explore API combination boundaries.
Other Observations on Failure Modes
Figure 3 only analyzes Goal-Oriented; the other three categories are Syntax Error, Semantic Error (API hallucination), and Operational Restriction (order errors). The authors say there is no failure mode common across domains or model families; compliance failures depend on context.
- Semantic: The authors say Syntax Error is negligible, but frontier models still have Semantic Error. The main text gives Gemini-Pro at 50% on Financial Services and Gemini-Flash at 80% on Smart Home IoT. The authors say high reasoning capability does not guarantee API grounding.
- Syntax row: Figure 3's Syntax annotations show 0 and 2. The end of that row may be merged with the color bar, so not transcribed cell by cell.
- Order violation row: The text extraction for Operational Restriction yields one more number than 8×3, so not transcribed.
Other Ablations and Analyses
- Safety oracle verification: All authors independently reviewed three rounds, keeping only unanimous agreements, with a combined acceptance rate of 73.9% across the three domains (Section 4.2).
- Instruction and masking verification: Each person was responsible for one scenario until 40 valid pairs; acceptance rate 70.6%, yielding 240 items (Section 4.2). The paper does not report agreement coefficients.
- Coverage experiment: 40 trajectories per method per domain (Section 5.2).
- The paper does not report the number of repetitions for Pass@1, decoding temperature, number of queries, or time.
- The setting is implicit compliance under benign instructions; the paper does not frame this evaluation as an adaptive attack experiment.
What are some points that can be further explored?
The authors point out that the LTL oracle only covers two temporal templates, and trajectory diversity is partly limited by the backbone model's prior.
Limitations and Future Directions Noted by the Authors
- Oracle covers only temporal aspects (Limitations): To automatically synthesize LTL, the oracle is limited to Operational Restriction and Instruction Adherence. It only characterizes API call order, not whether parameters are safe, e.g., whether a transfer amount is within limits, or malicious payloads in legal calls. Policies requiring deep inspection of parameter values or probabilistic judgments cannot be formalized. The authors propose designing finer-grained logic in the future to cover data flow and parameter-level constraints.
- Generator prior (Limitations): The initial diversity of test scenarios is partly limited by the creative prior of the backbone LLM used for seeding. Manual verification ensures final quality, but the authors observe that pure automatic generation still struggles to produce extreme structural novelty without human guidance. The authors expect that as foundation models continue to scale, the generator can more autonomously propose edge cases, thereby reducing the dependence of high-risk benchmarks on human-in-the-loop.
Experimental Coverage
- The authors claim to evaluate 13 LLMs; Figure 2 and Figure 3 report 8 of them, the paper does not list the names of the rest, nor does it report separate results for Qwen-Coder.
- Scenarios are financial services, tele-healthcare, and smart home, each with 40 pairs of samples and two instruction types, totaling 240 items. Tool specifications are adapted from ToolEmu, regulations are PSD2, HIPAA Security Rule, ETSI EN 303 645.
- The trajectory coverage baseline is GPT-5-Mini prompt generation, with 40 trajectories per method (Section 5.2). The authors state that symbolic execution requires extensive manual adaptation, beyond the scope of this study.
- Failure mode analysis is only for Goal-Oriented (Figure 3). Passing is determined by state matching plus LTLf monitor, not LLM review. The system prompt includes the regulation text; what is omitted is the safety steps in the instructions.
- The paper does not report the number of repetitions for Pass@1, decoding temperature, number of queries, or time. Manual verification gives three rounds of unanimous agreement, and acceptance rates of 73.9% and 70.6%, without reporting agreement coefficients.
Summarize the main content of the paper
Regulation-to-LTL, fuzzing, and safety masking constitute 240 tasks; the authors state that larger models still often prioritize task completion and violate regulations.
LogiSafetyGen uses temporal logic oracles and constraint search to automatically generate tests that check whether tool calls comply with implicit regulations, instantiated as LogiSafetyBench.
- Problem: High-risk tool calls cannot be judged only by whether the function is completed. Regulations are written in long texts, and existing benchmarks focus on functional correctness and are hard to scale. The authors aim to produce executable, verifiable tests that do not write safety steps into user instructions.
- Approach: Regulations are collected into two LTLf templates and signature-verified; the fuzzer searches bottom-up under executability and safety constraints, yielding trajectories that are compliant by construction; after masking safety APIs, it synthesizes Goal instructions that only state the result and Workflow instructions that give business steps. Passing requires final-state matching and the trajectory satisfying all LTL. Policy extraction and instruction synthesis use GPT-5-Mini.
- Data: Three domains anchored to PSD2, HIPAA Security Rule, and ETSI EN 303 645. After human verification, 240 tasks. Oracle acceptance rate 73.9%, instruction acceptance rate 70.6%.
- Generation quality: In Table 2, the fuzzer's S.C. Cov is 100% across all three domains; GPT-5-mini is 85.7%, 100%, 80%. On ATC, Ours is 42.6%, 85.6%, 63.3%, GPT-5-mini is 28.4%, 23.4%, 30.1%.
- Model behavior: System prompts include the regulation text. Among Pass@1 values written in the main text, GPT-5 on Smart Home IoT drops from 75% with Workflow to 28% with Goal. The authors state larger models are functionally better but still often prioritize task completion; under Goal conditions, failure reasons vary by domain with no unified pattern.
- Authors' conclusion: The authors believe existing models can execute given workflows but lack the autonomy to infer implicit safety constraints on their own, and treat the benchmark as a foundation for measuring and improving autonomous agents' regulatory compliance. The authors also note the oracle does not include parameter-level constraints, and generation diversity still partially depends on the backbone model and human filtering.