CoolFace
Modelpublic

kalistratov/qwen3-8b-semantic-ids

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
0likes8downloads
Model Card

Qwen3-8B Fine-tuned for Semantic ID Recommendation

Overview

Qwen3-8B fine-tuned for generative product recommendation via hierarchical semantic identifiers. The model generates 4-level Semantic IDs (<|sid_start|><|A#|><|B#|><|C#|><|D#|><|sid_end|>) given product descriptions, purchase histories, or co-purchase contexts.

This is the larger model in a controlled comparison experiment (1.8B vs 8B), demonstrating consistent improvement across all task types with increased model scale.

Training

Stage 1: Vocabulary Expansion

  • Added 1,027 special tokens (3 structural + 4×256 codebook tokens)
  • Trained only embedding matrices (untied input/output)
  • 2,000 steps, LR 1×10⁻³, batch 16 × 4 = 64 effective

Stage 2: Full Fine-tuning

  • Dataset: 4,719,994 instruction-formatted conversations (Amazon Pet Supplies)
  • Task types: text→SID, sequential recommendation, co-purchase prediction
  • Optimizer: AdamW 8-bit, LR 2×10⁻⁵, cosine with min LR (0.2×peak)
  • Warmup: 3%, weight decay 0.01
  • Batch: 16 × 8 = 128 effective, 3 epochs
  • Techniques: Custom instruction masking, greedy sequence packing (~3× throughput), gradient checkpointing
  • Hardware: NVIDIA H100 80GB (vast.ai), ~10.5 hours

Results

Hierarchical SID prediction accuracy (greedy decoding):

TaskA-levelExact (beam k=10)
title → SID66.0%3.3%
description → SID65.8%3.3%
features → SID62.1%2.7%
seqlast28.7%6.8%
seqlast310.7%6.0%
seqlast59.7%6.0%
copurchase_backward5.7%1.8%
copurchase_forward6.0%2.0%

Evaluation: 3,000 samples per task, 11 task types.

Comparison with 1.8B

Task category1.8B8BΔ
Text → SID (avg)59.9%64.6%+4.7
Sequential (avg)7.0%9.7%+2.7
Co-purchase (avg)5.5%5.8%+0.3

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("kalistratov/qwen3-8b-semantic-ids")
tokenizer = AutoTokenizer.from_pretrained("kalistratov/qwen3-8b-semantic-ids")

Citation

Master's thesis, Moscow Institute of Physics and Technology (MIPT), 2026.

References

  1. 1.Y. Sun et al. "OpenOneRec," arXiv:2502.18851, 2025.
  2. 2.J. Liu et al. "PLUM," arXiv:2406.12346, 2024.
  3. 3.C. Huh et al. "Straightening Out the Straight-Through Estimator," arXiv:2410.06424, 2024.
  4. 4.E. Yan. "semantic-ids-llm," GitHub, 2024.