Instructions to use Foodoo1/Qwen3-14B-RLCD-Decision-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Foodoo1/Qwen3-14B-RLCD-Decision-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B") model = PeftModel.from_pretrained(base_model, "Foodoo1/Qwen3-14B-RLCD-Decision-LoRA") - Notebooks
- Google Colab
- Kaggle
Qwen3-14B RLCD Decision LoRA
QLoRA adapter that specializes Qwen3-14B for single-token parallel constrained decoding — the inference pattern where a multi-field JSON schema is evaluated in one broadcast forward pass (one prefill, KV-cache broadcast across fields, logit slicing over candidate tokens), instead of autoregressive generation.
The base model already excels at easy fields under this pattern (language/sentiment: 100%), but reasoning-heavy fields suffer because the decision happens at a single token position with no room to think. This adapter closes that gap by training directly on the decision-token objective.
Results (held-out 200-case eval, 4 fields, 4-bit NF4 inference)
| Field | Qwen3-14B base | + this LoRA |
|---|---|---|
| fraud_risk (4-way, reasoning) | 64.0% | 95.0% |
| block_account (boolean) | 77.0% | 100% |
| language (4-way) | 100% | 100% |
| sentiment (3-way) | 100% | 100% |
| Overall (800 decisions) | 85.2% | 98.8% |
Mean latency: ~234 ms per case (all 4 fields in one broadcast pass, RTX 3090, 4-bit).
All remaining errors are LOW→ELEVATED (conservative direction); zero high-risk cases judged low.
Training
- Method: QLoRA (4-bit NF4 base, LoRA r=16, alpha=32, attn+MLP targets), loss computed only on the single decision token of each field.
- Data: 16,608 single-token examples from 4,152 synthetic fraud-triage cases (648 unique slot-filled scenario templates × 72 customer messages in EN/ZH/ES/JA), labels fixed by construction, strictly disjoint from the eval set.
- 1 epoch, effective batch 32, cosine LR 1e-4, ~97 min on a single RTX 3090.
Usage
The prompt must match the parallel-constrained format used in training:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-14B",
quantization_config=BitsAndBytesConfig(load_in_4bit=True,
bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16),
device_map="auto")
model = PeftModel.from_pretrained(base, "Foodoo1/Qwen3-14B-RLCD-Decision-LoRA")
tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-14B")
catalog = ''' "fraud_risk": Fraud risk tier of this transaction. Choose one of: LOW, ELEVATED, SUSPICIOUS, CRITICAL.
"block_account": Whether the account should be blocked immediately'''
context = "New device login from abroad, wiring $49,500 offshore, 0 prior transfers."
# One prompt per field; decision = argmax over candidate first tokens at the last position
prompt = (f"<|im_start|>system\nClassify JSON attributes:\n{catalog}<|im_end|>\n"
f"<|im_start|>user\n{context}<|im_end|>\n"
f'<|im_start|>assistant\n{{\n "fraud_risk": "')
ids = tok(prompt, return_tensors="pt").to(model.device)
logits = model(**ids).logits[0, -1]
cands = {c: tok.encode(c, add_special_tokens=False)[0]
for c in ["LOW", "ELEVATED", "SUSPICIOUS", "CRITICAL"]}
print(max(cands, key=lambda c: logits[cands[c]].item())) # CRITICAL
For the full parallel engine (one prefill + KV broadcast for all fields at once), see the harshatheg/Qwen-2.5-1B-RLCD inference code this was evaluated with.
Intended use & limitations
Demonstration/research adapter for structured decision decoding. The fraud-triage schema and data are synthetic; do not use for real financial decisions without domain-specific training and validation.
- Downloads last month
- 23