SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.16198 · 2026

Formal Methods Meet LLMs: Auditing, Monitoring, and Intervention for Compliance of Advanced AI Systems

Sheila Mcilraith, Toryn Klassen, Parand Alamdari

arXiv · PDF · Open in the Atlas

Code that ran

7 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 7 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2605.16198.json · badge: /api/ran/2605.16198.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
praal/llm-monitoring canonical (classifier label)
classifier basis: census
7 ran · 7 no recorded run
FunctionStatusWhere it lives
compute_f1 Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/LLMFailure/forest_evaluate.py
code served (permissive licence) · get_code("86da62288e7880c4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct a valid results_list for compute_f1
# The function expects a list of dicts, each with a 'per_constraint' key
# containing a list of constraint dicts with 'ground_truth', 'prediction', and 'correct' keys

results_list = [
    {
        'per_constraint': [
            {
                'ground_truth': 'INVALID',
                'prediction': 'INVALID',
                'correct': True
            },
            {
                'ground_truth': 'VALID',
                'prediction': 'VALID',
                'correct': True
            },
            {
                'ground_truth': 'INVALID',
                'prediction': 'VALID',
                'correct': False
            },
            {
                'ground_truth': 'VALID',
                'prediction': 'INVALID',
                'correct': False
            }
        ]
    },
    {
        'per_constraint': [
            {
                'ground_truth': 'INVALID',
                'prediction': 'INVALID',
                'correct': True
            },
            {
                'ground_truth': 'VALID',
                'prediction': 'VALID',
                'correct': True
            }
        ]
    }
]

ARGS = {
    'results_list': results_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_labels Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/Monitoring/auditScience.py
code served (permissive licence) · get_code("8651a2339f17c47a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct a valid entry dict with all required keys
entry = {
    'go': True,
    'kitchen': True,
    'living room': False,
    'hallway': False,
    'look': True,
    'open': False,
    'box': True,
    'thermometer': False,
    'substance B': True
}

ARGS = {
    'entry': entry
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_labels Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/Monitoring/auditTextWorld.py
code served (permissive licence) · get_code("1dfdcdad0413b868")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

ARGS = {
    'entry': {
        'drop': True,
        'examine': False,
        'take': True,
        'knife': False,
        'chop': False,
        'slice': True,
        'dice': False,
        'go': True
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
labeling Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/Monitoring/ltl.py
code served (permissive licence) · get_code("097a6bb4ba2a0b1a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function labeling takes:
# 1. propositions: a collection of strings (propositions)
# 2. observation: a string (observation)
# 
# The function checks if words in each proposition appear in the observation string

propositions = [
    "cat is here",
    "dog runs",
    "the cat",
    "bird"
]

observation = "THE CAT IS HERE AND THE DOG RUNS FAST"

ARGS = {
    "propositions": propositions,
    "observation": observation
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_multi_response Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/LLMFailure/forest_evaluate.py
code served (permissive licence) · get_code("5cec99aaa53be80e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def parse_multi_response(response_text, n_constraints):
    """
    Parse LLM response for N constraint verdicts.
    Looks for patterns like "Constraint 1: VALID" or "1: INVALID" or "1. VALID".
    Returns list of N verdicts ('VALID', 'INVALID', or 'UNPARSEABLE').
    """
    verdicts = ['UNPARSEABLE'] * n_constraints
    text = response_text.strip()
    for i in range(n_constraints):
        patterns = [f'Constraint\\s*{i + 1}\\s*[:\\-\\.]\\s*(VALID|INVALID)', f'(?:^|\\n)\\s*{i + 1}\\s*[:\\-\\.]\\s*(VALID|INVALID)', f'Constraint\\s*{i + 1}\\s*[:\\-\\.]\\s*.*(VALID|INVALID)']
        for pat in patterns:
            match = re.search(pat, text, re.IGNORECASE)
            if match:
                val = match.group(1).upper()
                verdicts[i] = val
                break
    return verdicts


# Setup code
ARGS = {
    'response_text': """
    Constraint 1: VALID
    Constraint 2: INVALID
    Constraint 3: valid
    """,
    'n_constraints': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_file Ran
ran; our contract draft was wrong, not the code
praal/llm-monitoring/Monitoring/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shoushouyu/automated-paper-to-code, is pointer only (licence: NONE) · get_code("47f83b67a25a9c68")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shoushouyu/automated-paper-to-code, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

trace_scorer Ran
ran, honoured the contract we drafted
praal/llm-monitoring/Monitoring/sampler.py
code served (permissive licence) · get_code("3b85c4beb03e9740")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import copy
from typing import List, Dict, Any

class MockMonitor:
    def __init__(self):
        self.current_formulas = [
            "formula_0",
            "formula_1",
            "formula_2"
        ]
        self.history = []
    
    def step(self, action: str, param2: str, param3: int):
        # Simulate stepping through the monitor
        # Track violations in a simple way
        vio_which = "1-3" if "bad" in action.lower() else ""
        self.history.append({
            "vio-which": vio_which
        })
    
    def __deepcopy__(self):
        new_monitor = MockMonitor()
        new_monitor.current_formulas = self.current_formulas.copy()
        new_monitor.history = copy.deepcopy(self.history)
        return new_monitor

samples = [
    "**plan**\nstep one\nstep two with bad action\nstep three",
    "plan: first action\nsecond action\nthird step"
]

source_monitor = MockMonitor()

ARGS = {
    "samples": samples,
    "source_monitor": source_monitor,
    "manual": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
audit_with_ICL_LLM Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditTextWorld.py
code served (permissive licence) · get_code("757502cbf118b7aa")
How it ran

no invocation recorded.

audit_with_LLM Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditScience.py
code served (permissive licence) · get_code("afeec6f1d4c5879d")
How it ran

no invocation recorded.

audit_with_LLM Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditTextWorld.py
code served (permissive licence) · get_code("04a08c3550671099")
How it ran

no invocation recorded.

audit_with_LLM_ICL Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditScience.py
code served (permissive licence) · get_code("11964b438f690df2")
How it ran

no invocation recorded.

audit_with_LLM_ICL Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditTruck.py
code served (permissive licence) · get_code("eb11db10775c64e1")
How it ran

no invocation recorded.

audit_with_LLM_and_labels Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/auditTruck.py
code served (permissive licence) · get_code("13f3939b7250acbf")
How it ran

no invocation recorded.

prompt_model Not yet run
unverified (harvested, no recorded run)
praal/llm-monitoring/Monitoring/utils.py
code served (permissive licence) · get_code("19797015e4d723d3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 13 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
read_file 2 other papers
1 dated earlier, 1 later
2504.20115 (2025-04)
AutoP2C: An LLM-Based Agent Framework for Code Repository Generation from Multimodal Content in Academic Papers
2607.25630 (2026-07)
A Human-in-the-Loop Corpus for LLM-Based Simplification of Scientific Summaries

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We examine one particular dimension of AI governance: how to monitor and audit AI-enabled products and services throughout the AI development lifecycle, from pre-deployment testing to post-deployment auditing. Combining principles from formal methods with SoTA machine learning, we propose techniques that enable AI-enabled product and service developers, as well as third party AI developers and evaluators, to perform offline auditing and online (runtime) monitoring of product-specific (temporally extended) behavioral constraints such as safety constraints, norms, rules and regulations with respect to black-box advanced AI systems, notably LLMs. We further provide practical techniques for predictive monitoring, such as sampling-based methods, and we introduce intervening monitors that act at runtime to preempt and potentially mitigate predicted violations. Experimental results show that by exploiting the formal syntax and semantics of Linear Temporal Logic (LTL), our proposed auditing and monitoring techniques are superior to LLM baseline methods in detecting violations of temporally extended behavioral constraints; with our approach, even small-model labelers match or exceed frontier LLM judges. Our predictive and intervening monitors significantly reduce the violation rates of LLM-based agents while largely preserving task performance. We further show through controlled experiments that LLMs' temporal reasoning shows a pronounced degradation in accuracy with increasing event distance, number of constraints, and number of propositions. CCS Concepts: • Social and professional topics → Technology audits; • Computing methodologies → Natural language generation.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2605.16198")
get_code_for_paper("2605.16198")
have("2605.16198")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2605.16198.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2605.16198.svg)](https://syntology.ai/paper/2605.16198)

Connect an agent — have() is free.