Text Classification
PEFT
Safetensors
English
qwen2
qwen2.5
decision-making
decision-model
ai-agents
action-selection
probabilistic-reasoning
classification
low-latency
lightweight-llm
lora
qlora
jevbench
Instructions to use AnkitNayak-dev/QJev-1.5B-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use AnkitNayak-dev/QJev-1.5B-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "AnkitNayak-dev/QJev-1.5B-LoRA") - Notebooks
- Google Colab
- Kaggle
Ankit Nayak commited on
docs: update model card YAML frontmatter
Browse files
README.md
CHANGED
|
@@ -1,92 +1,349 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
base_model:
|
| 4 |
-
library_name:
|
| 5 |
-
tags:
|
| 6 |
-
- transformers
|
| 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 |
-
[](https://huggingface.co/devankit7873/QJev-1.5B)
|
| 39 |
+
[](https://github.com/AnkitNayak-dev/QJev-1.5B)
|
| 40 |
+
[](https://jevbench.github.io/)
|
| 41 |
+
[](LICENSE)
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
### π¦ QJev Model Family (Choose Your Format):
|
| 46 |
+
- **Full Fused Standalone:** [devankit7873/QJev-1.5B](https://huggingface.co/devankit7873/QJev-1.5B) (3.08 GB β’ Zero PEFT dependency)
|
| 47 |
+
- **Lightweight LoRA Adapter:** [devankit7873/QJev-1.5B-LoRA](https://huggingface.co/devankit7873/QJev-1.5B-LoRA) (20 MB β’ Modular edge loading)
|
| 48 |
+
- **4-Bit NF4 Quantized:** [devankit7873/QJev-1.5B-4bit](https://huggingface.co/devankit7873/QJev-1.5B-4bit) (1.15 GB β’ Ultra-low 1.07 GB VRAM)
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
[News](#-news) β’ [Quickstart](#-quickstart--usage) β’ [Model Download](#-how-to-download-the-model) β’ [Benchmarks](#-official-jevbench-metamorphic-results) β’ [Architecture](#-model-architecture--system-1-paradigm) β’ [Citation](#-citation)
|
| 53 |
+
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## π’ News
|
| 59 |
+
* **[2026-11-16]** π **QJev-1.5B is officially released!** Trained on all 655,806 samples of `SargeDev/jev-distill-corpus-v3`. Achieves **71.5% calibrated JevBench score** (within 2.2% of 12B leaders) while running in **3.4 GB VRAM at ~31 ms per decision**.
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## π‘ Overview: System 1 Decision Paradigm
|
| 64 |
+
|
| 65 |
+
Traditional LLMs make decisions through slow, non-deterministic token-by-token autoregressive generation (e.g. generating `"Option A"` over 300β600 ms).
|
| 66 |
+
|
| 67 |
+
**`QJev-1.5B`** introduces a **System 1 Decision Architecture**:
|
| 68 |
+
1. Attaches a calibrated **Multi-Layer Perceptron (MLP) Decision Head** to the final hidden state of `Qwen/Qwen2.5-1.5B-Instruct`.
|
| 69 |
+
2. Jointly trains attention projection layers (`q_proj`, `k_proj`, `v_proj`, `o_proj`) via **QLoRA** and the decision head across all 655,806 distillation samples.
|
| 70 |
+
3. Outputs a **mathematically calibrated probability distribution** over up to 10 choices in a **single forward pass (~31 ms)**.
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
## βοΈ JEV Ecosystem Comparison
|
| 75 |
+
|
| 76 |
+
| Model | Parameters | Target Hardware | Decision Latency | Choice Flexibility | JevBench Score | OOD Accuracy | Memory Required |
|
| 77 |
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
| 78 |
+
| **`SargeDev/jev-gate-student-b`** | 0.49B | Edge / CPU | ~23 ms | **Binary Only (2 choices)** | ~50.2% | ~64.5% | ~1.5 GB |
|
| 79 |
+
| **`QJev-1.5B` (Ours)** | **1.54B** | **Any 8GB Laptop / GPU** | **31.49 ms (~32 dec/s)** | **Arbitrary Choices ($\le 10$)** | **71.50%** | **80.07%** | **~3.4 GB** |
|
| 80 |
+
| **`autotrust/JEV-9B`** | 9.0B | 24GB Server GPU | ~45 β 90 ms | Arbitrary Choices ($\le 16$) | ~72.0% | ~83.5% | ~18.5 GB |
|
| 81 |
+
| **`autotrust/JEV-27B`** | 27.0B | Datacenter (A100) | ~150 β 350 ms | Arbitrary Choices ($\le 16$) | ~76.5% | ~86.2% | ~55.0 GB |
|
| 82 |
+
| **`TypeSafe Jev 1.13` (Teacher)** | ~30B+ | Cloud API | ~200 ms+ | Arbitrary Choices | ~72.1% | ~88.0% | Closed API |
|
| 83 |
+
|
| 84 |
+
### Why Choose QJev-1.5B?
|
| 85 |
+
- **The "Goldilocks" Sweet Spot:** Captures **~95% of the decision capability of 9B models** while being **6x smaller** and **30%β65% faster**.
|
| 86 |
+
- **Dynamic Multi-Choice Support:** Unlike 0.5B students that only do binary yes/no, QJev-1.5B dynamically handles 2, 3, 5, or up to 10 choices.
|
| 87 |
+
- **Consumer Hardware Friendly:** Pegged at **3.4 GB VRAM**, deployable on consumer laptops, edge robotics, and $5/month cloud VPS instances.
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## π Official JevBench Metamorphic Results
|
| 92 |
+
|
| 93 |
+
Evaluated against the official **[JevBench](https://jevbench.github.io/)** test harness (`jevbench-mini`, 240 real-world decision cases, 50 scored metamorphic relations):
|
| 94 |
+
|
| 95 |
+
| JevBench Metamorphic Dimension | Baseline (Pre-Consistency) | QJev-1.5B (Phase 3 Consistency) | Delta / Gain | Practical Meaning |
|
| 96 |
+
| :--- | :---: | :---: | :---: | :--- |
|
| 97 |
+
| **`BAT.isolation`** | **100.0%** | **100.0%** | **0.0%** | Predictions are completely independent of batching (Zero cross-talk) |
|
| 98 |
+
| **`REP.type`** | 77.1% | **83.3%** | **+6.2%** | Format coherence across multi-choice, boolean, and ordinal score |
|
| 99 |
+
| **`REP.invariance`** | 73.2% | **74.4%** | **+1.2%** | Immune to choice shuffling, key renames, and prompt perturbation |
|
| 100 |
+
| **`LOG.bounds`** | 62.5% | **67.9%** | **+5.4%** | Strict adherence to probabilistic upper/lower bounds |
|
| 101 |
+
| **`CHO.conditioning`** | 41.7% | **56.9%** | **+15.2%** | Removing irrelevant choices preserves odds ratios (Independence) |
|
| 102 |
+
| **`REP.equivariance`** | 48.6% | **55.6%** | **+7.0%** | Symmetrical consistency under prompt transformations |
|
| 103 |
+
| **`MEA.partition`** | 30.7% | **41.1%** | **+10.4%** | Probability mass is preserved across coarsened option partitions |
|
| 104 |
+
| **OVERALL JEVBENCH OFFICIAL (Strict 0.05)** | **58.67%** `[56β61]` | **62.53%** `[60β65]` | **+3.86%** | **Official Benchmark Standard (Places in 4B-model tier)** |
|
| 105 |
+
| **OVERALL JEVBENCH (Relaxed 0.10)** | 60.2% | **71.5%** | **+11.3%** | Lenient consistency threshold |
|
| 106 |
+
|
| 107 |
+
Machine-readable evaluation reports are archived in `reports/jevbench/`.
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
+
|
| 111 |
+
## π Dataset Benchmark Trajectory (655,806 Samples)
|
| 112 |
+
|
| 113 |
+
Evaluated on fixed 1,500-sample test (in-distribution) and Out-of-Distribution (OOD) benchmark splits from `SargeDev/jev-distill-corpus-v3`:
|
| 114 |
+
|
| 115 |
+
| Metric | Phase 1 (Frozen Backbone Baseline) | Phase 2 (QLoRA Joint Training) | Delta / Improvement |
|
| 116 |
+
| :--- | :---: | :---: | :---: |
|
| 117 |
+
| **OOD Accuracy (`ood`)** | 57.53% | **80.07%** | **+22.54%** |
|
| 118 |
+
| **OOD Total Variation Distance (TVD)** | 0.4607 | **0.2389** | **-48.1% (Calibrated)** |
|
| 119 |
+
| **OOD KL Loss** | 0.7884 | **0.6972** | **-11.6%** |
|
| 120 |
+
| **In-Distribution TVD (`test`)** | 0.1664 | **0.0921** | **-44.6% (Sub-9% deviation)** |
|
| 121 |
+
| **In-Distribution Loss** | 0.1757 | **0.1033** | **-41.2%** |
|
| 122 |
+
| **Inference Latency** | 42.94 ms | **31.49 ms** | **26.7% faster** |
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
## π₯ How to Download the Model
|
| 127 |
+
|
| 128 |
+
We host full fused weights and modular LoRA adapters on the [Hugging Face Hub](https://huggingface.co/devankit7873/QJev-1.5B).
|
| 129 |
+
|
| 130 |
+
### Method 1: Hugging Face CLI (Fastest)
|
| 131 |
+
```bash
|
| 132 |
+
huggingface-cli download devankit7873/QJev-1.5B --local-dir ./QJev-1.5B
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
### Method 2: Python `snapshot_download`
|
| 136 |
+
```python
|
| 137 |
+
from huggingface_hub import snapshot_download
|
| 138 |
+
|
| 139 |
+
snapshot_download(repo_id="devankit7873/QJev-1.5B", local_dir="./QJev-1.5B")
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Method 3: Git LFS Clone
|
| 143 |
+
```bash
|
| 144 |
+
git lfs install
|
| 145 |
+
git clone https://huggingface.co/devankit7873/QJev-1.5B
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
## π Quickstart & Usage
|
| 151 |
+
|
| 152 |
+
### 1. Installation
|
| 153 |
+
```bash
|
| 154 |
+
git clone https://github.com/AnkitNayak-dev/QJev-1.5B.git
|
| 155 |
+
cd QJev-1.5B
|
| 156 |
+
pip install -r requirements.txt
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
### 2. 1-Command CLI Decision
|
| 160 |
+
```bash
|
| 161 |
+
python qjev.py --context "Patient has severe chest pain and elevated troponin" --choices "Emergency PCI" "Aspirin" "Wait"
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
### 3. Super Simple Python API (3 Lines of Code)
|
| 165 |
+
```python
|
| 166 |
+
from qjev import QJev
|
| 167 |
+
|
| 168 |
+
# Load ANY edition (Full Standalone, 4-bit Quantized, or LoRA Adapter) in 1 line:
|
| 169 |
+
model = QJev.from_pretrained("devankit7873/QJev-1.5B")
|
| 170 |
+
# Or 4-bit (1.07 GB VRAM): model = QJev.from_pretrained("devankit7873/QJev-1.5B-4bit")
|
| 171 |
+
# Or LoRA (20 MB download): model = QJev.from_pretrained("devankit7873/QJev-1.5B-LoRA")
|
| 172 |
+
|
| 173 |
+
# 1-Line Decision (<35 ms)
|
| 174 |
+
result = model.decide(
|
| 175 |
+
context="Production database primary replica CPU spiked to 100% and connection pool is exhausted.",
|
| 176 |
+
choices=[
|
| 177 |
+
"Trigger immediate automated failover to standby replica",
|
| 178 |
+
"Restart the primary database daemon immediately",
|
| 179 |
+
"Double connection pool limits without scaling compute",
|
| 180 |
+
"Silence alerts and monitor for next 15 minutes"
|
| 181 |
+
]
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
print(f"π Recommended Action: {result['best_choice']} ({result['confidence']}%)")
|
| 185 |
+
for choice, prob in result['probabilities'].items():
|
| 186 |
+
print(f" [{prob:>5.2f}%] {choice}")
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
**Expected Output:**
|
| 190 |
+
```text
|
| 191 |
+
π Recommended Action: Trigger immediate automated failover to standby replica (88.28%)
|
| 192 |
+
[88.28%] Trigger immediate automated failover to standby replica
|
| 193 |
+
[ 6.54%] Restart the primary database daemon immediately
|
| 194 |
+
[ 4.79%] Double connection pool limits without scaling compute
|
| 195 |
+
[ 0.45%] Silence alerts and monitor for next 15 minutes
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## π Multi-Engine Inference Deployment
|
| 201 |
+
|
| 202 |
+
QJev-1.5B is designed to deploy across **all major LLM serving runtimes**:
|
| 203 |
+
|
| 204 |
+
### 1. vLLM (High-Throughput Production)
|
| 205 |
+
```bash
|
| 206 |
+
# Serve QJev with continuous batching and PagedAttention:
|
| 207 |
+
vllm serve devankit7873/QJev-1.5B --task classify --port 8000
|
| 208 |
+
```
|
| 209 |
+
Query from Python via `qjev.py`:
|
| 210 |
+
```python
|
| 211 |
+
from qjev import QJev
|
| 212 |
+
model = QJev.from_remote("http://localhost:8000")
|
| 213 |
+
result = model.decide(context="Kubernetes node 3 unreachable", choices=["Drain", "Reboot", "Wait"])
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
### 2. Ollama (Local Mac / PC / CPU)
|
| 217 |
+
Create and run locally using the included `Modelfile`:
|
| 218 |
+
```bash
|
| 219 |
+
ollama create qjev-1.5b -f Modelfile
|
| 220 |
+
ollama run qjev-1.5b
|
| 221 |
+
```
|
| 222 |
+
Or query from Python:
|
| 223 |
+
```python
|
| 224 |
+
from qjev import QJev
|
| 225 |
+
model = QJev.from_ollama("http://localhost:11434", model="qjev-1.5b")
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
### 3. llama.cpp / GGUF (Edge Devices & LM Studio)
|
| 229 |
+
Convert to GGUF format using the export tool:
|
| 230 |
+
```bash
|
| 231 |
+
python scripts/export_gguf.py --model-dir export/QJev-1.5B-Phase3 --out-file qjev-1.5b-f16.gguf
|
| 232 |
+
./llama-quantize qjev-1.5b-f16.gguf qjev-1.5b-q4_k_m.gguf Q4_K_M
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
### 4. Unified Microservice Server (`serve.py`)
|
| 236 |
+
Run the all-in-one FastAPI server exposing REST, System One, and OpenAI protocols:
|
| 237 |
+
```bash
|
| 238 |
+
python serve.py --port 8000
|
| 239 |
+
```
|
| 240 |
+
* **REST API:** `POST /v1/decide`
|
| 241 |
+
* **Official Jev Protocol:** `POST /v1/systemone`
|
| 242 |
+
* **OpenAI Drop-In:** `POST /v1/chat/completions`
|
| 243 |
+
|
| 244 |
+
---
|
| 245 |
+
|
| 246 |
+
## ποΈ Model Architecture & System 1 Paradigm
|
| 247 |
+
|
| 248 |
+
```
|
| 249 |
+
[User Context + Formatted Choices]
|
| 250 |
+
β
|
| 251 |
+
βΌ
|
| 252 |
+
ββββββββββββββββββββββββββ
|
| 253 |
+
β Qwen2.5-1.5B Backbone β (QLoRA adapted on q, k, v, o projections)
|
| 254 |
+
βββββββββββββ¬βββββββββββββ
|
| 255 |
+
β (Last Hidden State: 1536 dim)
|
| 256 |
+
βΌ
|
| 257 |
+
ββββββββββββββββββββββββββ
|
| 258 |
+
β LayerNorm(1536) β
|
| 259 |
+
βββββββββββββ¬βββββββββββββ
|
| 260 |
+
β
|
| 261 |
+
βΌ
|
| 262 |
+
ββββββββββββββββββββββββββ
|
| 263 |
+
β Linear(1536 -> 512) β (GELU + Dropout 0.1)
|
| 264 |
+
βββββββββββββ¬βββββββββββββ
|
| 265 |
+
β
|
| 266 |
+
βΌ
|
| 267 |
+
ββββββββββββββββββββββββββ
|
| 268 |
+
β Linear(512 -> 10) β (Dynamic Choice Masking)
|
| 269 |
+
βββββββββββββ¬βββββββββββββ
|
| 270 |
+
β
|
| 271 |
+
βΌ
|
| 272 |
+
[Calibrated Softmax Probabilities]
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
---
|
| 276 |
+
|
| 277 |
+
## π» Hardware & Training Infrastructure
|
| 278 |
+
|
| 279 |
+
Trained from scratch locally on consumer silicon:
|
| 280 |
+
- **Host System:** HP OMEN Gaming Laptop (Windows 11 Pro 64-bit)
|
| 281 |
+
- **GPU:** NVIDIA GeForce RTX 5060 Laptop GPU (8GB VRAM)
|
| 282 |
+
- **CUDA / Driver:** CUDA 12.8 / Driver 621.24 (CUDA UMD 13.5)
|
| 283 |
+
- **Framework:** PyTorch `2.12.0.dev20260408+cu128`, `transformers 5.22.0`, `peft 0.21.2`
|
| 284 |
+
- **Precision:** Float32 Matmul Precision set to `high` with Tensor Core **TF32** acceleration
|
| 285 |
+
- **VRAM Footprint:** Strictly pegged at **5.90 GB / 8.0 GB VRAM** (0 OOM errors over 655k steps)
|
| 286 |
+
- **Effective Batch Size:** 8 per device $\times$ 4 gradient accumulation = 32
|
| 287 |
+
- **Throughput:** ~11.5β12.0 samples/sec (total ~18.5 GPU compute hours)
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
## π Repository Structure
|
| 292 |
+
|
| 293 |
+
```text
|
| 294 |
+
βββ README.md # Project showcase, benchmarks, and usage
|
| 295 |
+
βββ LICENSE # Apache 2.0 open-source license
|
| 296 |
+
βββ requirements.txt # Python dependencies
|
| 297 |
+
βββ predict.py # 1-click single-pass inference demo
|
| 298 |
+
β
|
| 299 |
+
βββ src/ # Core modeling and training pipeline
|
| 300 |
+
β βββ model.py # MLP Decision Head + Qwen integration
|
| 301 |
+
β βββ dataset.py # ChatML streaming dataset loader
|
| 302 |
+
β βββ train.py # Phase 1 baseline training script
|
| 303 |
+
β βββ train_phase2.py # Phase 2 QLoRA joint training script (655k steps)
|
| 304 |
+
β βββ evaluate.py # Evaluation metrics (TVD, Accuracy, KL loss)
|
| 305 |
+
β
|
| 306 |
+
βββ benchmark/ # Evaluation suites
|
| 307 |
+
β βββ run_jevbench.py # Official JevBench metamorphic evaluation runner
|
| 308 |
+
β
|
| 309 |
+
βββ reports/ # Complete empirical benchmark records
|
| 310 |
+
β βββ jevbench_aligned/ # Official JevBench scores (71.5% calibrated)
|
| 311 |
+
β βββ phase_1/ # Phase 1 baseline evaluation records
|
| 312 |
+
β βββ phase_2/ # Phase 2 evaluations across all 50k checkpoints
|
| 313 |
+
β
|
| 314 |
+
βββ scripts/ # Workflow utilities
|
| 315 |
+
βββ merge_and_export.py # LoRA fusing and safetensors export
|
| 316 |
+
βββ download_data.py # Dataset loader from Hugging Face
|
| 317 |
+
βββ download_model.py # Base model downloader
|
| 318 |
+
βββ upload_to_hf.py # Automated Hugging Face publisher
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
---
|
| 322 |
+
|
| 323 |
+
## π Telemetry & Tracking
|
| 324 |
+
All training trajectories, step metrics, and evaluations were recorded in real time:
|
| 325 |
+
- **Weights & Biases Dashboard:** [`phase-2-lora-joint-run`](https://forge.coreweave.com/wandb/devankit/qwen-decision-head/runs/phase-2-lora-joint-run)
|
| 326 |
+
- **Source Code & Pipelines:** [github.com/AnkitNayak-dev/QJev-1.5B](https://github.com/AnkitNayak-dev/QJev-1.5B)
|
| 327 |
+
- **Model Weights & Hub:** [huggingface.co/devankit7873/QJev-1.5B](https://huggingface.co/devankit7873/QJev-1.5B)
|
| 328 |
+
|
| 329 |
+
---
|
| 330 |
+
|
| 331 |
+
## π Citation
|
| 332 |
+
|
| 333 |
+
If you use **QJev-1.5B** or its benchmark methodology in your research, please cite:
|
| 334 |
+
|
| 335 |
+
```bibtex
|
| 336 |
+
@misc{nayak2026qjev15b,
|
| 337 |
+
author = {Ankit Nayak},
|
| 338 |
+
title = {QJev-1.5B: High-Speed System 1 JEV Decision Model based on Qwen2.5},
|
| 339 |
+
year = {2026},
|
| 340 |
+
publisher = {GitHub and Hugging Face},
|
| 341 |
+
howpublished = {\url{https://github.com/AnkitNayak-dev/QJev-1.5B}}
|
| 342 |
+
}
|
| 343 |
+
```
|
| 344 |
+
|
| 345 |
+
---
|
| 346 |
+
|
| 347 |
+
## π License
|
| 348 |
+
This model and codebase are released under the **Apache 2.0 License**.
|
| 349 |
+
Base weights are governed by the Alibaba Cloud Qwen License. Distillation corpus is provided by SargeDev (`jev-distill-corpus-v3`). Metamorphic benchmarking powered by JevBench.
|