Qwen2.5-Math-1.5B-Scoring

This is a custom Qwen2 model with dual heads:

  1. Language Model Head: Standard next-token prediction for text generation
  2. Success Rate Head: Predicts a success probability score in [0, 1] for the sequence

Base Model

This model is based on friendshipkim/Qwen2.5-Math-1.5B.

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM

# Load model with trust_remote_code=True
model = AutoModelForCausalLM.from_pretrained(
    "friendshipkim/Qwen2.5-Math-1.5B-Scoring",
    trust_remote_code=True,
    torch_dtype="auto"
)
tokenizer = AutoTokenizer.from_pretrained("friendshipkim/Qwen2.5-Math-1.5B-Scoring")

# Example: Get both LM output and success score
prompt = "Question: What is 2+2?\nAnswer: 4"
inputs = tokenizer(prompt, return_tensors="pt")

# Get both outputs
lm_output, success_score = model(**inputs, return_score=True)
print(f"Success rate: {success_score.item():.3f}")

# Generate text (return_score=False for standard generation)
generated = model.generate(**inputs, max_length=50, return_score=False)
print(tokenizer.decode(generated[0]))

Model Architecture

  • Backbone: Qwen2 transformer model
  • LM Head: Linear layer for next-token prediction (vocab_size outputs)
  • Success Rate Head: Linear layer for sequence scoring (1 output, sigmoid activation)

Training

The success_rate_head is randomly initialized and needs to be fine-tuned on your task. The LM head and backbone are initialized from the base model.

Custom Modeling

This model uses a custom modeling file (modeling_custom.py) that extends Qwen2ForCausalLM. The return_score parameter controls whether to compute the success rate:

  • return_score=True: Returns (lm_output, success_score)
  • return_score=False: Returns lm_output only (for standard generation)
Downloads last month
17
Safetensors
Model size
2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for friendshipkim/Qwen2.5-Math-1.5B-Scoring

Finetuned
(2)
this model