Model or dataset
AkaliKong/MiniOneRec avatar
AkaliKong/MiniOneRec

MiniOneRec: a minimal, end-to-end reproduction of OneRec's generative recommendation pipeline

Minimal reproduction of OneRec

1,820 stars271 forksPythonApache-2.0

At a glance

What is it?
MiniOneRec turns products into discrete semantic IDs, fine-tunes an LLM to predict the next one, and polishes the policy with GRPO. It is a research reproduction, not a serving stack, and the README itself documents a decoding failure that can invalidate your metrics.
Who is it for?
Adopt MiniOneRec if you are reproducing or extending generative recommendation research and you control your own training environment; skip it if you need a production recommender with a serving path, since the repository ships training and offline evaluation scripts only.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 9 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem MiniOneRec addresses: item IDs that carry no meaning

Conventional recommenders assign each product an arbitrary integer index and learn an embedding table over it. The index has no relation to the product's text, so a new item starts from nothing, and the model cannot reason about an item it has never seen. MiniOneRec takes the opposite route. Every product is rewritten as a short sequence of discrete codes, called a SID, derived from the item's title and description. The README describes the mechanism directly: it concatenates an item's title and description, feeds the sentence through a frozen text encoder, and quantises the resulting embedding with a three-level RQ-VAE. The audience is researchers and engineers who want the full pipeline in one repository rather than three papers and a pile of unpublished glue code. The README calls it the first fully open-source generative recommendation framework, and the scope matches that claim: SID construction, supervised fine-tuning, and recommendation-oriented reinforcement learning under one Apache-2.0 licence.

How a product becomes a token sequence: the SID pipeline

SID construction is the part most reproductions skip, and it is the part that determines whether the rest works. The repository ships several construction methods, and the announcement log shows them changing over time: constrained-RQ-Kmeans, RQ-Kmeans, and RQ-Kmeans+, which the README credits to GPR and describes as the first open-source reproduction of that method. The text-to-embedding step is handled by rq/text2emb/amazon_text2emb.py, which the 2025-11-19 entry describes as a multi-GPU parallel implementation built on Accelerate, replacing an earlier single-process version. That detail matters more than it looks. Encoding an entire product catalogue through a frozen text encoder is the slowest step in the pipeline, and it is the one most likely to be run once and cached. If you change the encoder or the quantiser, you invalidate every SID and must re-encode. The three-level RQ-VAE structure means each item is represented by three tokens, so the model's output vocabulary is the set of SID codes rather than the item catalogue itself. That is what makes constrained decoding possible later: the action space is a closed list, not an open vocabulary.

Two training stages and what each one actually optimises

The first stage is supervised fine-tuning. The README states that the chronologically ordered user history is treated as a token sequence and the model learns, via next-token prediction, to generate the SID of the next product. That alone would be an ordinary sequence model. The distinguishing part is co-training with language-alignment objectives that map between natural language and SID space, which the README frames as letting the recommender inherit world knowledge from the LLM while grounding it in discrete item codes. The second stage is GRPO-based reinforcement learning. Multiple candidate recommendations are generated per prompt, rewards are normalised within the group to stabilise gradients, and a KL penalty keeps the updated policy near its reference. The reward blends a binary correctness term with a rank-aware component that penalises high-probability but incorrect items, and the README notes it can be augmented with collaborative-filtering scores. The repository also carries GPR-inspired variants: sft_gpr.py implements Value-Aware Fine-Tuning with a weighted loss based on simulated item value, and rl_gpr.py implements Hierarchy Enhanced Policy Optimization. Those are separate code paths, not configuration flags, so choosing between them is a code-level decision.

Getting it running: scripts, configs and the constrained-decoding switch

The entry points are shell scripts at the repository root. sft.sh starts supervised fine-tuning and dispatches to sft.py; rl.sh starts the RL stage and dispatches to rl.py; evaluate.sh runs one-click offline Top-K evaluation through evaluate.py, which computes HR@K and NDCG@K. Configuration lives in configs/ as YAML files, and the trainer is minionerec_trainer.py, described as a GRPO-based trainer specialised for generative recommendation. Constrained decoding is implemented in LogitProcessor.py, which the README's directory table describes as a logit processor for constrained decoding. That file is the mechanism behind the README's claim that constrained beam search guarantees every beam is unique and valid. Two practical switches appear in the announcement log. Since 2025-11-07 you can freeze the LLM parameters during SFT and train only the embeddings for the newly added SID vocabulary, which cuts the optimiser state and makes the stage feasible on smaller hardware. Checkpoints are downloadable as of 2025-10-31, from Hugging Face under kkknight/MiniOneRec or ModelScope. The README gives no installation section, no dependency pin file in the material provided, and no hardware requirements, so treat environment setup as unspecified.

The decoding failure the maintainers documented themselves

The 2026-01-04 announcement is the most useful paragraph in the README and the reason to read it before running anything. Users reported discrepancies between results reproduced from an Instruct model and the reported metrics. The maintainers' diagnosis: check whether the CC metric in the evaluation log is non-zero, referring to calc.py. A non-zero CC means the model is still generating a large number of invalid items and constrained decoding has not taken effect. They suspect dependency versions, naming the transformer library, and state they are still investigating a universal fix. Their interim workaround is to switch from an Instruct model to a base model such as Qwen2.5-base. This is a silent failure mode. Nothing crashes. Training and evaluation complete, and you get numbers that look like results. If your evaluation harness does not surface CC, you will not notice. Any reproduction attempt should treat the CC value as a gate rather than a diagnostic, and anyone comparing against the reported metrics without checking it is comparing against an unknown quantity.

Where MiniOneRec is the wrong tool, and what to use instead

MiniOneRec is a research reproduction. The repository is training scripts, YAML configs, a trainer, a logit processor and an offline evaluator. There is no serving component, no online inference path, and no latency or throughput guidance in the material provided. If your requirement is a recommender that answers requests in milliseconds under load, this is the wrong starting point regardless of model quality. The alternative that makes the difference concrete is a conventional two-tower or matrix-factorisation retrieval model with an embedding table keyed by item ID. That approach has a well-understood serving path, incremental updates for new items, and no dependency on a frozen text encoder staying fixed. Its weakness is exactly MiniOneRec's strength: a brand-new item has no trained embedding, so it cannot be recommended until it accumulates interactions, whereas MiniOneRec can generate a SID for an item from its title and description alone. Conversely, MiniOneRec's dependence on a three-level quantiser means every catalogue change can require re-encoding, and the mapping from SID back to item must be maintained as a first-class artefact. The two designs solve different problems. Do not pick MiniOneRec because generative recommendation is the current direction; pick it because your items have usable text and cold-start behaviour is what you are trying to fix.

Maintenance cost and what the Apache-2.0 licence leaves to you

The announcement log runs from 2025-10-31 to 2026-05-13, with SID construction methods updated four times and a data bug fixed in data.py on 2025-12-01. That bug is worth reading closely: the maintainers state it could cause the SID-item alignment task to see the answers in advance, and that it does not affect model performance. A project that documents its own data leakage and its own decoding failure is more trustworthy than one that does not, but it also tells you the interfaces are still moving. Pin to a commit rather than tracking main if you need reproducible numbers. The Apache-2.0 licence permits commercial use and modification, but it covers the code in this repository only. The base models you fine-tune carry their own licences, and the README points at Qwen2.5 variants, so verify the terms for whichever checkpoint you start from. The released checkpoints under kkknight/MiniOneRec may carry separate terms from the code. This is not legal advice; read the licence files that ship with each artefact you download.

Editorial conclusion

Adopt MiniOneRec if you are reproducing or extending generative recommendation research and you control your own training environment; skip it if you need a production recommender with a serving path, since the repository ships training and offline evaluation scripts only. Before trusting any number, check that the CC metric in the evaluation log is zero, as the maintainers instruct, and confirm which SID construction method and which base model your config actually points at.

Official sources

  1. AkaliKong/MiniOneRec on GitHub
  2. Issues
  3. License: Apache-2.0
  4. README
Community notes

Community notes