Downloads · 30 days
0
flavianv/qwen3-4b-hm-ranker-head-20260924-v1
qwen3-4b-hm-ranker-head-20260924-v1 is a machine learning model from flavianv. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Selected frozen-backbone head: 95.3% top-one selection (953/1000 validation queries) at step 942, epoch 0.75. Fresh head trained on 5,024 reserved queries / 20,096 Bradley-Terry pairs for two epochs, retaining eight c…
Downloads · 30 days
0
Access
Public
Updated Sep 24, 2026
Repo size
11.8 KB
Likes
0
Public
Click a slice to open those files.
.pdf89.9 KB · 52%
From the Hugging Face model README
Selected frozen-backbone head: 95.3% top-one selection (953/1000 validation queries) at step 942, epoch 0.75. Fresh head trained on 5,024 reserved queries / 20,096 Bradley-Terry pairs for two epochs, retaining eight checkpoints. Only the 2,560 scalar-head weights were trainable. Final accuracy was 95.0%; random-head baseline 11.9%.
This repository contains only the head, not a second copy of the 4B backbone. Load the exact frozen SFT model below. Validation compares true reference bundles against three synthetic same-query negatives, not generated-hit performance. The fourth negative strategy (wrong query) is counted only in pairwise metrics. Validation was used for checkpoint selection and had prior SFT evaluation exposure; this is not an untouched test result.
import json, torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from huggingface_hub import hf_hub_download
backbone = 'flavianv/qwen3-4b-hm-positive-sft-20260924-v1'
revision = '2e3df923d266b74c39d6475b270a3042cae06b0d'
tokenizer = AutoTokenizer.from_pretrained(backbone, revision=revision)
model = AutoModelForSequenceClassification.from_pretrained(
backbone, revision=revision, num_labels=1, dtype=torch.bfloat16,
attn_implementation='sdpa')
model.config.pad_token_id = tokenizer.pad_token_id
head = hf_hub_download('flavianv/qwen3-4b-hm-ranker-head-20260924-v1', 'score.pt')
model.score.float().load_state_dict(torch.load(head, map_location='cpu', weights_only=True))
model = model.cuda().eval()
system = ('Assess whether a clothing product bundle satisfies the request as a coherent outfit. '
'Use the supplied real product titles. Items should serve useful complementary roles. '
'Do not infer unprovided material, size, compatibility or price facts.')
def score(query, product_titles):
text = tokenizer.apply_chat_template([
{'role':'system','content':system},
{'role':'user','content':query},
{'role':'assistant','content':json.dumps({'products':product_titles},ensure_ascii=False)}
], tokenize=False, add_generation_prompt=False, enable_thinking=False)
inputs = tokenizer(text, add_special_tokens=False, return_tensors='pt').to('cuda')
with torch.inference_mode():
return model(**inputs).logits.float().item()
Higher raw scores rank better. No sigmoid temperature calibration was performed; sigmoid(score/3) is not a validated probability for this head.
PDF, Markdown, trajectory CSV. Input manifest and exact training configuration included. Ranking dataset is not yet published. The published source split is H&M positive SFT / ranker reserve.