Views
No views yet

Google will increase the development of data centers in 2026 by 25%.
Google increased the development of data centers in 2025 by 25%.


prediction and not-prediction classes onto tokens. This is the mapping we chose.1{
2 "prediction": "prediction", # Contains a prediction.
3 "not-prediction": "_prediction" # Does not contain a prediction.
4}[!CAUTION]
- Disable Thinking: You must set
enable_thinking=False(or disable reasoning tokens).- Exact System Prompt: You must use the specific system prompt:
"Classify whether it contains a prediction or does not contain a prediction."- Constrain Output: You must restrict generation to the valid labels (
["prediction", "_prediction"]) using grammars, regex, or guided decoding.
- SGLang: Use
regex="(prediction|_prediction)"in the API call.- vLLM: Use
guided_choice=["prediction", "_prediction"]in the API call.- llama.cpp / GGUF: Apply a GBNF grammar or regex to force selection from the list.
- OpenAI / Structured Outputs: Use
response_formator JSON Schema enforcement where supported.Deviating from these requirements will severely impact performance and reliability.
apply_chat_template method with the specific system prompt used during training.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "NOSIBLE/prediction-v1.1-base"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 device_map="auto",
10 trust_remote_code=True,
11 torch_dtype=torch.bfloat16
12)
13
14# Define the input text
15text = "The company is expected to record a profit margin of more than 15% next quarter."
16
17# 1. Structure the prompt exactly as used in training
18messages = [
19 {"role": "system", "content": "Classify whether it contains a prediction or does not contain a prediction."},
20 {"role": "user", "content": text},
21]
22
23# 2. Apply chat template
24prompt = tokenizer.apply_chat_template(
25 messages,
26 tokenize=False,
27 add_generation_prompt=True,
28 enable_thinking=False # Must be set to false.
29)
30
31inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
32
33# 3. Generate the response (label)
34# We limit max_new_tokens because only a single-word response is expected
35outputs = model.generate(**inputs, max_new_tokens=1)
36response = tokenizer.decode(outputs[0], skip_special_tokens=True)
37
38# The model echoes the system and user messages in its output, so we extract the new text
39print(response.split("<|im_start|>assistant\n")[-1])
40# Expected Output: predictionsglang>=0.4.6.post1 vllm>=0.8.5 to create an OpenAI compatible API endpoint.python -m sglang.launch_server --model-path Qwen/Qwen3-0.6B --reasoning-parser qwen31import math
2from openai import OpenAI
3
4# Initialize the client pointing to your vLLM server
5client = OpenAI(
6 base_url="http://localhost:8000/v1", # Replace with your endpoint URL if remote
7 api_key="EMPTY"
8)
9
10model_id = "NOSIBLE/prediction-v1.1-base"
11
12# Input text to classify
13text = "The company is expected to record a profit margin of more than 15% next quarter."
14
15# Define the classification labels
16labels = ["prediction", "_prediction"]
17
18# Prepare the conversation
19messages = [
20 {"role": "system", "content": "Classify whether it contains a prediction or does not contain a prediction."},
21 {"role": "user", "content": text},
22]
23
24# Make the API call
25chat_completion = client.chat.completions.create(
26 model=model_id,
27 messages=messages,
28 temperature=0,
29 max_tokens=1,
30 stream=False,
31 logprobs=True, # Enable log probabilities to calculate confidence
32 top_logprobs=len(labels), # Ensure we capture logprobs for our choices
33 extra_body={
34 "chat_template_kwargs": {"enable_thinking": False}, # Must be set to false.
35 "regex": "(prediction|_prediction)",
36 },
37)
38
39# Extract the response content
40response_label = chat_completion.choices[0].message.content
41
42# Extract the logprobs for the generated token to calculate confidence
43first_token_logprobs = chat_completion.choices[0].logprobs.content[0].top_logprobs
44
45print(f"--- Classification Results ---")
46print(f"Input: {text}")
47print(f"Predicted Label: {response_label}\n")
48
49print("--- Label Confidence ---")
50for lp in first_token_logprobs:
51 # Convert log probability to percentage
52 probability = math.exp(lp.logprob)
53 print(f"Token: '{lp.token}' | Probability: {probability:.2%}")1--- Classification Results ---
2Input: The company is expected to record a profit margin of more than 15% next quarter.
3Predicted Label: prediction
4
5--- Label Confidence ---
6Token: 'prediction' | Probability: 99.98%
7Token: '_prediction' | Probability: 0.02%Trainer with bf16 precision.| Hyperparameter | Value |
|---|---|
| Learning Rate | 2e-5 |
| Scheduler | Cosine (Warmup ratio 0.03) |
| Batch Size | 64 |
| Epochs | 2 |
| Optimizer | AdamW Torch Fused |
| Precision | bfloat16 |
| NEFTune Noise Alpha | 5 |
| Weight Decay | 0.1 |
1@misc{nosible2025prediction,
2 author = {NOSIBLE},
3 title = {Prediction v1.1 Base},
4 year = {2025},
5 publisher = {Hugging Face},
6 journal = {Hugging Face Repository},
7 howpublished = {https://huggingface.co/NOSIBLE/prediction-v1.1-base}
8}