Skip to content

RevGuard: Transactional, version-bound contracts for LLM document editingRevGuard: Transactional, Version-Bound Contracts for LLM Document Editing

Jinkun Chen, Xuemin Yu, Sijia Han, Vlado Keselj
Faculty of Computer Science, Dalhousie University; Meta
arXiv: 其他 AI 安全论文arXiv:2611.40161Originally published Indexed by this site · 2 days agoDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose the REVGUARD transaction layer: across 144 LaTeX editing turns there were no injected-fault commits, and the verifier improved authorization equivalence for 7/48 contracts.

Threat modelNo malicious model is assumed; accidental faults are considered from stochastic generation, stale observations, coarse-grained write tools, incorrect escaping, overly broad or overly narrow contracts, and concurrent modifications. Controllable events can change staged content or the workspace between edit and commit; the main safety event is an injected fault entering the committed workspace. The transaction layer, evaluator and scheduler are trusted, while the editor, contract compiler and semantic verifier are untrusted.

Questions
When an LLM agent modifies a persistent shared document, natural-language instructions do not define write authority after the workspace changes between read and commit, and may lose collaborators' changes or alter unrelated content. The authors focus on how to separately guarantee setup reliability, commit safety and task utility.
Methods
REVGUARD compiles instructions into an immutable edit contract bound to a base version, which an independent LLM verifier reviews, after which a deterministic projection installs least-privilege constraints. The editor can only commit a transaction exactly matching the preview, and version drift is rejected or rolled back.
Experiments and results
All 144 turns of the main test terminated with no injected-fault commits; VERIFIED and COMPILER each succeeded 46/48. Verification improved authorization equivalence for 7/48 contracts with no observed protection loss, but strict task-success non-inferiority remains unestablished.
Limitations and future work
The authors note that the main test has only 12 independent task clusters, and all tasks are local LaTeX edits with deterministic assertions, so it cannot measure semantic or factual correctness or user satisfaction. The repair study also does not estimate the natural incidence rate of rare encoding faults.
Experimental setupGPT-5 mini (openai/gpt-5-mini)、Claude Haiku 4.5 (anthropic/claude-haiku-4.5) et al. · licensed, compilable LATEX repositories、LIPIcs et al. · task success、committed controlled faults et al.
Metrics
task successcommitted controlled faultsnon-terminationnormalized protection equivalencenormalized authorization equivalenceAPI cost
AI summaryResearchers propose RevGuard, a transaction layer that compiles an LLM's instructions to modify persistent shared documents into immutable, version-bound edit contracts, committing only previewed states, to constrain an agent's write permissions. The system has an LLM compiler propose contracts, an independent LLM verifier review them, and a deterministic projection install least privilege. In 144 episodes on permitted and compilable LaTeX repositories, all episodes terminated and no injected fault was committed; in a descriptive 900-cell cross-model stress test, the contract protocol committed zero faults, the unmanaged patch baselines each committed over one hundred faults, and the Git three-way baseline completed 176 clean merges in 180 episodes yet committed 123 controlled faults. Verification improved normalized authorization on 7/48 paired contracts with no observed protection loss, but did not establish a task-utility gain; both the verified and compiler-only contract versions succeeded in 46/48 episodes. The authors state the results support containment of the tested faults in local LaTeX edits and do not concern semantic or factual correctness.

Researchers propose RevGuard, a transaction layer that compiles an LLM's instructions to modify persistent shared documents into immutable, version-bound edit contracts, committing only previewed states, to constrain an agent's write permissions. The system has an LLM compiler propose contracts, an independent LLM verifier review them, and a deterministic projection install least privilege. In 144 episodes on permitted and compilable LaTeX repositories, all episodes terminated and no injected fault was committed; in a descriptive 900-cell cross-model stress test, the contract protocol committed zero faults, the unmanaged patch baselines each committed over one hundred faults, and the Git three-way baseline completed 176 clean merges in 180 episodes yet committed 123 controlled faults. Verification improved normalized authorization on 7/48 paired contracts with no observed protection loss, but did not establish a task-utility gain; both the verified and compiler-only contract versions succeeded in 46/48 episodes. The authors state the results support containment of the tested faults in local LaTeX edits and do not concern semantic or factual correctness.

Related events and news

1 events · 0 news mentions

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Constrain LLM document writes with version-bound transactional contracts, and separately evaluate setup, commit safety, and task utility.

    Core problem: natural-language editing instructions do not define safe write authority after the workspace changes between read and commit.

    • Problem scenario: When an agent modifies a persistent shared document, it may overwrite collaborators' changes with the full content read earlier, or let a staged patch alter unrelated files, delete references, or relax its own protections. The authors argue that such lost updates may not be recognized as failures even when the result compiles and satisfies the requested modification.
    • Insufficiency of existing abstractions: Telling the same model to "be careful" still leaves it proposing the modification, interpreting authority and judging safety; the authors argue that compilation success is only a validity signal, not a complete authorization decision, and that a safe refusal is not the same as completing the task.
    • Core idea: Treat agent edits as transactions authorized by an immutable, version-bound contract; the contract specifies read/write sets, allowed files, a change budget and exact spans that must be preserved, and the final state transition is mediated by deterministic checks.
    • Proposed system and evidence: REVGUARD has an LLM compiler propose the contract, an independently prompted LLM verifier review it, and a deterministic projection install least privilege. The evaluation separately reports setup reliability, commit safety and task utility, as well as paired protection and authorization endpoints.
    • Threat model:
      • Goal: Prevent controlled injected faults from entering the committed workspace while allowing the requested minimal edits.
      • Adversary setting: The authors do not assume a malicious model; they focus on accidental faults caused by stochastic generation, stale observations, coarse-grained write tools, incorrect escaping, overly broad or overly narrow contracts, and concurrent changes.
      • Controllable events: Benchmark events can change staged content or the underlying workspace between edit and commit, constituting a time-of-check-to-time-of-use hazard.
      • Trust boundary: The local transaction layer, evaluator and benchmark scheduler are trusted; the editor, contract compiler and semantic verifier are untrusted probabilistic components.
  2. What related research exists?

    Related work is divided into four groups: agent benchmarks, delegation diagnostics, contracts and agent safety, and collaborative systems and version control.

    Agent benchmarks

    • SWE-bench (Jimenez et al., 2024): conducts agent evaluation with repository-level modifications and executable tests; ToolSandbox (Lu et al., 2025) tests state dependencies and intermediate milestones; τ-bench (Yao et al., 2025) tests domain policies and database target states.
    • The authors state that REVGUARD's domain is narrower but adds version-bound write authorization, controlled concurrency faults and paired candidate-to-final contract endpoints.

    Delegation and diagnostics

    • DELEGATE-52 (Laban et al., 2026): measures semantic document corruption in repeated delegation transformations; token-probability diagnostics (Chen et al., 2026) characterize instability within reasoning traces.
    • The authors position this paper as complementing these behavioral analyses: it checks whether external state transitions are authorized under concurrent workspace changes.

    Contracts and agent safety

    • ContractBench (Wang et al., 2026): studies observation contracts such as stale or byte-sensitive API artifacts, constraining how agents reuse tool observations; this paper studies edit contracts that authorize persistent multi-file state transitions under concurrency.
    • Indirect prompt injection and tool-agent safety: Greshake et al. (2023) study indirect prompt injection in LLM-integrated applications; AgentDojo (Debenedetti et al., 2024) evaluates attacks and defenses; ToolEmu (Ruan et al., 2024) surfaces risks in a simulated sandbox.
    • CaMeL, Progent and permission models: CaMeL (Debenedetti et al., 2025) separates control flow and data flow and uses capabilities to constrain unauthorized information flow; Progent (Shi et al., 2025) and Wu et al. (2026) impose permission control on agent actions. The authors state that this paper applies least privilege to one specific kind of persistent modification rather than proposing a new general permission model.

    Collaborative systems and version control

    • Optimistic concurrency control (Kung and Robinson, 1981) validates work before commit; operational transformation and conflict-free replicated data types handle convergence and intent preservation for concurrent edits.
    • Git three-way merge tests textual compatibility; in the authors' post-review experiments it succeeded in all 36 textual concurrency units yet committed controlled faults in other units. The authors state that the contract layer adds instruction-conditioned authorization on top of its merge and convergence mechanisms.

    Baselines and evaluation targets: The main test compares COMPILER, VERIFIED and a task-author-written REFERENCE; the 900-cell stress test additionally includes whole-file replace, unguarded exact patch and content-bound patch; the post-review Git arm reuses the 30 tasks from the cross-model study. The corpus consists of licensed, compilable LaTeX projects.

  3. How does the paper address this problem?

    REVGUARD separates probabilistic contract proposals from deterministic preview and commit execution, and uses version binding to prevent drift.

    REVGUARD splits editing into contract installation, minimal-edit staging, deterministic preview, and exact commit; the compiler and verifier only propose permissions, and the final constraints are enforced by a trusted transaction layer.

    Edit Contracts and Authorization Boundaries

    • A contract is defined as C=(v,R,W,A,B,P): v is the base version, R and W are the read and write sets, A is the allowed file set, B is the maximum number of changed lines, and P is the path-bound exact preservation atoms.
    • The transaction layer verifies that W is contained in A, that named paths exist, that preservation atoms are grounded in the authorized base state, and checks that the staged diff respects A, B, and P.
    • The contract is external to the editor and immutable; the managed protocol does not expose benchmark assertions, injected-fault metadata, or the task author's reference contract to the compiler or verifier. After content is staged, the editor cannot redeclare a weaker contract.

    Transaction Lifecycle

    1. The editor reads the versioned workspace and installs the managed contract, then stages minimal edits.
    2. The system may inject concurrent events; the preview checks the write scope, change budget, and preservation atoms, and generates a transaction identifier from the base state, contract, and staged content.
    3. Commit requires the identifier to match, and fails if the workspace has drifted; the system commits only previewed transactions, otherwise it rolls back. Staged faults must be fixed and re-previewed; an earlier successful preview cannot be reused.
    • A process watchdog provides an independent turn-level termination boundary; the projection is implemented as a total function that terminates even on adversarial strings.

    Compilation, Independent Verification, and Deterministic Projection

    • COMPILER: an LLM compiles instruction I and a bounded workspace view into a candidate Cc; schema validation, grounding, scope checks, and a minimality linter reject malformed output, with one explicit repair round allowed.
    • VERIFIED: an independently prompted verifier receives I, the bounded workspace, and Cc, and returns a proposal Cv. The authors frame this as proposal–review separation, not same-model self-refinement.
    • Projection: the deterministic function Π(Cc,Cv,I,Sv) produces the final contract Cf; it normalizes the write and allowed-file sets, atomizes preservation clauses, removes redundant read-only atoms, and derives an exact replacement budget where possible.
    • The projection preserves candidate protection on writable files unless it conflicts with the old side of an explicitly authorized replacement; grounding is verified after normalization.

    Fail-Closed and Versioned Repair

    • VERIFIED is the frozen bundle used in the main test and the cross-model study; VERIFIED-G is a separately versioned grounding repair, and the two are not the same frozen model bundle.
    • For preservation atoms proposed only by the verifier, VERIFIED-G retains them only if the trimmed string appears exactly in the corresponding base file, then restores the protection of the verified compiler candidate.
    • When two verification attempts still fail to produce a valid contract, the runner records a fail-closed abstention, does not call the editor, does not install a contract, and records authorization and task success as false.
    • The repaired verifier prompt and the deterministic projection are evaluated as one versioned repair bundle, not split into separate causal factors.

    Paired Endpoints and Evaluation Design

    • REFERENCE installs an immutable least-privilege contract written by the task author; it is a contract-quality control, not a deployable baseline or a task-success ceiling.
    • After deterministic normalization, two endpoints are compared: protection equivalence checks whether reference write isolation and necessary invariants are preserved; authorization equivalence checks whether the expected minimal edit is allowed without unnecessary restrictions.
    • The key mechanism test compares Cc and Cf within the same verification turn, focusing on whether authorization equivalence improves without candidate-to-final protection loss.
    • Each repository contains six task types: write scope, exact preservation, citation or bibliography preservation, macro preservation, change budget, cross-file consumer. Before model calls, the oracle confirms that faults would fail, expected edits would pass, and the project compiles with the declared TeX engine.
  4. What experiments did the paper conduct?

    The 144-turn main test had no fault commits; authorization improved but strict non-inferiority was not established, and the all-unit claim in the stress test does not hold.

    Experimental Setup

    • Main-test models and matrix: editors are openai/gpt-5-mini and anthropic/claude-haiku-4.5; 12 tasks × 2 editors × 3 protocols × 2 repetitions, 144 turns in total. The contract compiler is Claude Haiku 4.5, and the verifier is GPT-5 mini.
    • Cross-model and repair models: the stress test adds Gemini 2.5 Flash, 30 tasks × 3 editors × 5 protocol bundles × 2 repetitions, 900 cells in total; the repair study is 16 exact-preservation tasks × 3 editors × 2 protocols, 96 turns in total.
    • Corpora: development uses the Oxford thesis template, validation uses the Gemini poster template, and the frozen test uses the LIPIcs and NSFC application templates; the stress test uses three new licensed repositories. The paper does not report more scale for the test corpora beyond the total number of entries, broken down by task type.
    • Baselines and metrics: the main test is COMPILER, VERIFIED, REFERENCE; the stress test adds whole-file replace, unguarded exact patch, content-bound patch. Metrics include task success, commit faults, non-termination, infrastructure failures, normalized contract endpoints, request count, and API cost.
    • Determination method: task specifications contain deterministic assertions, reference contracts, and controlled staged faults; the oracle checks fault activation, expected edits, and compilation before model calls. Paired binary outcomes use exact McNemar tests, and task-success uncertainty uses a cluster-level bootstrap over 12 task clusters.
    • Run parameters: low reasoning effort, no provider fallback, 120-second request timeout, 300-second process watchdog, retries only for infrastructure; main results retain the immutable first attempt. The stress test additionally has a 16-step limit; the paper does not report human evaluation or human agreement.

    Main Results

    According to Table 1 and Table 2, all are frozen main-test first attempts; contract endpoints count only the 48 VERIFIED turns.

    Swipe horizontally to read the table

    Protocol or endpointSuccess/equivalence countRateCommit faultsLoss
    COMPILER46/4895.83%0not reported
    VERIFIED46/4895.83%0not reported
    REFERENCE44/4891.67%0not reported
    Protection eq., candidate→final48/48→48/48not reportednot reported0
    Authorization eq., candidate→final24/48→31/48not reportednot reported0
    • Safety and termination: all 144 planned turns produced valid first attempts, with no injected-fault commits, no non-terminating turns or projections, and no unresolved infrastructure failures; all final workspaces compiled.
    • Task utility: the paired difference between VERIFIED and COMPILER is 0.00 percentage points, exact two-sided McNemar p=1; the 12-task cluster-bootstrap 95% interval is [−8.33, 10.42] points. The point estimate passes the frozen −5-point non-inferiority threshold, but the confidence bound does not exceed that threshold, so the authors do not claim strict non-inferiority or a task-utility gain.
    • Mechanism endpoints: the final contract improves authorization in 7 turns and worsens it in no turn; the exact two-sided sign/McNemar probability for the seven discordant pairs is 0.015625. Protection equivalence remains 48/48, on which basis the authors claim authorization refinement with no observed protection loss.

    Cross-Model Stress Test and Repair

    • Descriptive stress results: according to Table 3, the compiler-only contract succeeds 161/180 with 0 faults; the verified contract succeeds 151/180 with 0 faults; unguarded exact patch succeeds 46/180 with 132 faults; content-bound patch succeeds 57/180 with 120 faults; whole-file replace succeeds 8/179 with 0 faults.
    • Whole-cell claim not met: the 900-cell manifest and routing-integrity gate passed, but there were 898 completed results, 1 method failure, and 1 unresolved infrastructure result. One verified setting failed closed before the candidate/final pairing existed, protection integrity was 179/180, the second ordered gate failed, and the preregistered decision was formally inconclusive.
    • Repair compatibility: according to Table 4, VERIFIED and VERIFIED-G each install 48 valid contracts across 48 turns, with abstention, ungrounded installed preservation, candidate-protection loss, and committed controlled fault all 0; safety task success is 48 and 47 respectively. All six ordered gates pass, but the authors state that this only supports repair compatibility on tasks not previously invoked, and does not estimate the natural frequency of rare encoding failures.

    Post-Review Git Three-Way Baseline

    • Overall results: all 180 Git cells are method-valid; task success is 53/180 (29.44%), with 123 controlled faults committed. The agent reaches the merge step in 176 turns, all clean merges, and 4 other turns did not attempt a commit.
    • Applicable boundaries: Git succeeds 36/36 with no faults in post-preview version drift and same-file non-overlapping concurrency; the remaining semantic authorization and preservation categories succeed 17/144 with 123 faults. changed-line budget, cross-file consumer, and write-set scope each succeed 0/18.
    • Authors' interpretation: a clean textual merge is not proof of authorization or preservation; this arm is a reviewer-requested, post-review descriptive arm, is not part of the preregistered 900-cell population, and does not change its ordered-gate decision.

    Other Ablations and Analyses

    • Component comparison: according to Table 5 Panel A, in the 180-cell population, Git, compiler-only, and verified succeed 53/180, 161/180, and 151/180 respectively, with 123, 0, and 0 faults respectively.
    • Reference-contract comparison: according to Table 5 Panel B, in the 48-cell population, REFERENCE succeeds 44/48 with 0 faults; the authors state that it is not a performance ceiling, and that an overly tight contract can lead to safe but unproductive refusals.
    • Main-test failure cases: 8 turns failed to satisfy at least one requested-edit assertion but had no fault commits; 3 GPT-5 mini trajectories wrote incorrect command escaping, 2 Claude Haiku trajectories reached the step limit, 1 REFERENCE trajectory rolled back, and 2 others exposed the boundary of compiler-only for suffixed preservation atoms.
    • Cost: the main test had 1,711 API requests in total, costing $11.8467; VERIFIED's edit trajectories, contract compilation, and verification cost $3.4823, $0.4627, and $0.0712 respectively.
    • Stress-test cost: $43.1748 including all infrastructure retries; the only unresolved cell is Gemini 2.5 Flash's whole-file replace, where all 31 attempts were provider-level finish_reason=error.
    • Figure 3: the horizontal axis is Committed controlled faults, and the vertical axis is Task-success rate (%); the caption states that each of the five protocol bundles spans 30 tasks, 3 editors, and 2 repetitions, and that whole-file replace has only 179 resolved cells due to one unresolved provider outcome.
  5. What are some points that can be further explored?

    The authors call for expanding task clusters and adding semantic and human outcomes; the existing evidence is limited to controlled local LaTeX editing faults.

    Limitations and future directions noted by the authors

    • Task diversity: The main test has only 12 independent task clusters and two held-out repositories; repetitions and models increase the number of turns but not independent task diversity; future non-inferiority work should compute power by repository and task cluster and pre-register one-sided confidence-bound rules (Section 9).
    • Outcome dimensions: All tasks are local LaTeX edits with deterministic assertions; compilation and exact preservation do not measure prose quality, factual correctness or user satisfaction; future work should add semantic and human-review outcomes while retaining deterministic safety endpoints (Section 9).
    • Open-ended dynamics: The fixed-task evaluation does not test open-ended agent–environment co-evolution (Section 9).
    • Models and reproducibility: The evaluated models cover only part of the API ecosystem, and API model behavior changes over time; persisted identifiers, traces, costs and configuration hashes cannot reconstruct proprietary weights (Section 9).
    • Repair evidence: The repair study uses one exact-preservation task per repository and one repetition per editor–protocol cell; tasks come from an unsealed corpus with known local-oracle results, and the rare overescaping error did not recur naturally; it does not support natural failure rates or overall rankings (Section 9).
    • References and scope of conclusions: Reference contracts may encode author bias, and normalization equivalence depends on these references and the chosen write-isolation abstraction; "zero faults" does not prove general safety. The authors also propose compiling more permissive but safe contracts and testing longer-horizon workflows (Sections 8, 9).

    Scope of experimental coverage

    • Models and tasks: The main test uses 2 editors, 12 tasks and 2 repetitions; the cross-model stress test uses 3 editors, 30 tasks, 5 protocol bundles and 2 repetitions (Sections 4.3, 4.5).
    • Defenses and baselines: The evaluation includes COMPILER, VERIFIED, REFERENCE, three unmanaged patch protocols, and a separate post-review Git three-way arm; the Git arm was not included in the pre-registered gate sequence (Sections 4.5, 4.7).
    • Repair sample: The VERIFIED-G paired study totals 96 turns, of which Table 4 reports 48 turns per protocol; an offline regression additionally replays the exact overescaped verifier response that caused the all-unit setup failure (Sections 4.6, 5.6).
    • Statistics and adjudication: Safety and task results come from deterministic assertions and controlled faults, and the paired test is exact McNemar; the paper reports no human review or human agreement (Sections 4.2, 4.3).
    • Extension attempt: Appendix B records that 17 of 240 fresh exact-commit candidate repositories met the then-required screening of 28, and 3 of the subsequent 186 candidates qualified; the frozen feasibility gate was not passed, and strict non-inferiority remains open.
  6. Summarize the main content of the paper

    REVGUARD provides version-bound document transactions; controlled faults are contained, but utility non-inferiority and whole-cell setup integrity are not established.

    REVGUARD is a transaction layer for LLM document editing that addresses write authorization and preservation when a shared workspace changes between read, staging and commit.

    • Problem: Natural-language instructions themselves do not define authority over persistent state transitions; a commit that compiles and satisfies the local request may still overwrite collaborators' changes or alter unrelated content.
    • Method: An LLM compiler proposes read/write scopes bound to a base version, a change budget and exact preservation constraints; an independent LLM verifier reviews them; a deterministic projection installs the final contract; a commit must match the previewed transaction, and version drift is rejected.
    • Main test: All 144 turns terminated with no injected-fault commits. In Table 1, VERIFIED and COMPILER each succeeded 46/48, and REFERENCE was 44/48; strict task-success non-inferiority remains unestablished.
    • Contract mechanism: In Table 2, authorization equivalence went from 24/48 for the candidate to 31/48 for the final, while protection equivalence was 48/48 throughout; the authors state that the verifier improves authorization with no observed protection loss, rather than yielding task-utility gains.
    • Stress and repair: In Table 3, both compiler-only and verified contracts had no commit faults, whereas unguarded exact patch and content-bound patch committed 132 and 120 faults respectively; however, one fail-closed setup failure and one unresolved provider outcome make the all-unit claim formally inconclusive. VERIFIED-G subsequently satisfied the six ordered gates of the repair study.
    • System boundary: The post-review Git arm had 176 clean merges yet committed 123 controlled faults across 180 turns; the authors use this to distinguish textual merging from semantic authorization.

    The authors' conclusions are limited to containment of controlled, local LaTeX editing faults; setup and task completion still depend on the model, and semantic or factual correctness, user satisfaction and longer workflows still require separate evaluation.

Research lineage

2 foundations · 0 follow-ups in library
Explore in knowledge graph →
This paper
RevGuard: Transactional, Version-Bound Contracts for LLM Document Editing
2026-11-29
Follow-up work

No later in-library follow-ups recorded yet.

Hover or focus a connected paper to inspect the citation context.

Read originalarxiv.org