YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
- HealGuard: The Safety Net That Refused to Deploy
- Abstract
- For judges: one minute
- 1. Problem statement and approach
- 2. Why this problem / real use case
- 3. Research questions and pre-registered hypotheses
- 4. Threat model [T3]
- 5. Related work
- 6. Hackathon repos used
- 7. How the repos connect
- 8. Models and licenses
- 9. Datasets, benchmarks, and licenses
- 10. Metrics and why
- 11. Method / experiments
- 12. Results
- 13. Limitations
- 14. With more credits
- 15. Artifacts
- 16. Documentation and reproduction
- 17. Declaration of work done outside the hackathon
- 18. Discussion / what we learned
- 19. Teammates and contributions
- 20. References
- 21. LLM usage statement
- 22. Changelog
- Appendix A β Gate decision schema
- Appendix B β Extra table: gate checks for the guard
- Appendix C β Security considerations [T3]
- Abstract
HealGuard: The Safety Net That Refused to Deploy
One-line claim: We built a pre-registered deployment gate that rejected every heal we tried β including a +10-point fix β because each one traded a visible failure for a hidden one.
Track: Track 3 β Agentic Fine-Tuning. Problem statement: Track 3's Agentic Fine-Tuning statement (the repo does not assign a sub-number; use the number on the submission form).
Content warning: None.
Abstract
No model was deployed. That is the result, not an omission. We built a
deterministic cloud-audit world, five API drifts, a replay-verified healing
pipeline, and a pre-registered deployment gate, then tested ten candidate
entries: the baseline, eight candidate models, and a runtime guard. Every one
was rejected. The gate never produced a DEPLOY.
Two findings justify the work.
- The none-floor illusion. The baseline looked like a 75% agent; it was a
35% grounded agent. Half the benchmark is
none, so answering[]is free. Raw success measured the empty-set prior, not cloud auditing. On the final 200-task D5 block, v0 scored 56.5% raw / 36.5% grounded on drift and 80.0% raw / 45.0% grounded on clean. - The guard side-effect. A runtime repair that rewrote the renamed
argument raised D1 raw success from 75% to 85% and grounded success from
35% to 58.3%, leaving clean at 73.3%. The gate rejected it:
11.7%
residualplus 3.3%premature_finishwere new failure modes. A success-only dashboard would have shipped a model that replaced a schema error with a silent wrong answer.
The contribution is a gate that makes those trades visible: paired bootstrap, family stratification, grounded efficiency, and a new-failure-mode rule, all logged.
Headline before β after: v0 75.0% raw / 35.0% grounded β Runtime Guard 85.0% raw / 58.3% grounded; gate verdict REJECT (11.7% residual, 3.3% premature).
Base model + method: CohereLabs/tiny-aya-global (3.35B, 4-bit nf4, LoRA
r=16/Ξ±=32), SFT/DPO/KL-DPO on replay-verified traces, evaluated by a
pre-registered HealGate.
For judges: one minute
Read the two tables in Section 12. The first shows the raw/grounded gap; the second shows the guard passing every aggregate check and failing the new-failure-mode check. The rest of this write-up is the machinery that produced those numbers, plus the honest limits and the next-round plan.
1. Problem statement and approach
Tool-calling agents are deployed against APIs that move. A field is renamed, a page token changes, a required argument appears, a tool is replaced. The agent's registry is a snapshot; the environment is not. The standard response is to collect the failures and fine-tune a small adapter on corrective traces.
That response has a failure mode of its own: catastrophic forgetting. An adapter trained on the drifted API learns the new call and loses the old one. Aggregate success can rise while a family collapses, or while a schema error becomes a silent wrong answer.
HealGuard tests a stricter claim: a heal should deploy only if a pre-registered statistical gate shows it is better on the failure, no worse elsewhere, and no less efficient.
The pipeline is:
seeded world -> drift injection -> agent rollout -> deterministic classifier
-> replay-verified corrective pairs -> LoRA/DPO/KL-DPO -> HealGate
-> DEPLOY / REJECT / NEED_MORE_DATA -> append-only decision log
The gate is the product. The adapters are the subjects.
2. Why this problem / real use case
Cloud audit agents are long-running, tool-heavy, and exposed to third-party API changes they do not control. A pinned client that silently misses a bucket is worse than a client that errors: the audit returns a clean report while the account is exposed. The same pattern appears in any agent that calls a vendor API: payments, CRM, ticketing, observability.
The practical question is not "can we fine-tune a fix?" It is "can we prove the fix did not break something else?" A team with a 75% baseline and a 85% candidate will ship the candidate. If that candidate introduces an 11.7% silent failure rate, the team has shipped a regression with a better headline.
3. Research questions and pre-registered hypotheses
RQ1. Does raw task success overstate agent competence on a 50% none split?
- H1: grounded success is materially lower than raw success. Confirmed: 75.0% vs 35.0% on D1; 56.5% vs 36.5% on D5.
RQ2. Can a runtime repair raise drift success without changing clean?
- H2: the guard raises drift raw/grounded and leaves clean flat. Confirmed: 85.0%/58.3% vs 75.0%/35.0%, clean 73.3% both.
RQ3. Does a +10-point aggregate gain hide a new failure mode?
- H3: yes. Confirmed: 11.7% residual + 3.3% premature, gate REJECT.
RQ4. Does a harsher, less helpful error make the baseline fail?
- H4: no, not by itself. D1-H (generic
invalid arguments) produced 16/20 on the same seeds as the helpful D1, with the same four failures. The rename was semantically obvious.
Pre-registration. The gate thresholds were frozen in
configs/thresholds.yaml on 11 Nov, before the final D5 block was opened:
min_n=40, gain β₯ +0.10, Ξ±=0.05 paired bootstrap (10,000 iterations, seed 42),
worst-family drop β€ 0.05, steps β€ 1.05Γ, redundant rate not higher, no new
failure label above 2%.
4. Threat model [T3]
The attacker is the API change, not a human adversary. The agent has:
- a pinned tool registry that may be stale relative to the environment;
- no out-of-band notification of the API version;
- a bounded step budget (24 model turns);
- read-only tools, so a wrong call cannot mutate the account;
- a deterministic oracle, so a wrong answer is detectable without an LLM judge.
The gate protects against silent capability regressions in the deployed agent: a candidate that improves the target drift but degrades clean traffic, efficiency, a family, or the failure taxonomy.
5. Related work
- LoRA (Hu et al., 2021): the adapter method used for all candidates.
- DPO (Rafailov et al., 2023): preference optimization used for v1_good and the KL-DPO variant.
- GRPO (Shao et al., 2024): the planned Round 2 objective, using the deterministic oracle as reward.
- TRL (Hugging Face):
SFTTrainer,DPOTrainer, and the PEFT integration. - AuditKIT (Lexsi Labs, 1.1.3): scorers, loop detection, sample plumbing.
- AgentTune (pinned
d4db4c1): the agentic DPO wrapper evaluated for the S1 spine smoke. - Paired bootstrap (Efron): the gate's significance test.
No prior work, to our knowledge, frames agent healing as a release gate with family-stratified, grounded-efficiency, and new-failure-mode checks. The closest practical analogue is a model-release review with a canary and a rollback.
6. Hackathon repos used
| Kit | Used? | How |
|---|---|---|
| AgentTune | Yes, limited | S1 CPU spine smoke; agenttune.agentic and TrlAgenticDPO were evaluated. The final KL-DPO uses TRL DPOTrainer directly because the custom tool-call template is not rendered by the stock path. |
| AuditKIT | Yes | ak.scorer, ak.Score, ak.Direction, ak.AgentLoopDetection, ak.Sample; six declared-direction scorers and loop detection. The gate is our code. |
| CuratorKIT | No | Not used; data is synthetic and generated by our world, so there was no external corpus to filter. |
| AlignTune | No | Not used; DPO/KL-DPO was run through TRL. |
| SafeTune | No | Not used; Track 3 is capability healing, not safety alignment. |
| CircuitKIT | No | Not used; the model is a LoRA adapter, not a circuit-level intervention. |
Honesty note. AgentTune appears in the dependency/pin table and the S1 smoke; it is not the trainer for the final adapters. We do not claim otherwise.
7. How the repos connect
AgentTune (S1 smoke, pinned)
|
v
AuditKIT scorers + loop detection ---> eval/rollout.py ---> gate-ready records
^ |
| v
world/oracle/expert/classifier <--- trajectories ---> HealGate
| |
+--> replay-verified pairs --> TRL SFT/DPO/KL-DPO --+
|
decision_log.jsonl
The gate never calls an LLM. The only "judge" is the deterministic oracle plus the rule classifier; AuditKIT supplies metric plumbing, not a verdict.
8. Models and licenses
- Base:
CohereLabs/tiny-aya-global, 3.35B, 8k context, CC-BY-NC-4.0. - Quantization: 4-bit nf4, double quant; fp16/bf16 compute.
- Adapters: v0, v1_good, v1_sft, v2/v4/v5 run-log variants, v6 KL-DPO. Adapters inherit the base model's non-commercial research terms.
- Teacher: none. The expert is a deterministic Python policy, not a model; there is no distillation from a larger teacher.
- Closed-model baseline: none. The comparison is against v0 and the gate's policy records, not a proprietary API.
- AuditKIT: Lexsi Labs Source Available License 1.2 (non-commercial).
- AgentTune: pinned commit
d4db4c12d52342227c4113a70183d0f64aa2f345.
9. Datasets, benchmarks, and licenses
Source. All data is synthetic, generated by world/snapshot.py from integer
seeds. No public corpus, no scraped data, no third-party labels. The dataset
card is bononi/healguard-data.
| Split | Seeds | Size | Purpose |
|---|---|---|---|
| train_clean | 0β399 | 400 traces | v0 SFT |
| dev | 3000β3039 | 40 tasks | model selection |
| drift_targeted | 6000β6059 | 60 tasks | D1 gate |
| gate_regression | 10000β10059 | 60 tasks | clean + D2/D3/D4 |
| fresh D1 | 40000β40059 | 60 tasks | D1/guard/retrain comparisons |
| final D5 drift | 70000β70199 | 200 tasks | final baseline |
| final D5 clean | 70200β70399 | 200 tasks | final regression bucket |
| D5 training | 71000β71199 | 200 tasks | pairs only |
| sealed | 50 tasks | hash-frozen | not opened; no candidate passed |
Languages. English tool names and prompts; no multilingual evaluation.
Leak check. A seed ledger reserves every evaluation split; the pair loader
drops reserved seeds; a test asserts no overlap. The final D5 pair file is
checked to contain only 71000β71199. Direct id matching is exact because the
data is synthetic; no embedding/MinHash check is needed.
Benchmarks. No public safety or general-capability benchmark is part of the focus task. AuditKIT's six scorers are used for declared directions. The "benchmark" is the deterministic world plus the oracle.
Tool/task environments. Eight tools across three families; 2β4 buckets, 2β3
roles, 2β3 security groups; answers 0β8 ids; 50% none; strict argument specs.
Trajectories are full message logs, re-executable with heal/replay.py.
10. Metrics and why
| Metric | Direction | Why |
|---|---|---|
| Raw task success | higher | The headline number; comparable to a leaderboard. |
| Grounded success | higher | Correct answer and every required evidence call; exposes the none floor. |
| Balanced success | higher | Mean of none and vulnerable success; diagnoses the empty-set prior. |
| Success on vulnerable | higher | The task the project exists to solve. |
| Median successful steps | lower | Efficiency; a heal that needs more turns is a regression. |
| Redundant-call rate | lower | Loop/cost signal. |
| Failure-label share | bounded | New failure mode >2% blocks deploy. |
| Gate gain / bootstrap | higher | Paired effect and significance. |
| Family drop | lower | A blended mean cannot hide a family collapse. |
| Latency / tokens per call | lower | Serving cost; measured on T4. |
Automatic judge check. No LLM judge. The oracle is exact; the classifier is a fixed rule set. On the constructed 112-case battery, classifier accuracy and macro-F1 are 1.000; on 80 real drift rollouts, accepted-label share is 0.500 and residual share is 0.000. The gate's significance is a paired bootstrap, not a human rating.
Agentic trajectory metrics. Task success, grounded success, steps, tool-call validity (replay), redundant calls, and wall-clock latency. The gate compares efficiency only on tasks both runs solved with full evidence.
11. Method / experiments
11.1 Training setup
| Item | Value |
|---|---|
| Base | CohereLabs/tiny-aya-global, 3.35B |
| Quant | 4-bit nf4, double quant |
| LoRA | r=16, Ξ±=32, dropout 0.05, all-linear, bias none |
| Trainable | 30.2M (0.89%) |
| v0 SFT | 400 traces, 5 epochs, 250 steps, LR 1e-4, assistant-only loss |
| DPO | LR 5e-5, 1 epoch, max length 2048 |
| KL-DPO | Ξ²=0.1, frozen v0 reference, 1 epoch, LR 5e-5 |
| v1_sft | 50/50 clean/corrective, 1 epoch, LR 5e-5 |
| Hardware | Colab T4 16GB; 5.13GB peak; 6.1s/step |
| Engine | use_vllm=False; fp16; cast bf16 trainables to fp32; gradient checkpointing |
The T4 patches are not cosmetic: the stock path writes past the tool-call block
and burns tokens on hallucinated turns; a custom template plus early stop at
</tool_call> fixed it. The fp16 GradScaler required casting bf16 trainables to
fp32.
11.2 Seeds
All evaluation seeds are listed in Section 9. The final D5 block was untouched
by training; pairs came from 71000β71199. The sealed set was not opened.
11.3 Ablations
- Prompt-only control: one sentence naming
bucket_name; delta 0.000. - D1-H: generic
invalid arguments; 16/20 both, same failures; null. - Data mixes: 50/50 (v2), higher LR (v4), 75/25 (v5); the stability-plasticity loop in Section 12.
- Guard: opt-in runtime repair; +10 raw, +23.3 grounded, gate reject.
- KL-DPO: Ξ²=0.1 with frozen v0 reference; final D5 candidate, rejected.
11.4 Per-kit defaults
- AuditKIT: six scorers with declared directions; loop detection on every trace.
- AgentTune: S1 smoke only; no final adapter depends on it.
- TRL: SFT/DPO/KL-DPO; assistant-only loss; no packing with assistant masking.
12. Results
12.1 Same model, before vs after
D1, 60 tasks, 95% Wilson intervals:
| Run | Raw drift | Grounded drift | Clean |
|---|---|---|---|
| v0 | 45/60 = 75.0% [62.8, 84.2] | 21/60 = 35.0% [24.2, 47.6] | 44/60 = 73.3% |
| v0 + Guard | 51/60 = 85.0% [73.9, 91.9] | 35/60 = 58.3% [45.7, 69.9] | 44/60 = 73.3% |
Final D5, 200 tasks:
| Split | Raw | Grounded | None | Vulnerable |
|---|---|---|---|---|
| Drift | 56.5% [49.6, 63.2] | 36.5% [30.1, 43.4] | 82.7% (62/75) | 40.8% (51/125) |
| Clean | 80.0% [73.9, 85.0] | 45.0% [38.3, 51.9] | 97.7% (85/87) | 66.4% (75/113) |
Raw records are in artifacts/runs/v0_d5_clean_D5_stale_drift_targeted.jsonl
and artifacts/runs/v0_d5_clean_clean_gate_regression.jsonl; trajectories are
in the matching artifacts/trajectories/ files.
12.2 Candidate table
β = run log, not committed; β = not measured/not committed. Artifact-backed
rows are in artifacts/results.md and artifacts/decision_log.jsonl.
| Candidate | Drift raw | Drift grounded | Clean | Gate | Why |
|---|---|---|---|---|---|
| v0 baseline | 75.0 | 35.0 | 73.3 | β | baseline |
| v1_good (DPO) | 73.3 | β | 75.0 | REJECT | no gain; steps 15 vs 12; redundant rise |
| v1_sft_a (SFT) | 83.3 | β | 61.7 | REJECT | +8.3 < +10; 23/60 schema (38%) |
| v1_sft_b (clean-mix) | β | β | β | REJECT | not committed |
| v2_recovery β | 78.0 | β | 72.0 | REJECT | clean regression |
| v4_recovery β | 80.0 | β | 63.0 | REJECT | clean collapse |
| v5_recovery β | 60.0 | β | 80.0 | REJECT | drift not fixed |
| v0 + Guard | 85.0 | 58.3 | 73.3 | REJECT | 11.7% residual + 3.3% premature |
| v1_poisoned | 63.3 | β | 71.7 | REJECT | corrupted canary |
| v6_recovery (KL-DPO) | β | β | β | REJECT | final D5; early-stop; files omitted |
12.3 Findings
The none floor is the headline. 75% raw vs 35% grounded. A model that gives up gets half the benchmark for free. The gate's efficiency rule uses grounded successes for exactly this reason.
The guard passed the aggregate and failed the taxonomy. +10 raw, +23.3 grounded, clean flat; 11.7% residual + 3.3% premature. It fixed 8 tasks and broke 2 previously solved tasks. The gate refused to net them.
DPO makes models verbose. v1_good was rejected on steps (15 vs 12) and redundant calls; preference learning changed style as well as content.
SFT causes catastrophic forgetting. v1_sft learned the drift and lost the clean API: 61.7% clean, 23/60 schema violations, an F1 drop of 16 points.
A helpful error can be a null. D1-H changed nothing: 16/20 both, same four failures. The rename was obvious; the hint was not the lever.
12.4 What didn't work
- DPO on minimal-edit pairs: no schema reduction, efficiency regression.
- SFT on corrective traces: clean collapse.
- Clean-mix SFT: preserved clean, lost drift.
- KL-DPO with a frozen v0 reference: still rejected.
- D1-H: null; D5: baseline drop, no passing candidate.
- Guard: +10 aggregate, new failure mode.
12.5 Sample trajectory
v0 under D1 (abridged):
assistant: get_bucket_acl(bucket="bucket-40000-0")
tool: {"error":"schema_violation: unexpected argument(s): bucket; use bucket_name"}
assistant: get_bucket_policy(bucket="bucket-40000-0")
tool: {"error":"schema_violation: ... use bucket_name"}
assistant: get_bucket_acl(bucket="bucket-40000-1")
tool: {"error":"schema_violation: ... use bucket_name"}
...
assistant: finish(answer=[])
tool: {"status":"success","answer":[]}
On a none task this is scored correct. The model never read the account. The
guard rewrites the first call, gets {"acl_public": ...}, and the model keeps
its place; the trade is the 11.7% residual set.
12.6 Compute
Colab T4 16GB, free tier plus $20 HF credits. Training runs are minutes; the
200-task rollouts dominate (5.3 s/call, ~14 calls/task). Peak training memory
5.13 GB; no GPU is needed for run_all.py --stage report or the test suite.
13. Limitations
- N=60 for most candidate comparisons; final D5 baseline N=200. Candidate files for v5/v6 are not committed.
- Simulated cloud: three families, one template, one 3.35B model.
- D5 is constructed and easier: built after the nulls, accepts both names, expert-supervised fix. Do not compare its raw number to D1 unqualified.
- No sealed release: no candidate passed; opening the sealed set to rescue a failed candidate would contaminate the negative result.
- Uncommitted rows are marked
β; they are not artifact-backed. - The guard is a runtime repair, not a fine-tuned model.
- English only, one chat template, no multilingual or multi-template claim.
14. With more credits
Budget: $200 HF credits. The plan is a training loop, not a bigger demo.
- GRPO with the oracle as reward. Sample k=4 trajectories/task; reward exact answer, evidence coverage, steps, repeats/loops. LoRA r=32, 1 epoch, KL to v0. Expected: conditional policy without the SFT forgetting trade.
- Scale to 200 tasks/bucket. Pre-register
70000β70199and70200β70399; report 95% paired-bootstrap intervals. Target: +10 grounded with clean flat. - Live ZeroGPU Space. One cached rollout through all checks; a refusal the judge can see, not a canned success.
- D6/D7. Expiring pagination and partial-failure APIs; failures that cannot be guessed from the error text.
- Gate calibration. 100 synthetic candidates (50 poisoned, 50 good); report false-DEPLOY/false-REJECT and family confusion.
- Sealed release. Freeze thresholds and splits, hash them, run once, publish the decision log including rejects.
Expected before/after (forecast, not a result): a candidate that reaches β₯85% raw and β₯65% grounded on D5 with clean β₯78% and no label above 2%; if the gate still rejects, the negative result is stronger because the block is larger and the drift is harder.
15. Artifacts
- HF article: https://huggingface.co/bononi/healguard-article
- Models collection: https://huggingface.co/collections/bononi/healguard-models
- Dataset: https://huggingface.co/datasets/bononi/healguard-data
- Space: https://huggingface.co/spaces/bononi/healguard-timeline
- GitHub: https://github.com/prarthana2031/HealGuard-Lexsi
16. Documentation and reproduction
Environment: Python 3.12.10; pip install -r requirements.txt; no GPU for
the report/tests. Training needs a T4 16GB or better.
Repo layout: world/ environment; oracle/ truth; expert/ teacher;
heal/ drifts/replay/pairs; classifier/ labels; eval/ rollout; gates/
HealGate; training/ recipes; data/ splits; artifacts/ results/logs.
python run_all.py --stage report # regenerates artifacts/results.md
python -m pytest -q # GPU-free suite
python -m eval.rollout --help # GPU rollout harness
Leak check: seed ledger + tests/test_no_leakage.py; final D5 pairs checked
to 71000β71199. Fresh clone: git clone, install, run report, inspect
artifacts/decision_log.jsonl.
17. Declaration of work done outside the hackathon
No submitted component was produced before the hackathon window. The audit
trail starts 3 Nov 2026; all adapters, rollouts, and results in this write-up
were produced during the event. Third-party code is limited to the pinned kits
and libraries in requirements.txt and infra/commits.md.
18. Discussion / what we learned
The most useful result is not a model. It is the demonstration that an aggregate
gain can hide a failure-mode regression. The gate's new_failure_mode_share
check is the difference between a leaderboard and a release process. The
none-floor finding is the second lesson: a benchmark with a large none share
rewards giving up, and grounded success is the honest metric.
The engineering lesson is that hiding an error changes the policy. The guard's silent success removed the feedback the model used to plan; the model stopped early or answered wrong. A runtime repair is not a heal unless the model's policy is trained for the repaired observation.
19. Teammates and contributions
- @prarthana2031 β world/oracle/expert, training infrastructure, D5/guard integration, GPU runs.
- Preethi HJ β classifier, evaluation harness, gate, results, write-up.
Tag the full team on the submission form; adjust handles to the final roster.
20. References
- Hu et al. LoRA: Low-Rank Adaptation of Large Language Models. 2021.
- Rafailov et al. Direct Preference Optimization. 2023.
- Shao et al. DeepSeekMath / GRPO. 2024.
- Hugging Face TRL:
SFTTrainer,DPOTrainer. - Cohere Labs,
CohereLabs/tiny-aya-globalmodel card. - Lexsi Labs, AuditKIT 1.1.3.
- AgentTune commit
d4db4c1. - Efron & Tibshirani, An Introduction to the Bootstrap.
- HealGuard code: https://github.com/prarthana2031/HealGuard-Lexsi
21. LLM usage statement
A coding assistant (DeepSeek V4.1 Flash) was used for code, tests, and
documentation. It did not design the policy, reward, gate, or teacher; those are
hand-written and pinned. Roughly 60β70% of the prose in this write-up was drafted
with AI assistance, then checked against artifacts/ and the decision log. Every
number in the tables is either artifact-backed or marked β .
22. Changelog
- v1 (final): restructured to the official write-up format; added the format-compliant README, standalone abstract, final 200-task D5 tables, confidence intervals, candidate provenance marks, limitations, and Round 2 plan. No experimental result changed.
Appendix A β Gate decision schema
Every decision line contains: logged_at, baseline, candidate, decision,
status, reason, failed_checks, thresholds, buckets, and meta. The
gate is fail-closed: missing labels, missing pairs, or n<40 produce
NEED_MORE_DATA, never a silent pass.
Appendix B β Extra table: gate checks for the guard
| Check | Result |
|---|---|
| Task-success gain | PASS, +0.10 |
| Paired bootstrap | PASS, lower 0.0167 |
| Worst family | PASS |
| Steps on success | PASS |
| Redundant calls | PASS |
| Clean bucket | PASS |
| New failure mode | FAIL, 11.7% residual + 3.3% premature |
Appendix C β Security considerations [T3]
The world is read-only and synthetic. The guard is opt-in and clean-safe. The gate never executes model output as code. The only external calls are HF model downloads; no customer data. The failure being studied is a silent miss, not a safety jailbreak; safety benchmarks are out of scope for this track.