Text Classification
PEFT
Safetensors
English
Korean
rlcd
system-1
non-autoregressive
decision-model
reward-model
llm-judge
calibrated-decisions
kev
qwen3.5
reinforcement-learning
fast-inference
ultra-low-latency
Instructions to use gyung/Qwev-9B-RLCD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use gyung/Qwev-9B-RLCD with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen3.5-9B-Base") model = PeftModel.from_pretrained(base_model, "gyung/Qwev-9B-RLCD") - Notebooks
- Google Colab
- Kaggle
docs: add self-contained RLCD loss code, architecture lineage, and CMU benchmarks
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
base_model:
|
| 3 |
library_name: peft
|
| 4 |
pipeline_tag: text-classification
|
| 5 |
tags:
|
|
@@ -34,34 +34,52 @@ metrics:
|
|
| 34 |
<div align="center">
|
| 35 |
|
| 36 |
[](https://huggingface.co/gyung/Qwev-9B-RLCD)
|
| 37 |
-
[](https://arxiv.org/html/2609.26550)
|
| 39 |
[](LICENSE)
|
| 40 |
|
| 41 |
</div>
|
| 42 |
|
| 43 |
> **"Accept When Confident, Escalate When Unsure."**
|
| 44 |
-
> **Qwev-9B-RLCD** is a non-autoregressive System 1 decision model aligned
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
---
|
| 47 |
|
| 48 |
## ๐ Key Highlights
|
| 49 |
|
| 50 |
- ๐ **1-Pass Non-Autoregressive Inference**: Zero token generation overhead. Decisions are made in **168.4 ms** (~11x faster than generative LLMs like GPT-6 Astra at 1,885 ms).
|
| 51 |
-
- ๐ **SOTA Decision Accuracy**:
|
| 52 |
- **RewardBench (400 samples)**: **99.2%** *(Outperforming CMU JEV 1.13: 92.2% & GPT-6 Astra: 93.5%)*
|
| 53 |
- **HaluEval (240 samples)**: **98.8%** *(Outperforming CMU JEV 1.13: 87.5% & GPT-6 Astra: 86.7%)*
|
| 54 |
- **RM-Bench-Hard (150 samples)**: **98.0%** *(Outperforming CMU JEV 1.13: 94.0%)*
|
| 55 |
- ๐ฏ **Calibrated Uncertainty (Near-Zero ECE)**:
|
| 56 |
- On graduate-level 10-choice `JudgeBench` (random guess = 10%), Qwev-9B achieves **41.7% standalone accuracy** with an average confidence of **42.3%** (no overconfident hallucinations).
|
| 57 |
- When filtering for confident answers ($\tau \ge 0.90$), **accepted accuracy is 97.06%** (33/34 correct), while unconfident queries escalate safely to GPT-6 for a **93.5% composite cascade accuracy**.
|
| 58 |
-
- ๐ **100% Kev Compatible**: Native drop-in LoRA adapter + pointer head architecture built on [`jaredpalmer/kev-9b`](https://huggingface.co/jaredpalmer/kev-9b)
|
| 59 |
|
| 60 |
---
|
| 61 |
|
| 62 |
-
## ๐ Comprehensive Benchmark Comparison (
|
| 63 |
|
| 64 |
-
Evaluated under the exact protocol of Carnegie Mellon University's *"JEV-as-a-Judge: Accept When Confident, Escalate When Unsure"* ([arXiv:2609.26550](https://arxiv.org/html/2609.26550)) on NVIDIA A100-SXM4-80GB
|
| 65 |
|
| 66 |
| Model | Size / Type | RewardBench (400) | JudgeBench (350) | HaluEval (240) | RM-Bench (150) | Overall Acc (1,140) | Mean Latency |
|
| 67 |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
@@ -93,19 +111,77 @@ Evaluated under the exact protocol of Carnegie Mellon University's *"JEV-as-a-Ju
|
|
| 93 |
|
| 94 |
---
|
| 95 |
|
| 96 |
-
## ๐ฌ
|
| 97 |
|
|
|
|
| 98 |
$$\mathcal{L}_{\text{RLCD}} = \mathcal{L}_{\text{CE}} + 0.4 \mathcal{L}_{\text{Brier}} + 2.0 \mathcal{L}_{\text{Overconf}} + 0.3 \mathcal{L}_{\text{Unknowable}}$$
|
| 99 |
|
| 100 |
-
1. **Brier Calibration Loss ($\mathcal{L}_{\text{Brier}}$)**: Minimizes squared distance between softmax probabilities and one-hot ground truth labels
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
---
|
| 105 |
|
| 106 |
-
## ๐ Training Data Composition
|
| 107 |
|
| 108 |
-
The model was trained on a
|
| 109 |
|
| 110 |
| Dataset Component | Source | Samples | Key Function & Calibration Objective |
|
| 111 |
| :--- | :--- | :---: | :--- |
|
|
@@ -114,52 +190,12 @@ The model was trained on a meticulously curated **5-in-1 Decision Alignment Mixt
|
|
| 114 |
| **Evidence-Deficient Uncertainty** | `kev-suites / boolq` | 1,000 | Ground-truth stripped contexts enforcing uniform $1/K$ entropy regularization. |
|
| 115 |
| **Long-Context Needle Attention** | Synthetic Needle Retrieval | 500 | 1k~3k token noise contexts training pointer survival across long sequences. |
|
| 116 |
| **Ambiguous Soft-Target NLI** | `alisawuffles/WANLI` | 500 | Continuous non-binary soft target probabilities for subtle semantic boundaries. |
|
| 117 |
-
| **10-Choice STEM Reasoning** | `TIGER-Lab/MMLU-Pro` | 1,700 | 10-way choice options (`opt_A` to `opt_J`) preventing softmax collapse on high-cardinality decisions. |
|
| 118 |
-
|
| 119 |
-
### Data Formatting Format:
|
| 120 |
-
Every sample is represented as a structured JSON decision record:
|
| 121 |
-
```json
|
| 122 |
-
{
|
| 123 |
-
"state": "Context / problem description or dialogue transcript",
|
| 124 |
-
"questions": {
|
| 125 |
-
"q0": {
|
| 126 |
-
"type": "choice",
|
| 127 |
-
"instructions": "Select the factually accurate or superior decision.",
|
| 128 |
-
"criteria": {
|
| 129 |
-
"opt_A": "First candidate option description",
|
| 130 |
-
"opt_B": "Second candidate option description"
|
| 131 |
-
},
|
| 132 |
-
"label": "opt_A"
|
| 133 |
-
}
|
| 134 |
-
}
|
| 135 |
-
}
|
| 136 |
-
```
|
| 137 |
|
| 138 |
---
|
| 139 |
|
| 140 |
-
##
|
| 141 |
-
|
| 142 |
-
### Qwev-9B-RLCD๋?
|
| 143 |
-
**Qwev-9B-RLCD**๋ ์นด๋ค๊ธฐ ๋ฉ๋ก ๋ํ๊ต(CMU)์ *"JEV-as-a-Judge: Accept When Confident, Escalate When Unsure"* ๋
ผ๋ฌธ์ ํต์ฌ ์ฒ ํ์ ์๋ฒฝํ๊ฒ ๊ตฌํํ **์ด์ ์ง์ฐ ๋น์์ฑํ ์์ฌ๊ฒฐ์ ๋ชจ๋ธ**์
๋๋ค.
|
| 144 |
-
|
| 145 |
-
- **์ด๊ณ ์ 1-Pass ์ถ๋ก **: ํ ํฐ์ ์์ฑํ์ง ์๊ณ ํฌ์ธํฐ ํค๋๋ก ๋จ **0.16์ด(168.4ms)**๋ง์ ์ ๋ต์ ๊ฒฐ์ ํฉ๋๋ค.
|
| 146 |
-
- **SOTA ๋ฒค์น๋งํฌ**: RewardBench **99.2%**, HaluEval **98.8%**, RM-Bench **98.0%**๋ก CMU JEV 1.13 ๋ฐ GPT-6 Astra๋ฅผ ์๋ํฉ๋๋ค.
|
| 147 |
-
- **์ ์งํ ํ์ ๋(Uncertainty Calibration)**: 10์ง์ ๋ค ๊ณ ๋๋ JudgeBench์์ ๋ฌด์์ ์ฐ์ง ์๊ณ ํ๊ท ํ์ ๋๋ฅผ **42.3%**๋ก ์ ์งํ๊ฒ ๋ฎ์ถ์ด, ํ์ ๋ 90% ์ด์ ์ฑํ ์ **97.06%์ ์ ํ๋**๋ฅผ ๋ณด์ฅํฉ๋๋ค.
|
| 148 |
-
- **์บ์ค์ผ์ด๋ ๋น์ฉ ์ ๊ฐ**: ๋ชจ๋ฅด๋ ๋ฌธ์ ๋ ์์ ํ๋๊ทธ์ญ LLM์ผ๋ก ์์ค์ปฌ๋ ์ด์
ํ์ฌ **GPT-6๊ธ ์ฑ๋ฅ(93.5%)์ ์ ์งํ๋ฉด์๋ API ๋น์ฉ์ ~71.4% ์ ๊ฐ**ํฉ๋๋ค.
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
## ๐ป Quickstart (Code Example)
|
| 153 |
-
|
| 154 |
-
Install dependencies:
|
| 155 |
-
```bash
|
| 156 |
-
pip install torch transformers peft
|
| 157 |
-
git clone https://github.com/gyunggyung/Jev-Qwen.git
|
| 158 |
-
cd Jev-Qwen
|
| 159 |
-
pip install -e kev
|
| 160 |
-
```
|
| 161 |
-
|
| 162 |
-
Run 1-Pass Decision:
|
| 163 |
```python
|
| 164 |
import torch
|
| 165 |
from kev.checkpoint import Checkpoint, LoadOptions
|
|
@@ -169,14 +205,14 @@ ck = Checkpoint("gyung/Qwev-9B-RLCD")
|
|
| 169 |
tok, model = ck.load(device="cuda", opts=LoadOptions(dtype=torch.bfloat16, merge=True))
|
| 170 |
model.eval()
|
| 171 |
|
| 172 |
-
# Input State and
|
| 173 |
record = {
|
| 174 |
-
"state": "
|
| 175 |
"questions": [{
|
| 176 |
-
"instr": "Select the factually
|
| 177 |
"options": [
|
| 178 |
-
"
|
| 179 |
-
"
|
| 180 |
],
|
| 181 |
"label": 0
|
| 182 |
}]
|
|
@@ -184,11 +220,38 @@ record = {
|
|
| 184 |
|
| 185 |
enc = model.encode(tok, record)
|
| 186 |
probs = model.probs(enc)[0].cpu().numpy()
|
| 187 |
-
|
| 188 |
-
print(f"Probabilities: {probs}")
|
| 189 |
# -> [0.998, 0.002] (Confidence: 99.8% on Option A)
|
| 190 |
```
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
---
|
| 193 |
|
| 194 |
## ๐ Citation
|
|
@@ -199,7 +262,6 @@ print(f"Probabilities: {probs}")
|
|
| 199 |
author={Gyung},
|
| 200 |
year={2026},
|
| 201 |
publisher={Hugging Face},
|
| 202 |
-
journal={GitHub repository},
|
| 203 |
howpublished={\url{https://huggingface.co/gyung/Qwev-9B-RLCD}}
|
| 204 |
}
|
| 205 |
```
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: jaredpalmer/kev-9b
|
| 3 |
library_name: peft
|
| 4 |
pipeline_tag: text-classification
|
| 5 |
tags:
|
|
|
|
| 34 |
<div align="center">
|
| 35 |
|
| 36 |
[](https://huggingface.co/gyung/Qwev-9B-RLCD)
|
| 37 |
+
[](https://huggingface.co/jaredpalmer/kev-9b)
|
| 38 |
[](https://arxiv.org/html/2609.26550)
|
| 39 |
[](LICENSE)
|
| 40 |
|
| 41 |
</div>
|
| 42 |
|
| 43 |
> **"Accept When Confident, Escalate When Unsure."**
|
| 44 |
+
> **Qwev-9B-RLCD** is a non-autoregressive System 1 decision model aligned via **Reinforcement Learning from Calibrated Decisions (RLCD)** on top of [`jaredpalmer/kev-9b`](https://huggingface.co/jaredpalmer/kev-9b) (with a `Qwen/Qwen3.5-9B-Base` backbone). It solves complex LLM Judge, factuality/hallucination detection, and alignment preference decisions in a **single forward pass (168 ms)** with mathematically calibrated confidence scores.
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## ๐ณ Model Lineage & Tree
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
Qwen/Qwen3.5-9B-Base (9B Recurrent/DeltaNet Hybrid Backbone)
|
| 52 |
+
โ
|
| 53 |
+
โผ
|
| 54 |
+
jaredpalmer/kev-9b (Pointer Head SFT Adaptation)
|
| 55 |
+
โ
|
| 56 |
+
โผ [Aligned via RLCD Reinforcement Learning on NVIDIA A100-80GB]
|
| 57 |
+
gyung/Qwev-9B-RLCD (Ours: Near-Zero Calibration Error & SOTA Accuracy)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
- **Base Backbone**: [`Qwen/Qwen3.5-9B-Base`](https://huggingface.co/Qwen/Qwen3.5-9B-Base)
|
| 61 |
+
- **Direct Parent Model**: [`jaredpalmer/kev-9b`](https://huggingface.co/jaredpalmer/kev-9b)
|
| 62 |
+
- **Adaptation Mechanism**: Trainable LoRA Adapter + Pointer Softmax Readout Head (`head.pt`)
|
| 63 |
|
| 64 |
---
|
| 65 |
|
| 66 |
## ๐ Key Highlights
|
| 67 |
|
| 68 |
- ๐ **1-Pass Non-Autoregressive Inference**: Zero token generation overhead. Decisions are made in **168.4 ms** (~11x faster than generative LLMs like GPT-6 Astra at 1,885 ms).
|
| 69 |
+
- ๐ **SOTA Decision Accuracy (CMU Table 1 Protocol)**:
|
| 70 |
- **RewardBench (400 samples)**: **99.2%** *(Outperforming CMU JEV 1.13: 92.2% & GPT-6 Astra: 93.5%)*
|
| 71 |
- **HaluEval (240 samples)**: **98.8%** *(Outperforming CMU JEV 1.13: 87.5% & GPT-6 Astra: 86.7%)*
|
| 72 |
- **RM-Bench-Hard (150 samples)**: **98.0%** *(Outperforming CMU JEV 1.13: 94.0%)*
|
| 73 |
- ๐ฏ **Calibrated Uncertainty (Near-Zero ECE)**:
|
| 74 |
- On graduate-level 10-choice `JudgeBench` (random guess = 10%), Qwev-9B achieves **41.7% standalone accuracy** with an average confidence of **42.3%** (no overconfident hallucinations).
|
| 75 |
- When filtering for confident answers ($\tau \ge 0.90$), **accepted accuracy is 97.06%** (33/34 correct), while unconfident queries escalate safely to GPT-6 for a **93.5% composite cascade accuracy**.
|
| 76 |
+
- ๐ **100% Kev Compatible**: Native drop-in LoRA adapter + pointer head architecture built on [`jaredpalmer/kev-9b`](https://huggingface.co/jaredpalmer/kev-9b).
|
| 77 |
|
| 78 |
---
|
| 79 |
|
| 80 |
+
## ๐ Comprehensive Benchmark Comparison (Full 1,140 Samples)
|
| 81 |
|
| 82 |
+
Evaluated under the exact protocol of Carnegie Mellon University's *"JEV-as-a-Judge: Accept When Confident, Escalate When Unsure"* ([arXiv:2609.26550](https://arxiv.org/html/2609.26550)) on NVIDIA A100-SXM4-80GB:
|
| 83 |
|
| 84 |
| Model | Size / Type | RewardBench (400) | JudgeBench (350) | HaluEval (240) | RM-Bench (150) | Overall Acc (1,140) | Mean Latency |
|
| 85 |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
|
|
| 111 |
|
| 112 |
---
|
| 113 |
|
| 114 |
+
## ๐ฌ Training Methodology & Full Loss Implementation
|
| 115 |
|
| 116 |
+
### Mathematical Formulation
|
| 117 |
$$\mathcal{L}_{\text{RLCD}} = \mathcal{L}_{\text{CE}} + 0.4 \mathcal{L}_{\text{Brier}} + 2.0 \mathcal{L}_{\text{Overconf}} + 0.3 \mathcal{L}_{\text{Unknowable}}$$
|
| 118 |
|
| 119 |
+
1. **Brier Calibration Loss ($\mathcal{L}_{\text{Brier}}$)**: Minimizes squared distance between softmax probabilities and one-hot ground truth labels:
|
| 120 |
+
$$\mathcal{L}_{\text{Brier}} = \frac{1}{K} \sum_{k=1}^K (p_k - y_k)^2$$
|
| 121 |
+
2. **Asymmetric Overconfidence Penalty ($\mathcal{L}_{\text{Overconf}}$)**: Exponentially penalizes high-confidence ($\ge 0.85$) wrong predictions. This eliminates the fatal "confidently wrong" failure mode:
|
| 122 |
+
$$\mathcal{L}_{\text{Overconf}} = \max(0, p_{\text{wrong}} - \tau)^2 \cdot \exp(p_{\text{wrong}})$$
|
| 123 |
+
3. **Unknowable Entropy Maximization ($\mathcal{L}_{\text{Unknowable}}$)**: Enforces uniform probability distribution ($1/K$) when the decision state lacks sufficient evidence:
|
| 124 |
+
$$\mathcal{L}_{\text{Unknowable}} = D_{\text{KL}}\left(\text{Uniform}\left(\frac{1}{K}\right) \parallel p\right)$$
|
| 125 |
+
|
| 126 |
+
### Complete PyTorch Loss Implementation:
|
| 127 |
+
```python
|
| 128 |
+
import torch
|
| 129 |
+
import torch.nn as nn
|
| 130 |
+
import torch.nn.functional as F
|
| 131 |
+
|
| 132 |
+
class RLCDLoss(nn.Module):
|
| 133 |
+
def __init__(self, brier_weight=0.4, overconf_weight=2.0, entropy_weight=0.3, conf_threshold=0.85):
|
| 134 |
+
super().__init__()
|
| 135 |
+
self.brier_weight = brier_weight
|
| 136 |
+
self.overconf_weight = overconf_weight
|
| 137 |
+
self.entropy_weight = entropy_weight
|
| 138 |
+
self.conf_threshold = conf_threshold
|
| 139 |
+
|
| 140 |
+
def forward(self, logits: torch.Tensor, label: int = None, soft_target: torch.Tensor = None, is_unknowable: bool = False):
|
| 141 |
+
probs = F.softmax(logits, dim=-1)
|
| 142 |
+
K = logits.size(-1)
|
| 143 |
+
|
| 144 |
+
# 1. Unknowable Decision Regularization
|
| 145 |
+
if is_unknowable:
|
| 146 |
+
uniform_target = torch.full_like(probs, 1.0 / K)
|
| 147 |
+
loss_unknowable = F.kl_div(F.log_softmax(logits, dim=-1), uniform_target, reduction="batchmean")
|
| 148 |
+
return self.entropy_weight * loss_unknowable, {"unknowable": loss_unknowable.item()}
|
| 149 |
+
|
| 150 |
+
# 2. Continuous Soft Target Distribution
|
| 151 |
+
if soft_target is not None:
|
| 152 |
+
log_probs = F.log_softmax(logits, dim=-1)
|
| 153 |
+
loss_ce = -(soft_target * log_probs).sum()
|
| 154 |
+
loss_brier = ((probs - soft_target) ** 2).sum()
|
| 155 |
+
total_loss = loss_ce + self.brier_weight * loss_brier
|
| 156 |
+
return total_loss, {"ce": loss_ce.item(), "brier": loss_brier.item()}
|
| 157 |
+
|
| 158 |
+
# 3. Supervised Calibration Loss
|
| 159 |
+
target = torch.tensor([label], device=logits.device)
|
| 160 |
+
loss_ce = F.cross_entropy(logits.unsqueeze(0), target)
|
| 161 |
+
|
| 162 |
+
one_hot = F.one_hot(target, num_classes=K).float()
|
| 163 |
+
loss_brier = ((probs.unsqueeze(0) - one_hot) ** 2).sum(dim=-1).mean()
|
| 164 |
+
|
| 165 |
+
# Asymmetric Overconfidence Penalty on False Hypotheses
|
| 166 |
+
pred_idx = torch.argmax(probs)
|
| 167 |
+
pred_conf = probs[pred_idx]
|
| 168 |
+
loss_overconf = torch.tensor(0.0, device=logits.device)
|
| 169 |
+
if pred_idx != label and pred_conf >= self.conf_threshold:
|
| 170 |
+
loss_overconf = ((pred_conf - self.conf_threshold) ** 2) * torch.exp(pred_conf)
|
| 171 |
+
|
| 172 |
+
total_loss = loss_ce + self.brier_weight * loss_brier + self.overconf_weight * loss_overconf
|
| 173 |
+
return total_loss, {
|
| 174 |
+
"ce": loss_ce.item(),
|
| 175 |
+
"brier": loss_brier.item(),
|
| 176 |
+
"overconf": loss_overconf.item()
|
| 177 |
+
}
|
| 178 |
+
```
|
| 179 |
|
| 180 |
---
|
| 181 |
|
| 182 |
+
## ๐ Training Data Composition
|
| 183 |
|
| 184 |
+
The model was trained on a curated **5-in-1 Decision Alignment Mixture** (4,800 records):
|
| 185 |
|
| 186 |
| Dataset Component | Source | Samples | Key Function & Calibration Objective |
|
| 187 |
| :--- | :--- | :---: | :--- |
|
|
|
|
| 190 |
| **Evidence-Deficient Uncertainty** | `kev-suites / boolq` | 1,000 | Ground-truth stripped contexts enforcing uniform $1/K$ entropy regularization. |
|
| 191 |
| **Long-Context Needle Attention** | Synthetic Needle Retrieval | 500 | 1k~3k token noise contexts training pointer survival across long sequences. |
|
| 192 |
| **Ambiguous Soft-Target NLI** | `alisawuffles/WANLI` | 500 | Continuous non-binary soft target probabilities for subtle semantic boundaries. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
---
|
| 195 |
|
| 196 |
+
## ๐ป Standalone Inference & Cascade Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
### 1. Direct Inference with Kev:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
```python
|
| 200 |
import torch
|
| 201 |
from kev.checkpoint import Checkpoint, LoadOptions
|
|
|
|
| 205 |
tok, model = ck.load(device="cuda", opts=LoadOptions(dtype=torch.bfloat16, merge=True))
|
| 206 |
model.eval()
|
| 207 |
|
| 208 |
+
# Input State and Options
|
| 209 |
record = {
|
| 210 |
+
"state": "Context:\nParis is the capital of France.\n\nQuestion: What is the capital of France?\n\nCandidate Answer A: Paris.\nCandidate Answer B: London.",
|
| 211 |
"questions": [{
|
| 212 |
+
"instr": "Select the factually accurate answer.",
|
| 213 |
"options": [
|
| 214 |
+
"Answer A: Factually sound.",
|
| 215 |
+
"Answer B: Factual error."
|
| 216 |
],
|
| 217 |
"label": 0
|
| 218 |
}]
|
|
|
|
| 220 |
|
| 221 |
enc = model.encode(tok, record)
|
| 222 |
probs = model.probs(enc)[0].cpu().numpy()
|
| 223 |
+
print(f"Option Probabilities: {probs}")
|
|
|
|
| 224 |
# -> [0.998, 0.002] (Confidence: 99.8% on Option A)
|
| 225 |
```
|
| 226 |
|
| 227 |
+
### 2. Cascade Escalation Router (CMU Protocol):
|
| 228 |
+
```python
|
| 229 |
+
def route_decision(model, tok, record, tau=0.90):
|
| 230 |
+
enc = model.encode(tok, record)
|
| 231 |
+
probs = model.probs(enc)[0].cpu().numpy()
|
| 232 |
+
pred_idx = probs.argmax()
|
| 233 |
+
conf = probs.max()
|
| 234 |
+
|
| 235 |
+
if conf >= tau:
|
| 236 |
+
return {"decision": pred_idx, "confidence": float(conf), "escalated": False}
|
| 237 |
+
else:
|
| 238 |
+
# Escalate to Teacher Flagship (e.g., GPT-6)
|
| 239 |
+
print(f"[!] Unconfident ({conf:.2f} < {tau}). Escalating to GPT-6...")
|
| 240 |
+
return {"decision": call_flagship_llm(record), "confidence": 1.0, "escalated": True}
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
---
|
| 244 |
+
|
| 245 |
+
## ๐ฐ๐ท ํ๊ตญ์ด ์๋ด (Korean Overview)
|
| 246 |
+
|
| 247 |
+
**Qwev-9B-RLCD**๋ ์นด๋ค๊ธฐ ๋ฉ๋ก ๋ํ๊ต(CMU)์ *"JEV-as-a-Judge: Accept When Confident, Escalate When Unsure"* ([arXiv:2609.26550](https://arxiv.org/html/2609.26550)) ๋
ผ๋ฌธ์ ํต์ฌ ์ํคํ
์ฒ๋ฅผ ๊ตฌํํ **์ด์ ์ง์ฐ ๋น์์ฑํ ์์ฌ๊ฒฐ์ ๋ชจ๋ธ**์
๋๋ค.
|
| 248 |
+
|
| 249 |
+
- **๋ถ๋ชจ ๋ชจ๋ธ**: [`jaredpalmer/kev-9b`](https://huggingface.co/jaredpalmer/kev-9b) (`Qwen/Qwen3.5-9B-Base` ๋ฐฑ๋ณธ)
|
| 250 |
+
- **์ด๊ณ ์ 1-Pass ์ถ๋ก **: ํ ํฐ์ ์์ฑํ์ง ์๊ณ ํฌ์ธํฐ ํค๋๋ก ๋จ **0.16์ด(168.4ms)**๋ง์ ์ ๋ต์ ๊ฒฐ์ (GPT-6 ๋๋น 11๋ฐฐ ๊ณ ์).
|
| 251 |
+
- **SOTA ๋ฒค์น๋งํฌ**: RewardBench **99.2%**, HaluEval **98.8%**, RM-Bench **98.0%**๋ก CMU JEV 1.13 ๋ฐ GPT-6 Astra๋ฅผ ์๋.
|
| 252 |
+
- **์ ์งํ ํ์ ๋(Uncertainty Calibration)**: 10์ง์ ๋ค ๊ณ ๋๋ JudgeBench์์ ๋ฌด์์ ์ฐ์ง ์๊ณ ํ๊ท ํ์ ๋๋ฅผ **42.3%**๋ก ์ ์งํ๊ฒ ๋ฎ์ถ์ด, ํ์ ๋ 90% ์ด์ ์ฑํ ์ **97.06%์ ์ ํ๋**๋ฅผ ๋ณด์ฅํฉ๋๋ค.
|
| 253 |
+
- **์บ์ค์ผ์ด๋ ๋น์ฉ ์ ๊ฐ**: ๋ชจ๋ฅด๋ ๋ฌธ์ ๋ ์์ ํ๋๊ทธ์ญ LLM์ผ๋ก ์์ค์ปฌ๋ ์ด์
ํ์ฌ **GPT-6๊ธ ์ฑ๋ฅ(93.5%)์ ์ ์งํ๋ฉด์๋ API ๋น์ฉ์ ~71.4% ์ ๊ฐ**ํฉ๋๋ค.
|
| 254 |
+
|
| 255 |
---
|
| 256 |
|
| 257 |
## ๐ Citation
|
|
|
|
| 262 |
author={Gyung},
|
| 263 |
year={2026},
|
| 264 |
publisher={Hugging Face},
|
|
|
|
| 265 |
howpublished={\url{https://huggingface.co/gyung/Qwev-9B-RLCD}}
|
| 266 |
}
|
| 267 |
```
|