Wo

Wordllama – Things you can do with the token embeddings of an LLM

Hacker News

Wordllama – Things you can do with the token embeddings of an LLM

After working with LLMs for long enough, I found myself wanting a lightweight utility for doing various small tasks to prepare inputs, locate information and create evaluators. This library is two things: a very simple model and utilities that inference it (eg. fuzzy deduplication). The target platform is CPU, and it’s intended to be light, fast and pip installable — a library that lowers the barrier to working with strings semantically . You don’t need to install pytorch to use it, or any deep learning runtimes. How can this be accomplished? The model is simply token embeddings that are average pooled. To create this model, I extracted token embedding (nn.Embedding) vectors from LLMs, concatenated them along the embedding dimension, added a learnable weight parameter, and projected them to a smaller dimension. Using the sentence transformers framework and datasets, I trained the pooled embedding with multiple negatives ranking loss and matryoshka representation learning so they can be truncated. After training, the weights and projections are no longer needed, because there is no contextual calculations. I inference the entire token vocabulary and save the new token embeddings to be loaded to numpy. While the results are not impressive compared to transformer models, they perform well on MTEB benchmarks compared to word embedding models (which they are most similar to), while being much smaller in size (smallest model, 32k vocab, 64-dim is only 4MB). On the utility side, I’ve been adding some tools that I think it’ll be useful for. In addition to general embedding, there’s algorithms for ranking, filtering, clustering, deduplicating and similarity. Some of them have a cython implementation, and I’m continuing to work on benchmarking them and improving them as I have time. In addition to “standard” models that use cosine similarity for some algorithms, there are binarized models that use hamming distance. This is a slightly faster, similarity algorithm, with significantly less memory per embedding (float32 -> 1 bit). Hope you enjoy it, and find it useful. PS I haven’t figured out Windows builds yet, but Linux and Mac are supported.

Share card

Actual performance

370points
36comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, model, new · Missing: agents, macos, agent
87%87% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: para · Missing: supports, reddit linkedin, podcasting
77%77% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: lua, llama, ide · Missing: https docs, excited, just released
62%62% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRFits verified-revenue profile · Strong signals: para · Missing: mobile apps, ios, personal
52%52% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: platform · Missing: plus, intuitive, reviews
48%48% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: arr, training · Missing: mrr, revenue, profit
15%15% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Th
The SC4-HSM is now a FIDO U2F token46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

The SC4-HSM is now a FIDO U2F token

Hacker News3
Jw
Jwt.show – show the payload of a jwt token46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Jwt.show – show the payload of a jwt token

Hacker News1
Cr
CryptoTokens.wtf – Token Whitepapers from Highest Grossing ICOs42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

CryptoTokens.wtf – Token Whitepapers from Highest Grossing ICOs

Hacker News1
To
Token Thermodynamics52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Token Thermodynamics

Hacker News4
LL
LLM Token Visualizer51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

LLM Token Visualizer

Hacker News1
Sa
San Francisco Insider Things to Do60%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

San Francisco Insider Things to Do

Hacker News3
Th
Things to do during Coronavirus outbreak42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Things to do during Coronavirus outbreak

Hacker News2
Shortlist
Shortlist33%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Get Things Done

Indie Hackerscommitment-side-project
Top Three Things
Top Three Things29%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Get. Things. Done.

Indie Hackers2productivity
LL
LLM API proxy with API token rotation32%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

LLM API proxy with API token rotation

Hacker News1