aya-expanse-8b-lexsi-v4 — governed agent-spend LoRA
LoRA adapter (r=16, alpha=32, dropout 0.05) for
CohereLabs/aya-expanse-8b,
trained for the Lexsi AI Safety & Alignment Hackathon (Track 3:
Agentic Fine-tuning) to make spend-governance decisions that internalize the
mandate before an action reaches enforcement.
What it does
Given a spend mandate (budget, vendor allowlist, blocked categories, approval thresholds) and a purchase request, the model emits a JSON decision:
{
"decision": "ALLOW | REFUSE | ESCALATE | ASK_CLARIFICATION",
"reason_code": "...",
"checks": { "...": "..." },
"item_decisions": { "<item>": "ALLOW|REFUSE|ESCALATE|ASK_CLARIFICATION" },
"rationale": "..."
}
Trained on 1,467 examples: 600 deterministic-oracle-labeled scenarios + 867 rejection-sampled completions from the base model's own correct outputs (RFT). Aya Expanse has no native tool-calling template, so the decision is a single-turn structured record rather than a tool call.
Results — canonical 70-scenario held-out suite (bf16)
| metric | base | + this adapter (v4) |
|---|---|---|
| accuracy | 58.6% (41/70) | 78.6% (55/70) |
| unsafe enforced decisions | 17/48 (35.4%) | 2/48 (4.2%) |
| contract validity | 70/70 | 70/70 |
"Unsafe enforced" = a contract-valid ALLOW emitted where policy requires
REFUSE/ESCALATE/ASK_CLARIFICATION — i.e. a violation that would have reached
the wallet. This is an 88% reduction in unsafe-enforced decisions.
Per-scenario episodes, metrics, and eval JSONLs live under results70/ in
Papajams/lexsi-governance.
Original 22-scenario Kaggle fp16 run (same direction, smaller n): accuracy flat at 59.1%, unsafe enforced 6/17 → 2/17.
A later exploratory checkpoint (aya-expanse-8b-lexsi-v6, trained on this
data + 600 targeted arithmetic examples) reached 80.0% accuracy but
regressed unsafe_enforced to 5/48 — published for transparency; v4 remains
the recommended adapter.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("CohereLabs/aya-expanse-8b", torch_dtype="auto")
model = PeftModel.from_pretrained(base, "Papajams/aya-expanse-8b-lexsi-v4")
tok = AutoTokenizer.from_pretrained("CohereLabs/aya-expanse-8b")
Prompt template: see workflows/spend_governance.yaml in the
cognivern repo (lexsi/ dir).
Training
LoRA SFT on 2× Tesla T4 (Kaggle), transformers Trainer + PEFT, 2 epochs,
fp16, assistant-only label masking. Kernel:
papajams/lexsi-train-eval (private). Reproduction notes in the dataset card.