Jev in 25 Lines of Python
Implementing Jev with 25 Python Lines
It seems like everyone—including your parents—is currently obsessed with Jev. If you've been on Twitter lately, you know it's being hailed as the absolute frontier of the AI paradigm and the future of Large Language Models (LLMs).
🛠️ Prerequisites
Before running the code, ensure you have the following:
- Python 3.12+
-
huggingface-hub -
llama-cpp-python -
numpy
💻 The Implementation
Here is the concise implementation using a GGUF model. You can swap the repo_id for any compatible model found on the Hugging Face GGUF library.
# /// script
# requires-python = ">=3.12"
# dependencies = ["huggingface-hub", "llama-cpp-python", "numpy"]
# ///
import numpy as np
from llama_cpp import Llama
# Initialize model with Qwen3-0.6B
model = Llama.from_pretrained(
repo_id="Qwen/Qwen3-0.6B-GGUF",
filename="Qwen3-0.6B-Q8_0.gguf",
n_ctx=512,
logits_all=True,
verbose=False,
)
# Setup classification parameters
labels = ["A", "B", "C"]
choices = ["Legitimate", "Spam", "Phishing"]
email = "Payroll asks for your password on a non-company sign-in page."
options = "\n".join([f"{l}. {c}" for l, c in zip(labels, choices, strict=True)])
prompt = f"|im_start| system Choose one option.\n|im_end| |im_start| user Email: {email}\n\n{options} |im_end| |im_start| assistant think\n\n/think\n\n"
# Extract logits for the label tokens
token_ids = [model.tokenize(l.encode(), add_bos=False, special=True)[0] for l in labels]
logits = model(prompt, max_tokens=1, logits_all=True)['logits'][0]
choice_logits = np.asarray([logits[tid] for tid in token_ids])
# Convert logits to probabilities
logprobs = choice_logits - np.log(np.sum(np.exp(choice_logits)))
probabilities = np.exp(logprobs)
for name, scores in [("Logits", choice_logits), ("Log probabilities", logprobs), ("Probabilities", probabilities)]:
print(f"{name}: {dict(zip(choices, np.tolist(scores), strict=True))}")
⚙️ How it Works
The process follows a linear pipeline from raw text to a probability distribution:
To transform the raw logits into usable probabilities, we essentially apply the softmax function:
Where represents the choice_logits for each label.
📊 Results
The output of the script provides a breakdown of how the model perceives the input email:
| Metric | Legitimate | Spam | Phishing |
|---|---|---|---|
| Logits | 26.254 | 27.262 | 29.614 |
| Log Probabilities | -3.482 | -2.474 | -0.122 |
| Probabilities | 0.031 | 0.084 | 0.885 |
⚠️ The Fine Print
Note: This is a parody blog post.
We didn't skipped the process of training a model with Reinforcement Learning for Calibrated Decisions (RLCD) to ensure the probabilities are perfectly calibrated (though, in reality, they aren't always accurate). Essentially, this is just a classifier: it takes a prompt with options and returns the probability of each.
For those seeking serious, production-ready implementations of Jev, please check out these resources:
OpenJevopenjev-sglangOpenJev on DiffusionGemma
Everything produced by NobodyWho is open-source. If you appreciate the work, please leave a star on GitHub to support us! ❤️
Published Sep 22, 2026 by Duarte O.Carmo (Technical)