Skip to content

ContractRL: Masked Group-Relative Policy Optimization for Auditable Tool-Call RepairContractRL: Shielded Group-Relative Policy Optimization for Auditable Tool-Call Repair

arXiv· arXiv:2610.00328· Miaobo Hu, Shuhao Hu, Xiaobo Guo, Xin Wang, Bokun Wang, Yina Sa, Daren Zha·Indexed by this site · 2026-10-02· Originally publishedDefenses

Quick read

Defenses

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

ContractRL models repair of failed tool calls as a bounded CR-MDP with action masks; on same-information five seeds with 192 cases per seed, it achieves a semantic success rate of 0.9362 and generates 34.4 tokens.

Threat modelThe online policy sees only the candidate call, typed verifier feedback, JSON Pointer, immutable repair history, and remaining budget; canonical targets and semantic labels are added only after trace freeze. Actions are filtered by a contract mask for malformed or forbidden RFC-6902 operations, and a deterministic fail-closed verifier rejects illegal objects so they do not reach the executor. Evaluation includes wrong pointers, malformed feedback, prompt-injected tool text, and multi-field corruption.

Questions
Structured tool calls often fail because a few fields violate schema or execution contracts. Whole-object regeneration expands the action space, and repeated repairs are hard to audit.
Methods
ContractRL frames verifier-guided JSON repair as a bounded CR-MDP: the state contains the candidate, typed feedback, JSON Pointer, immutable history, and remaining budget; after the contract action mask filters malformed or forbidden RFC-6902 operations, the deterministic verifier performs the transition. The objective includes semantic success and costs for incidental edits, retries, tokens, and unsafe actions, with canonical labels added only after the ledger is frozen.
Experiments and results
Under same information, five seeds, 192 cases per seed, ContractRL semantic success rate is 0.9362 and generates 34.4 tokens, Patch-SFT is 0.9076 and 44.9, and full regeneration is 0.9148 and 137.2 (Table 2). Policy optimization rises from the supervised version's 0.9186 to 0.9375. The three-seed pairing semantic difference relative to Patch-SFT is +0.0396 (95% CI [+0.0137, +0.0662], p=0.0039).
Limitations and future work
The mechanism screen has only 64 single-field, precomputed patches. Semantic success rate drops from 0.9502 on single-field to 0.8516 on nested/array and 0.7935 on ambiguous/multi-field; eight-step multi-round is 0.6457. The authors state that removing the mask or history may allow unsafe dispatch, and that changing external services and longer trajectories would require corresponding tool state and failure costs.
Experimental setup2B rank-8 LoRA、0.8B rank-4 LoRA · BFCL 64-case mechanism screen、192 cases per seed same-information control et al. · semantic success、schema validity et al.
Evaluated models
2B rank-8 LoRA0.8B rank-4 LoRA
Benchmarks
BFCL 64-case mechanism screen192 cases per seed same-information controlthree-seed held-out sandboxnested/array cohortnine-case CPU auditJSONSchemaBench-derived 426 training recordsadversarial suiteeight-case complete-output diagnostic
Metrics
semantic successschema validityfinal-object matchexact-patch matchcollateral editsgenerated tokensmean retriesp95 latencyfirst-attempt validity
AI summaryContractRL models verifier-guided JSON repair as a constrained decision process, filters violating RFC-6902 operations through a contract-derived action mask, and designs a contract-constrained group-relative objective to optimize the three decision types of patching, retrying, and abstaining. Under the same verifier information, the method achieves 0.9362 semantic success rate and 34.4 generation tokens, outperforming Patch-SFT's 0.9076/44.9 and full regeneration's 0.9148/137.2 (192 cases per seed, five seeds total); policy optimization also raises semantic success rate from the supervised version's 0.9186 to 0.9375.

ContractRL models verifier-guided JSON repair as a constrained decision process, filters violating RFC-6902 operations through a contract-derived action mask, and designs a contract-constrained group-relative objective to optimize the three decision types of patching, retrying, and abstaining. Under the same verifier information, the method achieves 0.9362 semantic success rate and 34.4 generation tokens, outperforming Patch-SFT's 0.9076/44.9 and full regeneration's 0.9148/137.2 (192 cases per seed, five seeds total); policy optimization also raises semantic success rate from the supervised version's 0.9186 to 0.9375.

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?

    Failed tool calls only need a few fields changed; whole-object regeneration is hard to audit; ContractRL uses bounded contract repair.

    Structured tool calls often fail because a few fields violate the schema or execution contract; regenerating the whole object expands the action space and makes repeated repairs hard to audit.

    • Scenario: the authors study the decision after one failed tool call: which field to change, whether the remaining budget is still worth another repair, and when to abstain. The authors argue that broad regeneration can satisfy the schema while changing fields unrelated to intent.
    • Limitations of existing approaches: according to the authors, most structured generation methods optimize what to generate from scratch; syntax- or schema-constrained decoding, post-processing, and verifier-guided repair differ from each other, but lack a sequential repair protocol that imposes locality and resource constraints on patches, retries, and abstention under the same public information.
    • Core setting: the authors define repair as a bounded transaction on an already meaningful object, namely the Contract-Constrained Repair MDP (CR-MDP): public state, admissible local actions, and deterministic transitions before any tool execution.
    • Proposed method: ContractRL is a contract-constrained sequential repair protocol. The policy observes the candidate, typed verifier feedback, JSON Pointer, immutable repair history, and remaining budget; a contract-derived action mask filters malformed or forbidden RFC-6902 operations before the deterministic verifier transition. Canonical targets and semantic labels do not enter the online state before trace freeze.
    • Threat model:
      • Goal: make decisions on patches, retries, and abstention under explicit locality and resource constraints, with semantic success as the primary term and incidental edits, retries, tokens, and unsafe actions as constrained costs; requires zero unsafe dispatches.
      • Knowledge: the online policy receives only the fields in the corresponding public evidence summary. Oracle labels, target answers, hidden cards, and future service outputs are stored separately and added only after trajectory decisions are frozen.
      • Capability: actions are bounded RFC-6902 patches or ABSTAIN. Model evaluation allows at most two patch attempts; the mask removes malformed operations, unavailable paths, immutable path edits, illegal move/copy sources, and actions exceeding the remaining operation budget. Illegal actions return a typed failure, consume the declared attempt count, and do not reach the executor.
      • Victim system: the failed structured tool call and its execution contract. The verifier is deterministic and fail-closed: a patch is accepted only if both schema and cross-field checks pass. The semantic endpoint executes accepted objects in a deterministic tool sandbox.
  2. What related research exists?

    The authors position ContractRL among generation-time constraints, post-hoc processing, and verifier-guided repair.

    Structured Output Repair

    • ReAct (Yao et al., 2023) and Toolformer (Schick et al., 2023): make tool calls explicit.
    • Reflexion (Shinn et al., 2023) and Self-Refine (Madaan et al., 2023): use external or self-generated feedback for iterative correction.
    • ToolSandbox (Lu et al., 2024) and SWE-bench (Jimenez et al., 2024): the former spells out stateful, multi-round tool interaction and environment-side verification; the latter shows that code repair is ultimately judged by repository-level tests rather than syntax alone.

    Local Verification and Offline Learning

    • Let's Verify Step by Step (Lightman et al., 2024), Math-Shepherd (Wang et al., 2024), and ProcessBench (Zheng et al., 2024): check intermediate structure rather than trusting only the final answer; process-level labels and held-out error-localization protocols are cited by the authors as precedents for exposing local supervision.
    • CQL (Kumar et al., 2020), IQL (Kostrikov et al., 2022), and D4RL (Fu et al., 2020): emphasize support and partition completeness under distribution shift; the authors accordingly separate BFCL cases from adapter evaluation.
    • Syntax- and schema-constrained decoding: the authors use it as a direct comparison in Section 4.2's matched comparison.

    Closest Structured Output and Repair

    • VeriHarness (Ray & Goyal, 2026) and PatchBoard (Zhang et al., 2026): the former uses code-controlled verifier loops, bounded calls, and trajectory logs; the latter makes verified JSON Patch changes on schema-anchored state with a deterministic transaction core.
    • Schema Reinforcement Learning (Lu et al., 2025) and SLOT (Shen et al., 2025): the former trains schema-compliant generation with reinforcement learning; the latter post-processes unconstrained outputs.
    • JSONSchemaBench (Geng et al., 2025), XGrammar (Dong et al., 2024), and BFCL (Patil et al., 2025): the first two evaluate generation-time constraints; BFCL provides a function-calling benchmark, which the authors state is not a repair algorithm.

    Agent Evaluation Context

    • tau-bench (Yao et al., 2024) and AgentDojo (Debenedetti et al., 2024): the former adds multi-round user simulation, domain policies, and passk consistency; the latter incorporates untrusted tool data and prompt-injection robustness into the environment contract.
    • SWE-agent (Yang et al., 2024): a protected agent–computer interface can make edit actions and execution feedback auditable.
    • Broader policy optimization and agent evaluation: the authors list PPO, DPO, instruction tuning, AgentBench, selective prediction, and reward auditing as complementary baselines for training objectives, tool-use breadth, selective prediction, and reward auditing, without item-by-item comparison to this paper.

    Baseline Methods and Benchmarks: the baselines for the main comparison are full regeneration, constrained decoding, and Patch-SFT. The structural mechanism anchor uses BFCL's 64 definition/answer pairs; training records come from 426 JSONSchemaBench-derived items; semantic results are executed in a matched sandbox, and the adversarial suite covers wrong pointers, malformed feedback, and prompt-injected tool data.

    The authors position this paper as: a verifier-conditioned sequential repair policy on a contract-derived action space, with bounded retries/abstention, post-freeze oracle separation, and measurable policy-optimization comparisons; its goals are evaluated under same-information and supervised-to-policy comparisons.

  3. How does the paper address this problem?

    CR-MDP uses public state, contract masks, and post-freeze scoring to limit repairs to local patches or abstention.

    ContractRL frames verifier-guided JSON repair as a bounded decision process: each step proposes only contract-allowed local patches or abstains, with a deterministic verifier performing the transition, and specification objects and semantic labels are added only after the ledger is frozen.

    Problem Setting and Formalization

    • Round start: each reported mechanism round starts from a legal tool call and one deterministic single-field corruption. The online input contains the corrupted call and typed verifier errors, not the target object. Model evaluation allows at most two patch attempts, with verification after each applicable patch. Mechanism replay uses one precomputed patch per case, so learned retry strategies are not measured.
    • Two offline equivalences: exact patch match Mpatch(p)=1[p=p⋆], where p⋆ is the canonical ordered operation list; final object match Mobject(p)=1[x ⊕ p = x⋆], where x⋆ is the hidden canonical object. The authors state: under the same starting point and target construction, exact patch match implies final object match, but the converse need not hold, because different patch sequences can produce the same object.
    • Information boundary: Gold candidates and target patches remain offline scoring fields. Each run binds configuration, source revision, seed, and ordered trajectory to a SHA-256 manifest; the serialized policy input contains only public state.

    CR-MDP and Action Masking

    • State: at repair step t, the state is st = (xt, et, qt, ht, bt, kt). xt is the current candidate, et and qt are the typed verifier code and JSON Pointer, ht is an immutable summary of previous patches and verifier states, and (bt, kt) are the remaining attempts and operation budget.
    • Actions and transitions: the action set is A(st) = Amask(st) union {ABSTAIN}. Patch actions first check JSON syntax, path applicability, immutable paths, operation count, and schema-declared prohibitions; only admissible patches are applied and handed to the deterministic verifier.
    • Masking: removes malformed operations, unavailable paths, immutable path edits, illegal move/copy sources, and actions exceeding the remaining operation budget. Locality relative to qt is a soft preference of the policy, not a hidden target.
    • Patch semantics: the evaluator accepts RFC-6902-style add, remove, replace, move, copy. The reported screen and adapter targets use only add or replace. Acceptance requires schema check and cross-field check both equal to 1. Extra retries r = a − 1, where a is the number of actually issued or replayed patch attempts, 1 ≤ a ≤ 2. Initial corruption does not count as a repair attempt. Incidental edits are defined as leaf paths that are changed and not covered by the paths of issued operations.

    Policy Objective and Online Flow

    • Objective: the policy is initialized from patch supervision data, then optimized with a group-relative objective over full repair rounds. The reward is the semantic success indicator minus weighted costs for incidental edits, retries, unsafe actions, and generation tokens, subject to zero unsafe dispatches, total operations not exceeding K, and attempts at most B. U counts inapplicable or forbidden actions, and T is the generation token cost. The paper gives the symbolic form of this objective and does not give specific λ values in the main text.
    • One round: the generated output is parsed as a bounded patch or ABSTAIN, filtered by the action mask, and sent to the deterministic verifier. Illegal or inapplicable responses consume one attempt and may expose the next typed verifier report; a stop action can preserve remaining budget. Patches, verifier responses, attempt counts, extra retries, and incidental edit counts are written to the repair ledger before p⋆ and x⋆ are added for the two matches; neither is an online repair input.
    • Ledger stages: Table 4's order is Observe, Patch, Validate, Retry, Freeze, Score. The first five stages do not see the targets; Score adds the canonical patch and object post hoc. Table 14 marks candidate JSON, typed verifier code, JSON Pointer, schema version, and patch ledger as online, and canonical patch, canonical object, and semantic tool results as offline.

    How the Evaluation Protocol Determines Success

    • Structural quantities: schema validity is the deterministic conjunction of schema check and cross-field check after patch application. Final object match and exact patch match are reported separately. Zero incidental edits on the mechanism screen is by construction: each precomputed operation targets the reported pointer, and the current metric excludes that path.
    • Semantic success: the repaired call is executed in the sandbox, and the tool response is deterministic. A case succeeds only if the executed tool receives the expected object and returns the expected task result. Schema validity is diagnostic only and does not substitute for semantic success.
    • Same-information and case matching are two protocols: all four arms of Table 2 receive the candidate, schema, typed error code, JSON Pointer, and public repair history, differing only in output representation and decoding rules. Case-matching comparisons use the same case identifiers, output caps, retry accounting, verifier implementation, and latency measurement, but public verifier inputs differ by arm (Appendix B), which the authors call not a same-information intervention.
  4. What experiments did the paper conduct?

    Under same-information settings, ContractRL achieves a semantic success rate of 0.9362 with 34.4 tokens; single-field performance is higher than nested and ambiguous multi-field.

    Experimental setup

    • Evidence unit: the mechanism screen is a deterministic replay of 64 real BFCL definition/answer pairs on seed 13, with 32 missing_required and 32 wrong_type single-field corruptions, one precomputed single-operation patch per case. New LoRA SFT adapters are evaluated on the same fixed 64-case file: 2B rank-8 with four seeds, 0.8B rank-4 with eight seeds. The five-seed experiment has 192 cases per seed. There are also nine CPU audit cases and eight full-output diagnostic cases.
    • System under test: the adapter scales stated in the paper are 2B rank-8 and 0.8B rank-4. For the base model names in case matching and same-information comparisons, the paper does not give specific model names in the main text, only stating that all arms use the same base model, with model scale and adapter rank recorded in the seed manifest.
    • Baselines: full regeneration generates a complete object from the corrupted call and schema; constrained decoding enforces grammar or schema during generation; Patch-SFT predicts a bounded patch from the typed error. The context-only control removes the full validation block and keeps the surrounding calls; the authors state that this is a packed information-block control, not a typed-encoding ablation.
    • Metrics: semantic success rate, schema validity, final object match, exact patch match, first-attempt validity, incidental edits, mean retries, generated tokens, mean latency, and p95 latency. Latency is in seconds; tokens count generated output unless otherwise stated. n/a means the metric is outside that arm's scope of operation.
    • Success determination: structural checks are performed by a deterministic validator. Semantic endpoints execute the accepted object in a deterministic tool sandbox and check task results and side effects. The executor does not receive hidden targets before validation. The paper does not report LLM-as-judge or human agreement coefficients; the qualitative audit in Table 38 retains human labels and gives no agreement numbers.
    • Splits: the 426 JSONSchemaBench-derived training records and the selected 64 evaluation records have zero overlap in case ID, candidate/target fingerprints, schema hash, target path, operation sequence, pointer-related error template, semantic equivalence cluster, schema shape, tool name, and candidate pool (Table 8, Table 16). Table 8 also lists, on the training side, 147 schema hashes, 26 held-out hashes, 392 pairs over 61 pointer/error templates, and 118 pairs over 23 tool names.

    Main results

    Same-information comparison (Table 2; the bars in Figure 2 match the totals in Table 2): five seeds, 192 cases per seed, and the four arms receive the same candidates, schema, typed error codes, JSON Pointer, and public repair history.

    Swipe horizontally to read the table

    ArmSemantic success rate ↑Generated tokens ↓p95 latency (s) ↓Incidental edits ↓
    Full regeneration0.9148137.22.540.1876
    Constrained decoding0.8879146.12.800.1743
    Patch-SFT0.907644.91.490.0488
    ContractRL0.936234.41.300.0169

    According to Table 2.

    • The authors' interpretation: under this same-information setting, ContractRL's semantic success rate is higher than the other three arms, with lower generated tokens, p95 latency, and incidental edits. The authors link these gains to local correction and state that feedback, action masking, budget, and schema-shift analyses support this link.
    • Case matching is a different denominator: Table 3 is three seeds, 64 held-out cases per seed, and the arms have different public inputs. ContractRL's schema validity is 0.9768, semantic success rate 0.9314, mean retries 0.0547, generated tokens 34.6, mean latency 0.83 s, incidental edits 0.0189; full regeneration is 0.9392, 0.9027, 0, 138.9, 1.76, 0.2214; constrained decoding is 0.9901, 0.8663, 0, 147.8, 2.11, 0.1986; Patch-SFT is 0.9446, 0.8918, 0.1176, 46.7, 0.97, 0.0618. The p95 latencies in Table 10 are 1.30, 2.58, 2.85, and 1.55 s respectively. The authors state that this is a case-matched resource comparison, not an isolated patch-representation effect.
    • Policy optimization and pairing: the authors report that policy optimization raises semantic success rate from 0.9186 for supervised ContractRL to 0.9375 (Table 5: 192 cases per seed, five seeds; Patch-SFT in the same table is 0.8927). Another three-seed paired semantic difference relative to Patch-SFT is +0.0396 (95% CI [+0.0396's interval is +0.0137 to +0.0662], p = 0.0039). The five-seed 2B/r8 sweep in the introduction separately reports ContractRL semantic success rate 0.9331 and generated tokens 34.8, with the listed Patch-SFT, full regeneration, and constrained decoding at 0.8924–0.9041 and tokens 46.9–148.1, under their respective recorded information conditions.

    Structural screen and adapters

    • What was tested → results: the BFCL mechanism replay in Table 1 gives schema validity and object match both 1.0000 on 64 cases with one precomputed attempt, with 1.00 attempts; the ledger is 32 single-operation add and 32 single-operation replace, with zero extra retries. The authors state that this is not evidence that a learned policy achieves 64/64.
    • Validation block: 2B rank-8, four seeds, validation-block schema validity 0.9727 and object match 0.9141, versus context-only 0.0820 and 0.0742. 0.8B rank-4, eight seeds, are 0.9473 and 0.7441 respectively, versus context-only 0.0000 for both. The seed standard deviation for typed 2B object match is 0.0202 (four seeds) and for 0.8B is 0.0391 (eight seeds). The authors state that these are seed summaries, not confidence intervals; because the control removes the entire validation information block, this comparison cannot identify which encoding component causes the difference. The bars in Figure 3 match these seed means.
    • Nine-case and eight-case audits: the independent audit gives final structural validity 7/9 and repairable-case acceptance 6/8; failures include one rollback, one wrong-path rejection, and one immutable-pointer rejection (1 each recorded in the right column of Figure 4). The eight full-output diagnostics are 8/8 parseable, 6/8 schema-valid, 6/8 exact final object match, and 0/8 token-limit hits (Figure 5).

    Case families, transfer, and adversarial

    • By family: in Table 13, ContractRL single-field 128 cases: first validity 0.9716, semantic success rate 0.9502, mean retries 0.0280, generated tokens 31.8, p95 latency 1.13 s, incidental edits 0.0096. Nested/array in Table 3 is schema validity 0.9187, semantic success rate 0.8516, mean retries 0.1239, tokens 42.9, mean latency 1.04 s, incidental edits 0.0297. Ambiguous/multi-field 192 cases: first validity 0.7639, semantic success rate 0.7935, mean retries 0.2361, tokens 48.6, p95 latency 1.84 s, incidental edits 0.0432. The authors state that these rows describe operating boundaries rather than isolated method effects, because the cohorts are not merged across methods.
    • Transfer: in Table 11, ContractRL on missing-required has first validity 0.9815, final validity 0.9952, mean retries 0.0185, pointer correction 0.9937, incidental edits 0.0054, semantic success rate 0.9598; wrong-type is 0.9618, 0.9861, 0.0382, 0.9804, 0.0137, 0.9406. The main text separately reports that in matched runs ContractRL has first validity 0.9453, final validity 0.9768, mean retries 0.0547, and Patch-SFT is 0.8897, 0.9446, 0.1176.
    • Adversarial and multi-turn: in the held-out adversarial suite, a single line of injected tool text gives schema validity 0.9453 and semantic success rate 0.8989; malformed feedback gives 0.7846 and 0.7168; wrong pointer gives 0.8172 and 0.7449. Table 9 reports for "all" or "patch arms": single-field 0.9674 / 0.9128, multi-field 0.8497 / 0.7892, nested array 0.8985 / 0.8307, wrong pointer 0.8172 / 0.7449, malformed feedback 0.7846 / 0.7168, prompt injection 0.9453 / 0.8989 (the former is schema validity, the latter semantic success rate). Limitations states an eight-step semantic success rate of 0.6457. The qualitative samples in Table 38 include single-field accepted and successful, nested index accepted but semantic failure, wrong path and malformed feedback rejected and not executed, multi-field partially accepted but semantic failure, and immutable field rejected.

    Other ablations and analyses

    • Components: the conclusion states that component ablations show the cost of removing action masking, repair history, learned stopping, or the incidental-modification objective; Limitations states that removing masking or history can permit unsafe dispatch. Table 29 is labeled as the component table, and the main text does not give its row-by-row numbers.
    • Feedback and budget: the authors state that feedback, action masking, budget, and schema-shift analyses link the gains to local correction; Table 27 and Table 28 are labeled as feedback and policy-optimization rows, and apart from the 0.9186 and 0.9375 already listed in the abstract and Table 5, the main text does not list row-by-row numbers.
    • Operation-family retries: Table 15 reports add 0.018, replace 0.038, remove 0.154, move/copy 0.124; the retry cost reported for wrong path and ambiguous is 1.000 for both. The 64-case mechanism screen does not include remove, move, copy, nested, array, multi-field, or ambiguous/noisy-validator cases.
    • Resources: in Table 12, ContractRL single-field prompt tokens 1111, output tokens 31.8, validator calls 1.028, p95 latency 1.13 s, semantic success rate 0.9502; nested/array is 1135, 42.9, 1.124, 1.52, 0.8516.
    • Blind-review index: Table 39 records the independent audit as 120 blind-review cases per arm and points to Table 37; the main text does not give Table 37's pass rate.
    • Negative boundary: constrained decoding's semantic success rate in Table 2 is 0.8879, below full regeneration's 0.9148; in Table 3 it is 0.8663, below full regeneration's 0.9027, despite its higher schema validity (0.9901 in Table 3). The authors treat structural gains accompanied by semantic loss as a failure boundary.
  5. What are some points that can be further explored?

    The authors point out the single-field mechanism screen, the multi-field and eight-step declines, and unsafe dispatch when the mask or history is removed.

    Limitations and future directions noted by the authors

    • Mechanism screen scope: The mechanism screen covers 64 single-field corruptions with precomputed patches (Limitations).
    • Learned policy scope: The learned policy evaluation covers the specified sandbox, model sizes, case families, and attempt budgets (Limitations).
    • Semantic success under structural shifts: Semantic success drops from 0.9502 on single-field cases to 0.8516 on nested/array cases and 0.7935 on ambiguous/multi-field cases (Limitations).
    • Multi-turn: The eight-step semantic success rate in the multi-turn study is 0.6457 (Limitations).
    • External services and longer trajectories: The authors write that generalization to changing external services and longer repair trajectories requires evaluation with corresponding tool states and failure costs (Limitations).
    • Contract completeness: Ablations also show that removing the mask or history can allow unsafe dispatch, so the full contract is part of the evaluated system (Limitations). The conclusions also state that error pointers, malformed feedback, and multi-field corruption remain clear failure boundaries.

    Experimental coverage

    • Structure and adapters: Mechanism replay uses 64 cases with one precomputed operation; adapters are 2B rank-8 with four seeds and 0.8B rank-4 with eight seeds, each reporting schema validity and object matching on verification blocks and context-only (Table 1). There are also nine transaction audits and eight full-output diagnostics (Figure 4, Figure 5).
    • Denominators for policy comparisons: The same-information comparison uses five seeds with 192 cases per seed (Table 2). The case-matched semantic and efficiency table uses three seeds, with held-out behavior at 64 cases per seed, and nested/array as a separate case family (Table 3, Table 10). The measurement cohort in Table 13 is 128 single-field, 192 nested/array, and 192 ambiguous/multi-field cases.
    • Adversarial and transfer: Table 9 reports schema validity, semantic success rate, average retries, and latency for single-field, multi-field, nested arrays, error pointers, malformed feedback, and prompt injection. Table 11 reports first/final validity on missing-required, wrong-type, and mixed families.
    • Splits and freezing: Training with 426 cases and held-out with 64 cases yield 0 on the overlap checks listed in Table 8 and Table 16. Canonical objectives are added after trajectory freezing (Table 4, Table 14).
    • Items not reported in the paper: The main text gives symbols for group-relative objectives but does not report values for λc, λr, λu, or λy, nor specific values for K and B (only stating that attempts are at most two, 1 ≤ a ≤ 2). The case-matched and same-information experiments do not name the base model in the main text. The per-item ablation numbers in Table 29, the pass rates for blind review with 120 cases per arm in Table 37, and the number of cases in the eight-step multi-turn setting are not listed in the provided main text. The paper does not report agreement between semantic judgments and human labels.
  6. Summarize the main content of the paper

    ContractRL uses masked patches and a frozen ledger for auditable repair, with a semantic success rate of 0.9362 under same-information settings.

    ContractRL is contract-constrained group-relative policy optimization for auditable tool call repair: instead of rewriting the whole object, it performs bounded patches, retries, or abstentions under a public verifier state.

    • Problem: A few fields violating schema or execution contracts can cause structured tool calls to fail. The authors argue that whole-object regeneration expands the action space and may alter unrelated fields, and repeated repairs are hard to audit.
    • Method: The CR-MDP state includes the current candidate, typed errors with JSON Pointers, immutable history, and remaining budget. A contract mask first removes malformed or forbidden actions, then a deterministic fail-closed verifier transitions; illegal objects do not reach the executor. Semantic success is the primary term, with edits, retries, unsafe actions, and tokens as costs. Canonical patches, canonical objects, and semantic labels are added only after the ledger is frozen.
    • Same-information results: With five seeds, 192 cases per seed, and all arms seeing the same public fields, ContractRL achieves a semantic success rate of 0.9362, 34.4 generated tokens, p95 latency of 1.30 s, and incidental edits of 0.0169; Patch-SFT achieves 0.9076, 44.9, 1.49, and 0.0488; full regeneration achieves 0.9148, 137.2, 2.54, and 0.1876; constrained decoding achieves 0.8879, 146.1, 2.80, and 0.1743 (Table 2).
    • Other measurements: Policy optimization improves from 0.9186 for supervised ContractRL to 0.9375. The semantic difference for three seeds paired relative to Patch-SFT is +0.0396 (95% CI [+0.0137, +0.0662], p = 0.0039). In three-seed case-matched settings (public inputs differ by arm), ContractRL achieves a semantic success rate of 0.9314 with 34.6 tokens. Structural validity for 64 precomputed replay cases is 64/64, which the authors state is not a result of the learned policy. The 2B verification block achieves object matching of 0.9141, while context-only achieves 0.0742.
    • Authors' conclusions: The authors believe this interface separates accounting for mechanisms, semantic results, and resource costs. Single-field semantic success is 0.9502, nested/array is 0.8516, and ambiguous/multi-field is 0.7935; eight-step multi-turn is 0.6457. The authors state that error pointers, malformed feedback, and multi-field corruption remain failure boundaries; removing the mask or history can allow unsafe dispatch, and the full contract is part of the evaluated system.
Read originalarxiv.org