← All drillsTeach a Language Model What Sells Together
What you'll be able to do- ✓Build a shop of 1,000 products and 100,000 baskets with itemsets planted on purpose, so the right answer is known
- ✓Build an exact frequent-itemset miner (Apriori on bitsets) and use it as the answer key every model is scored against
- ✓Turn a basket into text a language model can read, and show why the order of the items must be shuffled
- ✓Measure an off-the-shelf language model on next-item prediction with MRR and hits@K, and put a range on every number with a bootstrap
- ✓Continue the pretraining of a small open language model on your own baskets, with a hand-written loss, step and mask
- ✓Probe the trained model by having it write baskets, mining them, and scoring recovery by support, size and label against a ceiling
- ✓Turn the model's scores into cross-sell suggestions, and test them against a simple counting recommender
Build Phase 1 of an LLM-backed recommender in miniature: adapt an open model to your own transaction records, then test what it learned against an exact answer, not an impression. You also learn the habit most teams skip, which is to build the simple baseline first and see what beating it costs.
⌁ Netflix's GenRec adapts an open language model to its own data before ranking. Amazon built its recommendations on item-to-item co-purchase counting. The exact miner and the counting baseline you build here are the standards any model has to beat.
Start this internshipCreate an account to unlock the 12 sections, the workbench, and askThili.
BeginSections
1. Teach a Language Model What Sells Together
🔒 locked2. A Shop's Catalogue
🔒 locked3. How Much Each Item Sells
🔒 locked4. Background Baskets
🔒 locked5. Plant One Itemset
🔒 locked7. The Exact Answer
🔒 locked8. Verbalize a Basket
🔒 locked9. The Off-the-Shelf Baseline
🔒 locked10. Continued Pretraining
🔒 locked11. Probe the Model
🔒 locked12. From Itemsets to Cross-sell and Upsell
🔒 lockedDig deeper
📄GenRec: An LLM-Backed Recommendation Ranker at Netflix (Li, Sehgal, Rao, Houthooft, Zhu & Rastogi, arXiv:2608.10257)
paper📄Fast Algorithms for Mining Association Rules (Agrawal & Srikant, 1994, VLDB)
paper📄SmolLM2: When Smol Goes Big, Data-Centric Training of a Small Language Model (Allal et al., arXiv:2502.02737)
paper📄Amazon.com Recommendations: Item-to-Item Collaborative Filtering (Linden, Smith & York, 2003, IEEE Internet Computing)
paper🔗thili-ai/thilimarketbasket, the reference implementation you build in this course
code