File size: 6,289 Bytes
0abd7f3
 
 
 
 
 
 
 
c27a2ad
0abd7f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3f5893d
 
 
0abd7f3
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
library_name: peft
base_model: CohereLabs/tiny-aya-global
license: cc-by-nc-4.0
language:
- en
datasets:
- mitushigoyal5/shipwright-sft
- mitushigoyal5/shipwright-runs
pipeline_tag: text-generation
tags:
- lora
- peft
- agents
- tool-use
- self-healing
- tau2-bench
- agenttune
- auditkit
- shipwright
---

# Shipwright: self-healed Tiny Aya (round 16, deployed)

A LoRA adapter for [Tiny Aya Global](https://huggingface.co/CohereLabs/tiny-aya-global) (3.35B) from **Shipwright**, a
self-healing service for a tool-calling support agent: it finds the conversations its agent failed, classifies why,
fixes the cause in the tool layer or the weights, and redeploys only when an 8-check gate measures the new agent as
better on tasks it never trained on. Built for the Lexsi Labs AI Safety and Alignment Hackathon, Track 3, problem
statement 8 (self-healing agents).

| | |
|---|---|
| **What it is** | LoRA (r 16) on Tiny Aya Global, trained with AgentTune on 789 rows: 254 teacher conversations, 235 on-policy corrections of the student's own wrong turns, 300 general function-calling examples |
| **How it was made** | One unattended run of the loop (round 16): no person between launch and promotion, 2 h 24 min, $3.89 |
| **Result** | Passed all 8 gate checks against the base model on 20 held-out τ²-bench retail tasks × 3 trials (below) |
| **Status** | **Deployed**: the promoted system in the service's promotion ledger, served with Shipwright's tool guards on |

## Results (gate 16, held-out τ²-bench retail, 60 conversations per system)

| | Base Tiny Aya | **This adapter + guards** |
|---|---:|---:|
| Task success, pass^1 (95% Wilson interval) | 10.0% (4.7–20.2%) | **15.0%** (8.1–26.1%) |
| Task success on every one of 3 trials, pass^3 | 10.0% | 10.0% |
| Tool calls that fail | 44.3% | **5.7%** |
| Wasted tool calls (repeated, failed or blocked) | 69% | **21%** |
| Runs that invented an order or item id | 40 of 60 | **0** |
| BFCL v3, general tool calling (simple, multiple, irrelevance) | 45.0 | **73.3** |
| Gate checks passed | | **8 of 8** |

The teacher (DeepSeek V4.1 Flash) solves 32% of the same tasks. 60 runs per system is a small sample: two tasks
flipping move pass^1 by 10 points, so read the intervals, not only the point estimates. The hidden split (20 tasks
opened once) was measured before this round existed, with the round 7 adapter: 0% → 10%. Every number here is
recomputed from the public run files by `scripts/reproduce.py`; the gate's own files are in `metrics/`.

## Use it

The adapter was trained on, and is served with, Shipwright's **prompted tool calls**: Tiny Aya has no native tool
calling, so the tools are listed in the system prompt and the model answers a tool call with one fenced JSON block,
for example

````
```json
{"name": "get_order_details", "arguments": {"order_id": "<that order id>"}}
```
````

and anything else as text to the customer. Tool results come back as user turns, `Tool result for <name>: <result>`.
Use the same format (the service's `prompted_tools.py`) to get the measured behaviour.

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("mitushigoyal5/shipwright-lora")
base = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global", device_map="auto")
model = PeftModel.from_pretrained(base, "mitushigoyal5/shipwright-lora")
```

With vLLM (how the gate serves it, on one A10G):
`vllm serve CohereLabs/tiny-aya-global --enable-lora --max-lora-rank 16 --max-model-len 8192 --lora-modules shipwright=mitushigoyal5/shipwright-lora`

## Training

- Base model `CohereLabs/tiny-aya-global`; a fresh adapter (not continued from an earlier round).
- LoRA r 16, alpha 32, dropout 0.05, all attention and MLP projections; learning rate 1e-4, 2 epochs, batch 1 ×
  gradient accumulation 8, max sequence 8,192 tokens, seed 300; final train loss 0.52; 38 minutes on one L40S.
- AgentTune `create_distill_trainer` on `EventLog`s, with a masked SFT loss: only assistant turns are trained, and in a
  correction row only the teacher's corrected turn.
- Data: [`mitushigoyal5/shipwright-sft`](https://huggingface.co/datasets/mitushigoyal5/shipwright-sft), branch
  `round-16`. Only τ²-bench train tasks; no held-out or hidden task was ever trained on. The general function-calling
  rows come from BFCL samples the gate never scores.
- Lineage (inputs, settings) in `lexsi_provenance.json`; the full training record in `training_meta.json`.

## Every round

Each round's adapter is on its own branch, kept whether it shipped or not, with the gate that judged it:

| Branch | Gated in | Decision |
|---|---|---|
| `round-3` | gate 3 | refused (5 of 8 checks): general tool calling fell |
| `round-4` | gate 4 | refused (3 of 8) |
| `round-5` | gates 5, 6 (+ guards) | refused (6 of 8) |
| `round-7` | gates 7, 8, 11, 12 (+ guards); hidden split | refused (6 to 7 of 8); best pooled candidate, 0% → 10% on the hidden split |
| `round-9` | not gated on its own | |
| `round-10` | gate 10 | refused (6 of 8) |
| `round-13` | gates 13, 14 | refused (7 and 6 of 8): context overflow |
| `round-16` (= `main`) | gate 16 | **promoted, 8 of 8** |

## Links

- Code: [GitHub](https://github.com/tejasnafde/Shipwright); full write-up: [submission/WRITEUP.md](https://github.com/tejasnafde/Shipwright/blob/main/submission/WRITEUP.md)
- Demo video (3 min), the control room replaying round 16: [watch](https://huggingface.co/spaces/mitushigoyal5/shipwright/resolve/main/video/shipwright-demo.mp4)
- Results page: [Space](https://huggingface.co/spaces/mitushigoyal5/shipwright)
- Every gate's conversations, decisions and the promotion ledger:
  [`mitushigoyal5/shipwright-runs`](https://huggingface.co/datasets/mitushigoyal5/shipwright-runs)
- Collections: [models](https://huggingface.co/collections/mitushigoyal5/shipwright-self-healing-tiny-aya-models-6af95bf1307f37a24ad807c6),
  [data](https://huggingface.co/collections/mitushigoyal5/shipwright-self-healing-tiny-aya-datasets-6af95bf29994d1dfbba71cbb)

## Licence

**CC BY-NC 4.0**, as Tiny Aya's licence requires: research use only, no commercial use. Using the adapter also needs
access to the gated base model.

Team: Tejas Nafde, Ishank Giri, Mitushi Goyal.