Deal Master — constrained B2B negotiation policy (3B)
A Qwen2.5-3B-Instruct policy fine-tuned to negotiate price and payment terms while emitting a strict JSON turn object and never revealing a hidden walk-away limit. The model is one half of a two-part system: the fine-tuned policy proposes a turn, and a deterministic Python guardrail layer validates or clamps the numbers before anything is sent.
This repository is private. It hosts LoRA adapters (small, versioned) and the merged Q4_K_M GGUF build that was actually benchmarked.
Recommended version
| File | Purpose | SHA256 |
|---|---|---|
gguf/dpo-drill-r1-q4_k_m.gguf | merged Q4_K_M build, use this one | f3a72e080b8c46915d2c10d6f82196fdb4b68614e84e36d3f7d5837bf631ce3a |
adapters/dpo_drill_r1/ | LoRA adapter that produced that GGUF | 741cb13bdf8bcf06fd20828d2131fd49c84a0e59a75deaf5446869ff7214470a |
configs/dpo-drill-r1.generation_config.json | chat template + stop tokens | — |
Older versions kept for rollback:
| Version | Files | Gate (80 episodes) |
|---|---|---|
v0.1.0-sft | adapters/sft_final/, gguf/sft-q4_k_m.gguf | not run at 80 |
v0.2.0-dpo | adapters/dpo_final/, gguf/dpo-q4_k_m.gguf | 0.9325 / 0.9325 (fails gate) |
v1.0.0-drill-r1 | adapters/dpo_drill_r1/, gguf/dpo-drill-r1-q4_k_m.gguf | 1.000 / 1.000 |
Git-style tags v0.1.0-sft, v0.2.0-dpo, and v1.0.0-drill-r1 point to the
corresponding revisions on the Hub. To roll back, download the adapter/GGUF
from that tag:
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="JamieAi33/deal-master-negotiator",
filename="gguf/dpo-drill-r1-q4_k_m.gguf",
revision="v1.0.0-drill-r1",
)
Base model and training
- Base:
Qwen/Qwen2.5-3B-Instruct(3.1B params, bf16). - Stage 1 — QLoRA SFT: 2,743 training / 296 validation synthetic multi-turn B2B negotiation episodes. 4-bit NF4, LoRA r=16 alpha=32 on q/k/v/o/gate/up/down projections, 2 epochs, effective batch 8, LR 2e-4, max sequence 1024, seed 3407. Gate: 1.0 schema / 1.0 zero-leak on 150 turns.
- Stage 2 — DPO: 5,615
(prompt, chosen, rejected)pairs targeting floor leakage, premature capitulation, and walk-away discipline. Beta 0.1, LR 5e-6, 1 epoch (702 steps). It passed the gate but produced no measurable lift on the holdout. - Stage 3 — targeted action-field drill: 2,743 pairs built from the
training split only. Each
rejectedturn is identical tochosenexceptactionis replaced with the strategy label the quantized model wrongly emitted (close_deal/trade_terms). 1 epoch (343 steps) from the SFT adapter. This fixed the Q4 enum confusion and improved deal outcomes.
The training prompt lists the finite JSON enums and the chat template is the
one saved in configs/*.generation_config.json. Use the same template at
inference — the GGUF embeds it and LlamaCppBackend verifies parity.
Quantization
- Format: GGUF Q4_K_M, 1,929,902,688 bytes, produced by Unsloth from the merged LoRA weights. All 36 layers fit in 80 GB VRAM with room to spare.
- Pinned greedy sampling used for every benchmark row:
temperature=0, top_p=1, min_p=0, top_k=1, max_tokens=512, seed=0. - Rationale for hosting adapters instead of full bf16 merged weights: the GGUF is the merged build used in production, and the LoRA adapters let you reproduce it or swap stages without storing three ~6 GB checkpoints.
Evaluation
Frozen 80-episode holdout (621–622 scored turns), same harness for every row.
Gates: raw_schema_valid_rate >= 0.95, raw_zero_leak_rate >= 0.98.
| Variant | schema | zero-leak | deal completion | avg utility |
|---|---|---|---|---|
| base Qwen2.5-3B-Instruct | 0.000 | 0.000 | 0.000 | 0.000 |
| SFT HF adapter | 1.000 | 1.000 | 0.150 | 0.041 |
| SFT+DPO HF adapter | 1.000 | 1.000 | 0.150 | 0.032 |
| SFT GGUF Q4_K_M | 0.907 | 0.907 | 0.150 | 0.038 |
| DPO GGUF Q4_K_M | 0.9325 | 0.9325 | 0.250 | 0.053 |
| Drill GGUF Q4_K_M | 1.000 | 1.000 | 0.663 | 0.130 |
The drill's 95% CI on both gate metrics is [0.994, 1.0] (621/621 valid turns).
Raw result JSON, per-turn traces, and the full comparison table are in the
companion GitHub repository (results/, docs/).
Output contract
Each turn is one JSON object, nothing else:
{
"turn": 2,
"strategy": "trade_terms",
"action": "counter_offer",
"opponent_read": "bluffing_deadline",
"proposed_price": 300.89,
"proposed_terms": "prepaid_discount",
"concession_pct_of_room": 41.47,
"walk_away_risk": "low",
"rationale_short": "Trade terms kept inside the policy boundary.",
"reply": "At 300.89 on prepaid_discount terms, we can align on the package."
}
action is one of counter_offer | accept_offer | hold_current | walk_away.
close_deal is a strategy, not an action — this was the single quantized
failure mode that the drill eliminated.
Serving and guardrails
The companion repo ships serve/app.py (FastAPI) and scripts/modal_demo.py
(Modal H100 ASGI deployment). The server keeps the hidden deal policy and runs
enforce_guardrails on every response: price floor clamp, concession pacing,
terms allowlist, irrational-jump check, leak sanitization, and max-turn exit.
Only a client-safe view of state is returned. A live demo is linked in the
GitHub README.
Limitations
- Trained on synthetic episodes; no real counterparty corpus.
- Small holdout confidence intervals are now tight for the gates, but deal quality metrics still have wide intervals (n=80 episodes).
- The model is not a legal or commercial advisor; guardrails enforce the configured policy, not real-world contract law.
- Hidden limit protection depends on the prompt contract and guardrail layer; do not expose raw prompts or hidden config through an API.