Downloads · 30 days
9
20% of all-time downloads
pblrvo/Qwen3-4B-Game-semantic-IDs
Qwen3-4B-Game-semantic-IDs is a text generation model from pblrvo. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
QLoRA fine-tune of Qwen/Qwen3-4B to reason over semantic IDs -- short discrete codes produced by an RQ-VAE trained on game-catalog item embeddings -- instead of ever seeing raw item IDs or embeddings directly. Trained…
Downloads · 30 days
9
20% of all-time downloads
All-time downloads
44
Public
Repo size
4.8 GB
Likes
0
Public
Click a slice to open those files.
.safetensors4.8 GB · 100%
From the Hugging Face model README
QLoRA fine-tune of Qwen/Qwen3-4B to reason over semantic IDs -- short discrete codes produced by an RQ-VAE trained on game-catalog item embeddings -- instead of ever seeing raw item IDs or embeddings directly. Trained on the paired dataset pblrvo/steam-games-semanticIds-instructions.
Game catalog items -> embedded (Qwen3-0.6B) -> compressed into 4-level semantic IDs via RQ-VAE -> those ID tokens become new vocabulary the LLM is fine-tuned to reason over. Two-stage fine-tuning:
embed_tokens/lm_head trained (codebook-grounded initialization +
short high-LR run) so the new ID tokens carry meaningful structure before task-specific training begins.Both stages run through 4-bit quantization -- full-parameter fine-tuning of a ~4B model doesn't fit a single 12GB consumer GPU alongside gradients/optimizer state.
Recall@K / NDCG@K via constrained beam search (candidates restricted to real catalog items through a trie over valid semantic IDs / descriptions), the same methodology TIGER (Rajput et al. 2023) and LC-Rec use for semantic-ID generative recommenders -- a single greedy decode is a top-1 prediction, not a ranking, so beam search stands in for the ranking step a classic recommender gets for free from a dot-product over all items.
| Task | Recall@5 | NDCG@5 | Recall@10 | NDCG@10 |
|---|---|---|---|---|
| sequential | 12% | 0.091 | 13% | 0.094 |
| similar_item | 10% | 0.072 | 13% | 0.082 |
| grounding_name2id | 2% | 0.009 | 3% | 0.012 |
| grounding_id2name | 0% | 0.000 | 0% | 0.000 |
(n=100 per task, temperature=0.8, beam=10; catalog size ~8,563 items, so random-chance Recall@10 is ~0.12% -- the recommendation-shaped tasks land well above chance, the two grounding directions remain a clear, unresolved weak point.)
grounding_id2name produces plausible, valid catalog
descriptions (~85-90% valid-format) but essentially never the specific correct one, even given a
10-candidate retry budget. Unlike the relational tasks (sequential/similar item), the ID<->name
mapping has no exploitable structure to generalize from -- it's closer to an arbitrary lookup table
than a learnable pattern, and a rank-8 LoRA adapter may simply not have enough capacity to memorize
it precisely for ~8,500 items. Some of this may also be a property of the semantic ID space itself:
items that collide on their coarser RQ-VAE codes are only disambiguated by a tiebreaker digit that
carries no learnable signal connecting it to the item's name.import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
ADAPTER = "pblrvo/Qwen3-4B-Game-semantic-IDs"
BASE_MODEL = "Qwen/Qwen3-4B"
tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
quantization_config = BitsAndBytesConfig(
load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True, llm_int8_skip_modules=["lm_head"],
)
base_model = AutoModelForCausalLM.from_pretrained(BASE_MODEL, dtype=torch.bfloat16, quantization_config=quantization_config)
base_model.resize_token_embeddings(len(tokenizer))
model = PeftModel.from_pretrained(base_model, ADAPTER)
The semantic-ID vocabulary (<|sid_start|>, <|sid_L{level}_{code}|>, <|sid_end|>) is only
meaningful relative to the specific RQ-VAE codebook trained in the source project -- this model isn't
usable standalone without that catalog/codebook context.