---
type: "post"
id: "trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00"
slug: "trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00"
title: "Trained with Tokenlearn: distillation, mean-embedding targets, PCA and SIF reweighting."
description: "Tokenlearn is a method for pre-training static Model2Vec embedding models."
retrieval_nugget: "Tokenlearn is a method for pre-training static Model2Vec embedding models."
published_at: "2026-11-28"
updated_at: "2026-11-28"
record_date: "2026-11-28"
date_kind: "published_at"
topics: ["models"]
entities: ["MinishLab","Tokenlearn","Model2Vec","Potion"]
related_patterns: []
novelty_label: "new_fact"
what_changed: "Tokenlearn introduces a toolkit for pretraining static word embeddings using distillation, mean-embedding targets, PCA, and SIF reweighting."
prior_refs: []
source_url: "https://github.com/MinishLab/tokenlearn"
source_urls: ["https://github.com/MinishLab/tokenlearn"]
production: {"schema":"newruntime-production-v1","desk":"newsroom","first_seen_at":"2026-11-28T16:00:23.575Z","independent_sources":1,"notes_synthesized":null,"writer_model":"gpt-6-luna","critic":null,"checks":["primary_source_verified","source_fresh","one_story","copy_contract"],"novelty":{"label":"new_fact","confidence":"medium"},"editorial_value":"medium","human_review":"selective"}
citations: [{"claim":"","quotes":["Quickstart Install the package with: pip install tokenlearn Tokenlearn consists of two steps: featurize (create mean token embeddings from a sentence transformer) and train (pre-train a static Model2Vec model using those embeddings as targets)."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"The tokenlearn.featurize CLI builds a featurized dataset from a HuggingFace dataset and saves it as a standard HuggingFace dataset under --output-dir; --push-to-hub can publish that dataset to the Hub.","quotes":["Quickstart Install the package with: pip install tokenlearn Tokenlearn consists of two steps: featurize (create mean token embeddings from a sentence transformer) and train (pre-train a static Model2Vec model using those embeddings as targets)."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"","quotes":["Featurize Use the tokenlearn.featurize CLI … dataset saved to --output-dir ."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Featurize%20Use%20the%20tokenlearn.featurize%20CLI,dataset%20saved%20to%20%2D%2Doutput%2Ddir%20.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"","quotes":["The base model with weighting applied — this is the model to use for downstream tasks."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=The%20base%20model%20with%20weighting%20applied%20%E2%80%94%20this%20is%20the%20model%20to%20use%20for%20downstream%20tasks.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"The repository is MIT-licensed.","quotes":["The original version, used to train the first Potion models ( potion-base-32M , potion-base-8M , potion-base-4M , potion-base-2M ), is described in our original blogpost .","The current version, used to train potion-multilingual-128M , is covered in our Tokenlearn 2.0 post ."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=The%20original%20version%2C%20used%20to%20train%20the%20first%20Potion%20models%20%28%20potion%2Dbase%2D32M%20%2C%20potion%2Dbase%2D8M%20%2C%20potion%2Dbase%2D4M%20%2C%20potion%2Dbase%2D2M%20%29%2C%20is%20described%20in%20our%20original%20blogpost%20.&text=The%20current%20version%2C%20used%20to%20train%20potion%2Dmultilingual%2D128M%20%2C%20is%20covered%20in%20our%20Tokenlearn%202.0%20post%20.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"The repository names PCA and SIF reweighting among techniques associated with Tokenlearn, but does not explain their implementation details here.","quotes":["Note : the code assumes the padding token ID in your tokenizer is 0. If this is not the case, you will need to modify the code."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Note%20%3A%20the%20code%20assumes%20the%20padding%20token%20ID%20in%20your%20tokenizer%20is%200.%20If%20this%20is%20not%20the%20case%2C%20you%20will%20need%20to%20modify%20the%20code.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"","quotes":["Trained with Tokenlearn: distillation, mean-embedding targets, PCA and SIF reweighting."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Trained%20with%20Tokenlearn%3A%20distillation%2C%20mean%2Dembedding%20targets%2C%20PCA%20and%20SIF%20reweighting.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"},{"claim":"For a first check, use the repository’s optional evaluation dependencies and example to run a trained model on test splits.","quotes":["Quickstart Install the package with: pip install tokenlearn Tokenlearn consists of two steps: featurize (create mean token embeddings from a sentence transformer) and train (pre-train a static Model2Vec model using those embeddings as targets)."],"cite_url":"https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.","source_url":"https://github.com/MinishLab/tokenlearn","publisher":"github.com"}]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00/","markdown":"https://newruntime.com/posts/trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00.md","json":"https://newruntime.com/posts/trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00.json"}
markdown_url: "https://newruntime.com/posts/trained-with-tokenlearn-distillation-mean-embedding-targets-pca-e31b00.md"
---

# Trained with Tokenlearn: distillation, mean-embedding targets, PCA and SIF reweighting.

## Retrieval answer

Tokenlearn is a method for pre-training static Model2Vec embedding models.

## Summary

Tokenlearn is a method for pre-training static Model2Vec embedding models. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.))

## What happened

The pipeline has two stages: featurization creates mean token embeddings from a sentence transformer, and training uses those embeddings as targets for a static Model2Vec model. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.)) The `tokenlearn.featurize` CLI builds a featurized dataset from a HuggingFace dataset and saves it as a standard HuggingFace dataset under `--output-dir`; `--push-to-hub` can publish that dataset to the Hub. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Featurize%20Use%20the%20tokenlearn.featurize%20CLI,dataset%20saved%20to%20%2D%2Doutput%2Ddir%20.))

Then `tokenlearn.train` trains on the featurized dataset, and its `--data-path` can point to a HuggingFace Hub repository ID. Training produces a base model and a weighted version; the repository recommends using the weighted model for downstream tasks. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=The%20base%20model%20with%20weighting%20applied%20%E2%80%94%20this%20is%20the%20model%20to%20use%20for%20downstream%20tasks.))

The original version was used to train potion-base-32M, potion-base-8M, potion-base-4M and potion-base-2M; the current version was used for potion-multilingual-128M. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=The%20original%20version%2C%20used%20to%20train%20the%20first%20Potion%20models%20%28%20potion%2Dbase%2D32M%20%2C%20potion%2Dbase%2D8M%20%2C%20potion%2Dbase%2D4M%20%2C%20potion%2Dbase%2D2M%20%29%2C%20is%20described%20in%20our%20original%20blogpost%20.&text=The%20current%20version%2C%20used%20to%20train%20potion%2Dmultilingual%2D128M%20%2C%20is%20covered%20in%20our%20Tokenlearn%202.0%20post%20.)) The repository is MIT-licensed.

## Limits and uncertainty

Check the tokenizer’s padding token ID before training: the code assumes it is 0, and needs modification otherwise. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Note%20%3A%20the%20code%20assumes%20the%20padding%20token%20ID%20in%20your%20tokenizer%20is%200.%20If%20this%20is%20not%20the%20case%2C%20you%20will%20need%20to%20modify%20the%20code.)) The repository names PCA and SIF reweighting among techniques associated with Tokenlearn, but does not explain their implementation details here. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Trained%20with%20Tokenlearn%3A%20distillation%2C%20mean%2Dembedding%20targets%2C%20PCA%20and%20SIF%20reweighting.))

## Skill to build now

Install with `pip install tokenlearn`. ([github.com](https://github.com/MinishLab/tokenlearn#:~:text=Quickstart%20Install%20the%20package%20with%3A%20pip%20install%20tokenlearn%20Tokenlearn%20consists%20of%20two%20steps%3A%20featurize%20%28create%20mean%20token%20embeddings%20from%20a%20sentence%20transformer%29%20and%20train%20%28pre%2Dtrain%20a%20static%20Model2Vec%20model%20using%20those%20embeddings%20as%20targets%29.)) For a first check, use the repository’s optional evaluation dependencies and example to run a trained model on test splits.

## Reader takeaway

Tokenlearn separates training into featurization and model training: first create mean token embeddings as targets, then train a static Model2Vec model from that dataset. Training yields both a base model and a weighted version; the repository recommends the weighted model for downstream tasks. Verify that your tokenizer uses padding ID 0 before running the pipeline.

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Models](https://newruntime.com/topics/models.md): Explore the models topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Sources](https://newruntime.com/sources/): See the original sources this archive cites.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
