/ Модель

Характеристики

Контекст
1 024 токена
Параметры
71,4 млн
Лицензия
Apache 2.0
Архитектура
hobbylm · MoE
Библиотека
sentence-transformers
Опубликована
20 ноя 2026

hobbylm-embed-140m

ЭмбеддингиТекст → embedding9 профессий

Англоязычная модель Fuel Labs создаёт 512-мерные эмбеддинги для семантического поиска, RAG и анализа сходства текстов.

349скачиваний за 30 дней10лайковвеса обновлены24 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки41

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

  • FEVERHardNegatives

    main_score

    Результат

    0,8309

    MTEB

    Публичная таблицадругая ревизия

  • StackExchangeClusteringP2P.v2

    main_score

    Результат

    0,3943

    MTEB

    Публичная таблицадругая ревизия

  • MindSmallReranking

    main_score

    Результат

    0,2894

    MTEB

    Публичная таблицадругая ревизия

  • ClimateFEVERHardNegatives

    main_score

    Результат

    0,3077

    MTEB

    Публичная таблицадругая ревизия

  • BIOSSES

    main_score

    Результат

    0,8542

    MTEB

    Публичная таблицадругая ревизия

  • Touche2020Retrieval.v3

    main_score

    Результат

    0,5761

    MTEB

    Публичная таблицадругая ревизия

  • ArXivHierarchicalClusteringS2S

    main_score

    Результат

    0,5511

    MTEB

    Публичная таблицадругая ревизия

  • TweetSentimentExtractionClassification

    main_score

    Результат

    0,6373

    MTEB

    Публичная таблицадругая ревизия

  • TwentyNewsgroupsClustering.v2

    main_score

    Результат

    0,3864

    MTEB

    Публичная таблицадругая ревизия

  • MTOPDomainClassification

    main_score

    Результат

    0,9353

    MTEB

    Публичная таблицадругая ревизия

  • TRECCOVID

    main_score

    Результат

    0,6739

    MTEB

    Публичная таблицадругая ревизия

  • TwitterURLCorpus

    main_score

    Результат

    0,8346

    MTEB

    Публичная таблицадругая ревизия

  • AmazonCounterfactualClassification

    main_score

    Результат

    0,9079

    MTEB

    Публичная таблицадругая ревизия

  • MassiveScenarioClassification

    main_score

    Результат

    0,7572

    MTEB

    Публичная таблицадругая ревизия

  • AskUbuntuDupQuestions

    main_score

    Результат

    0,5891

    MTEB

    Публичная таблицадругая ревизия

  • MedrxivClusteringP2P.v2

    main_score

    Результат

    0,3636

    MTEB

    Публичная таблицадругая ревизия

  • MedrxivClusteringS2S.v2

    main_score

    Результат

    0,3488

    MTEB

    Публичная таблицадругая ревизия

  • STS12

    main_score

    Результат

    0,7595

    MTEB

    Публичная таблицадругая ревизия

  • CQADupstackUnixRetrieval

    main_score

    Результат

    0,3993

    MTEB

    Публичная таблицадругая ревизия

  • STS13

    main_score

    Результат

    0,8271

    MTEB

    Публичная таблицадругая ревизия

  • HotpotQAHardNegatives

    main_score

    Результат

    0,6074

    MTEB

    Публичная таблицадругая ревизия

  • SCIDOCS

    main_score

    Результат

    0,1754

    MTEB

    Публичная таблицадругая ревизия

  • BiorxivClusteringP2P.v2

    main_score

    Результат

    0,4148

    MTEB

    Публичная таблицадругая ревизия

  • ArguAna

    main_score

    Результат

    0,5203

    MTEB

    Публичная таблицадругая ревизия

  • SICK-R

    main_score

    Результат

    0,723

    MTEB

    Публичная таблицадругая ревизия

  • SprintDuplicateQuestions

    main_score

    Результат

    0,9224

    MTEB

    Публичная таблицадругая ревизия

  • STS15

    main_score

    Результат

    0,856

    MTEB

    Публичная таблицадругая ревизия

  • STSBenchmark

    main_score

    Результат

    0,823

    MTEB

    Публичная таблицадругая ревизия

  • MassiveIntentClassification

    main_score

    Результат

    0,6854

    MTEB

    Публичная таблицадругая ревизия

  • ArXivHierarchicalClusteringP2P

    main_score

    Результат

    0,6004

    MTEB

    Публичная таблицадругая ревизия

  • FiQA2018

    main_score

    Результат

    0,3814

    MTEB

    Публичная таблицадругая ревизия

  • Banking77Classification

    main_score

    Результат

    0,7963

    MTEB

    Публичная таблицадругая ревизия

  • CQADupstackGamingRetrieval

    main_score

    Результат

    0,552

    MTEB

    Публичная таблицадругая ревизия

  • STS17

    main_score

    Результат

    0,8689

    MTEB

    Публичная таблицадругая ревизия

  • STS14

    main_score

    Результат

    0,7705

    MTEB

    Публичная таблицадругая ревизия

  • ToxicConversationsClassification

    main_score

    Результат

    0,6792

    MTEB

    Публичная таблицадругая ревизия

  • SummEvalSummarization.v2

    main_score

    Результат

    0,2729

    MTEB

    Публичная таблицадругая ревизия

  • ImdbClassification

    main_score

    Результат

    0,8761

    MTEB

    Публичная таблицадругая ревизия

  • StackExchangeClustering.v2

    main_score

    Результат

    0,553

    MTEB

    Публичная таблицадругая ревизия

  • STS22.v2

    main_score

    Результат

    0,6335

    MTEB

    Публичная таблицадругая ревизия

  • TwitterSemEval2015

    main_score

    Результат

    0,6193

    MTEB

    Публичная таблицадругая ревизия

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

HobbyLM-Embed-140M — англоязычная модель эмбеддингов от Fuel Labs, обученная с нуля. Она использует двунаправленный энкодер со sparse Mixture-of-Experts: всего около 140 млн параметров, из них примерно 36 млн активны на токен; выход — плотный вектор размерности 512 для поиска и сравнения текстов. По метаданным модель поддерживает контекст до 1024 токенов; в README указано 512 токенов по умолчанию и протестирована обработка до 2048 токенов.

Модель предназначена для семантического поиска, RAG, оценки сходства, кластеризации и классификации английских текстов. В README приведён результат 62,33 на MTEB(eng, v2), однако часть обучающих данных связана с задачами бенчмарка, а итоговый чекпойнт выбирался по оценкам MTEB. Для поиска нужно использовать префиксы `query: ` и `passage: ` соответственно для запросов и документов. Лицензия Apache-2.0.

Сценарии применения

  • семантический поиск по английским документам
  • поиск фрагментов для англоязычной RAG-системы
  • ранжирование текстов по смысловому сходству
  • кластеризация английских текстов по темам
  • классификация текстов по эмбеддингам

Ограничения

Модель рассчитана только на английский язык, а токенизатор неэффективен для кода и неанглийского текста. Для поиска важны префиксы query и passage; качество на собственных данных следует проверять отдельно, поскольку часть обучающих данных связана с задачами MTEB.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Hugging Face's automatic "Use this model" snippets are not validated for HobbyLM-Embed. Use the snippets on this page, which were tested as written.

Highlights

  • Trained from scratch. The encoder started from random weights and was pretrained on 50B tokens. It was not adapted from BERT, ModernBERT or any other existing encoder.
  • Sparse inside, dense outside. Each token runs through 8 of 32 experts in every MoE layer, with 36M parameters active per token, excluding the embedding table. The output is an ordinary dense 512-d vector that works with any vector database.
  • Officially on MTEB. 62.33 on MTEB(eng, v2), all 41 tasks, scored through the loader merged into the mteb package.
  • Reads long documents. 512 tokens by default; set it to 2,048 and long-document search improves from 36.1 to 49.3 nDCG@10 on LongEmbed.
  • Runs where you are. Sentence Transformers on CPU or GPU, LangChain, LlamaIndex and Chroma, llama.cpp (GGUF), Ollama, and MLX on Apple Silicon.
  • Apache-2.0. Weights, model code and tools.

Model list

ModelFormatLocationNotes
HobbyLM-Embed-140Msafetensors (float32)harims95/hobbylm-embed-140mReference model. Sentence Transformers, LangChain, LlamaIndex, Chroma
HobbyLM-Embed-140M GGUFGGUF F16 (335 MB), Q8_0 (179 MB)harims95/hobbylm-embed-140m-ggufllama.cpp with our helper script: mean cosine 0.99997 (F16) / 0.9994 (Q8_0) vs the reference
HobbyLM-Embed-140M MLXMLX float16 (280 MB)harims95/hobbylm-embed-140m-mlxApple Silicon. Tested on Apple M4: float16 lowest cosine 0.99965 vs the reference
DemoHugging Face Spaceharims95/hobbylm-embed-140m-demoTry it in the browser: ticket routing, duplicates, messy search, long documents
OllamaGGUF Q8_0hariharanms95/hobbylm-embed-140mClose to, but not identical with, the reference (see the Ollama note)
Code and examplesPythonfuellabs-ai/hobbylm-embed-140mModel code, examples, GGUF tools, MLX port, offline tests

Retrieval needs prompts: query: for queries and passage: for documents. Use the same setup for indexing and searching, and don't mix vectors from different runtimes (for example Ollama and Sentence Transformers) in one index.

Model information

ItemValue
Total parameters139,982,848
Embedding parameters25,755,648
Active per token (excl. embeddings, MTEB convention)36,370,432
Active per token (incl. embeddings)62,126,080
Outputdense 512-dimensional vector, L2-normalised
Input length512 tokens by default; up to 2,048 tested
LanguageEnglish
TokenizerGPT-2 byte-level BPE (vocabulary 50,304 padded); one end-of-text token appended
Weightsfloat32 safetensors
LicenceApache-2.0
Architecture componentSetting
Layers12, pre-norm RMSNorm
Width512
Attentionbidirectional, grouped-query (8 query / 2 key-value heads of size 64), QK-norm, RoPE
Layer 0 feed-forwarddense SwiGLU, hidden 1,536
Layers 1–11 feed-forwardsparse MoE: 32 SwiGLU experts (hidden 192), top-8 per token, no shared expert
Routerfloat32 sigmoid scores, auxiliary-loss-free balancing bias (used for selection only), dropless
Poolingmean over tokens, excluding padding and the final end-of-text token; then L2 normalisation

Introduction

Most small embedding models are adapted from an existing encoder. We wanted to build one end to end: the architecture, the pretraining, every embedding stage and the evaluation. HobbyLM-Embed takes the sparse mixture-of-experts design of the HobbyLM model family, makes its attention bidirectional, and trains it from random weights into a general-purpose English embedding model.

The encoder has 140M total parameters, with 36M active per token excluding embeddings, and produces a 512-dimensional dense vector. It is meant to be practical: it runs on a laptop CPU, plugs into the common RAG frameworks, and has GGUF, Ollama and MLX versions for running locally.

Evaluation results

MTEB(eng, v2)

All 41 tasks, scored with mteb 2.27.18 through the official loader, fp32, 512-token inputs, model revision ff263c85. Both the model entry and the results are merged into MTEB (submitted results).

MetricScore
Mean (Task), 41 tasks62.33
Mean (TaskType)57.62
Classification (8 tasks)78.43
Pair classification (3)79.21
Semantic textual similarity (9)79.06
Retrieval (10)50.24
Clustering (8)45.15
Reranking (2)43.93
Summarization (1)27.29
TaskTypeMain metricScore
AmazonCounterfactualClassificationClassificationaccuracy90.79
Banking77ClassificationClassificationaccuracy79.63
ImdbClassificationClassificationaccuracy87.61
MTOPDomainClassificationClassificationaccuracy93.53
MassiveIntentClassificationClassificationaccuracy68.54
MassiveScenarioClassificationClassificationaccuracy75.72
ToxicConversationsClassificationClassificationaccuracy67.92
TweetSentimentExtractionClassificationClassificationaccuracy63.73
SprintDuplicateQuestionsPairClassificationmax_ap92.24
TwitterSemEval2015PairClassificationmax_ap61.93
TwitterURLCorpusPairClassificationmax_ap83.46
BIOSSESSTScosine_spearman85.42
SICK-RSTScosine_spearman72.30
STS12STScosine_spearman75.95
STS13STScosine_spearman82.71
STS14STScosine_spearman77.05
STS15STScosine_spearman85.60
STS17STScosine_spearman86.89
STS22.v2STScosine_spearman63.35
STSBenchmarkSTScosine_spearman82.30
ArguAnaRetrievalndcg_at_1052.03
CQADupstackGamingRetrievalRetrievalndcg_at_1055.20
CQADupstackUnixRetrievalRetrievalndcg_at_1039.93
ClimateFEVERHardNegativesRetrievalndcg_at_1030.77
FEVERHardNegativesRetrievalndcg_at_1083.09
FiQA2018Retrievalndcg_at_1038.14
HotpotQAHardNegativesRetrievalndcg_at_1060.74
SCIDOCSRetrievalndcg_at_1017.54
TRECCOVIDRetrievalndcg_at_1067.39
Touche2020Retrieval.v3Retrievalndcg_at_1057.61
ArXivHierarchicalClusteringP2PClusteringv_measure60.04
ArXivHierarchicalClusteringS2SClusteringv_measure55.11
BiorxivClusteringP2P.v2Clusteringv_measure41.48
MedrxivClusteringP2P.v2Clusteringv_measure36.36
MedrxivClusteringS2S.v2Clusteringv_measure34.88
StackExchangeClustering.v2Clusteringv_measure55.30
StackExchangeClusteringP2P.v2Clusteringv_measure39.43
TwentyNewsgroupsClustering.v2Clusteringv_measure38.64
AskUbuntuDupQuestionsRerankingmap_at_100058.91
MindSmallRerankingRerankingmax_over_subqueries_map_at_100028.94
SummEvalSummarization.v2Summarizationcosine_spearman27.29

How to read these numbers

  • Retrieval tasks use query: / passage: prompts; every other task uses plain text.
  • Fine-tuning used the training splits of some MTEB tasks (never their test splits), and some training text comes from the same source corpora as some MTEB tasks. All of these are declared in the model's MTEB entry: 26 of 41 tasks, so MTEB lists the model as 36% zero-shot.
  • The final checkpoint was selected using MTEB scores.
  • Treat the benchmark mean as optimistic for domains the model has not seen, and evaluate on your own data.

How it compares

Among the 51 models on the MTEB(eng, v2) leaderboard with under 40M active parameters and results on all 41 tasks, HobbyLM-Embed-140M has the 8th-highest average score (Mean (Task)): 62.33.

#ModelMean (Task)Total paramsActive params
1avsolatorio/GIST-small-Embedding-v064.7633.4M21.6M
2codefuse-ai/F2LLM-v2-80M64.5580.1M31.6M
3BAAI/bge-small-en-v1.564.3033.4M21.7M
4abhinand/MedEmbed-small-v0.163.9833.4M21.6M
5MongoDB/mdbr-leaf-mt63.9722.7M11.0M
6RiverRider/motherlode-code-small-en-v0.163.4633.4M21.6M
7thenlper/gte-small63.2233.4M21.6M
8harims95/hobbylm-embed-140m62.33140.0M36.4M
9hotchpotch/bekko-embedding-v1-a25m62.25123.2M24.9M
10ManiacLabs/miniac-embed62.0833.4M21.4M

Method: live MTEB(eng, v2) leaderboard, 24 November 2026; active parameters as MTEB counts them (the registered n_active_parameters_override if set, else total minus embedding parameters); ordered by Mean (Task) over the 41 tasks. HobbyLM-Embed has 140M total parameters and is listed at 36% zero-shot. Full list: CSV.

Long documents

The model reads up to 2,048 tokens when you raise the input length (see Quickstart). On LongEmbed's four real long-document retrieval tasks:

LongEmbed task (nDCG@10)5121,0242,048
NarrativeQA16.1516.5418.16
QMSum21.6027.9432.10
2WikiMultihopQA48.0955.1462.30
SummScreenFD58.4174.1684.77
Average36.0643.4449.33
  • On synthetic tests where one fact is hidden in a 2,048-token document, accuracy@1 rises from 22% to 96% (passkey) and from 24% to 82% (needle). At 512 the model only sees facts in the first 512 tokens.
  • On MTEB(eng, v2) the 40-task mean is unchanged at 2,048 (63.16 → 63.14), but similarity between long news articles (STS22) drops by 1.7 points. That is why 512 stays the default and 2,048 is a one-line option for long-document search.
  • The final fine-tuning stage used inputs of at most 256 tokens; lengths beyond 2,048 are not tested.

Training recipe

Four stages, each starting from the previous one's weights. Data sources are described by type; mixtures, preparation details and training code are not released.

StageWhat it teachesData
1. Masked-token pretrainingLanguage, from random weights (50B tokens, sequences up to 1,024)Filtered web text, educational and scientific documents, Wikipedia, StackExchange, synthetic question–answer text and code; deduplicated and decontaminated against the MTEB(eng, v2) test sets
2. Contrastive pair trainingWhat "related" means (about 20M pairs)Public question–answer, title–body, paraphrase and citation pairs
3. Distillation (short)Light alignment to larger embedding modelsTeacher-scored public texts
4. Supervised fine-tuningTask skills, with teacher-mined hard negativesPublic labelled data for retrieval, NLI, paraphrase, classification and clustering, including MTEB training splits; synthetic training triplets

What mattered most:

  • Measuring correctly. Scoring in fp32 and averaging clustering over several seeds removed noise that was larger than the effects we were testing.
  • Matching training and use. Short prompts the model saw in training help; long unseen instructions hurt a mean-pooled model.
  • Choosing data by measurement. Testing pair sources one at a time showed that some popular sources made out-of-domain retrieval worse.

Quickstart

Sentence Transformers

pip install -U sentence-transformers
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("harims95/hobbylm-embed-140m", revision="ea708cee107818fa0c1871eebd26d82a1e3fb1aa",
                            trust_remote_code=True)

queries = ["how do vaccines work?"]
passages = [
    "Vaccines train the immune system to recognise a pathogen without causing the disease.",
    "The Eiffel Tower was completed in 1889.",
]

q = model.encode_query(queries)        # adds "query: "
p = model.encode_document(passages)    # adds "passage: "
print(q.shape)                         # (1, 512)
print(model.similarity(q, p))          # tensor([[0.6537, 0.2375]])
  • trust_remote_code=True is required: the MoE encoder is custom code shipped in this repo.
  • encode_query / encode_document (or prompt_name="query" / "passage") add the prompts. Typing them yourself gives the same vector; never do both.
  • For similarity, clustering and classification, use plain model.encode(texts).
  • Embeddings are L2-normalised, so cosine similarity equals the dot product.

Long documents (up to 2,048 tokens)

model.max_seq_length = 2048

Use it for long-document search (contracts, transcripts, reports). Longer inputs are slower to encode; chunk anything longer than 2,048 tokens.

LangChain, LlamaIndex and Chroma

Every snippet below was run exactly as written on CPU, each in a new virtual environment with an empty Hugging Face cache, with the model pinned to revision ea708cee107818fa0c1871eebd26d82a1e3fb1aa. langchain-hobbylm, LlamaIndex and Chroma give the same vectors as Sentence Transformers (cosine 1.000000 on 2 prompted queries and 2 prompted passages, and on a 5,098-token passage at 2,048 tokens); langchain-huggingface does for single-line text (see its note). As everywhere, queries need query: and documents need passage: . The LlamaIndex and Chroma snippets use these texts (the LangChain snippets define them inline):

QUERIES = ["how do vaccines work?", "what is the capital of france"]
PASSAGES = ["Vaccines train the immune system to recognise a pathogen without causing the disease.",
            "Paris is the capital and largest city of France."]

LangChain

Recommended: langchain-hobbylm 0.1.1. It sets the query / passage prompts and pins the model revision for you. Tested 23 Nov 2026 (Linux, Python 3.12.16, new venv, empty Hugging Face cache): langchain-hobbylm 0.1.1, langchain-core 1.8.4, sentence-transformers 6.3.0, transformers 5.24.0, torch 2.15.0, huggingface-hub 2.4.0, numpy 2.5.5.

pip install langchain-hobbylm
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_hobbylm import HobbyLMEmbeddings

embeddings = HobbyLMEmbeddings(revision="ea708cee107818fa0c1871eebd26d82a1e3fb1aa")

queries = ["how do vaccines work?", "what is the capital of france"]
passages = ["Vaccines train the immune system to recognise a pathogen without causing the disease.",
            "Paris is the capital and largest city of France."]

q = [embeddings.embed_query(t) for t in queries]   # "query: " prompt
p = embeddings.embed_documents(passages)           # "passage: " prompt
print("dims", len(q[0]), "norms", [round(sum(x * x for x in v) ** 0.5, 4) for v in q + p])

store = InMemoryVectorStore.from_texts(passages, embedding=embeddings)
for t in queries:
    print(t, "->", store.similarity_search(t, k=1)[0].page_content)

Output (real run):

dims 512 norms [1.0, 1.0, 1.0, 1.0]
how do vaccines work? -> Vaccines train the immune system to recognise a pathogen without causing the disease.
what is the capital of france -> Paris is the capital and largest city of France.

The vectors are identical to Sentence Transformers (cosine 1.000000 on both queries and both passages), with no "new version ... malicious code" warning. Long documents: HobbyLMEmbeddings(revision="ea708cee107818fa0c1871eebd26d82a1e3fb1aa", model_kwargs={"tokenizer_kwargs": {"model_max_length": 2048}}) (tested on a 5,098-token passage: 512-d, norm 1.0, cosine 1.000000 vs Sentence Transformers with max_seq_length = 2048).

Alternative: langchain-huggingface. Tested the same way: langchain-huggingface 1.2.3, langchain-core 1.8.4, sentence-transformers 6.3.0, transformers 5.24.0, torch 2.15.0, huggingface-hub 1.33.0, numpy 2.5.5.

pip install langchain-huggingface sentence-transformers
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_huggingface import HuggingFaceEmbeddings

embeddings = HuggingFaceEmbeddings(
    model_name="harims95/hobbylm-embed-140m",
    model_kwargs={"trust_remote_code": True, "revision": "ea708cee107818fa0c1871eebd26d82a1e3fb1aa"},
    query_encode_kwargs={"prompt_name": "query"},
    encode_kwargs={"prompt_name": "passage"},
)

queries = ["how do vaccines work?", "what is the capital of france"]
passages = ["Vaccines train the immune system to recognise a pathogen without causing the disease.",
            "Paris is the capital and largest city of France."]

q = [embeddings.embed_query(t) for t in queries]
p = embeddings.embed_documents(passages)
print("dims", len(q[0]), "norms", [round(sum(x * x for x in v) ** 0.5, 4) for v in q + p])

store = InMemoryVectorStore.from_texts(passages, embedding=embeddings)
for t in queries:
    print(t, "->", store.similarity_search(t, k=1)[0].page_content)

Output (real run):

dims 512 norms [1.0, 1.0, 1.0, 1.0]
how do vaccines work? -> Vaccines train the immune system to recognise a pathogen without causing the disease.
what is the capital of france -> Paris is the capital and largest city of France.

langchain-huggingface replaces line breaks with spaces before encoding, so multi-line documents get slightly different vectors than Sentence Transformers (cosine about 0.97 on our long test). Use langchain-hobbylm for identical vectors.

Long documents: add "tokenizer_kwargs": {"model_max_length": 2048} to model_kwargs (the setting takes effect: on the text it actually encodes, with line breaks replaced, the vector is identical to Sentence Transformers at 2,048 tokens).

LlamaIndex

Tested 23 Nov 2026 in a new venv with an empty Hugging Face cache: llama-index-embeddings-huggingface 0.9.0, llama-index-core 0.14.26, sentence-transformers 6.3.0, transformers 5.24.0, torch 2.15.0, huggingface_hub 2.4.0, numpy 2.5.5, Python 3.12, CPU. LlamaIndex sets its own prompts, so the model's prompts go in query_instruction (queries) and text_instruction (documents). The revision is pinned, so no "new version ... malicious code" warning appears.

pip install llama-index-embeddings-huggingface
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
embed = HuggingFaceEmbedding(model_name="harims95/hobbylm-embed-140m",
                             revision="ea708cee107818fa0c1871eebd26d82a1e3fb1aa",
                             trust_remote_code=True, device="cpu",
                             query_instruction="query: ", text_instruction="passage: ")
q = [embed.get_query_embedding(t) for t in QUERIES]
p = embed.get_text_embedding_batch(PASSAGES)

print("dims", len(q[0]), "norms", [round(sum(x * x for x in v) ** 0.5, 4) for v in q + p])
for t, v in zip(QUERIES, q):
    scores = [sum(a * b for a, b in zip(v, d)) for d in p]
    print(t, "->", PASSAGES[scores.index(max(scores))])

Output (real run):

dims 512 norms [1.0, 1.0, 1.0, 1.0]
how do vaccines work? -> Vaccines train the immune system to recognise a pathogen without causing the disease.
what is the capital of france -> Paris is the capital and largest city of France.

The vectors are identical to Sentence Transformers (cosine 1.000000 on both queries and both passages). Long documents: add max_length=2048 to HuggingFaceEmbedding(...) (tested the same way on a 5,098-token passage: 512-d, norm 1.0, cosine 1.000000 vs Sentence Transformers with max_seq_length = 2048).

Chroma

Tested 23 Nov 2026 in a new venv with an empty Hugging Face cache: chromadb 1.5.9, sentence-transformers 6.3.0, transformers 5.24.0, torch 2.15.0, huggingface_hub 2.4.0, numpy 2.5.5, Python 3.12, CPU. Chroma's embedding function has no query/document setting, so the prompts are added to the texts: query: for queries and passage: for documents. The revision is pinned, so no "new version ... malicious code" warning appears.

pip install chromadb sentence-transformers
import chromadb
from chromadb.utils.embedding_functions import SentenceTransformerEmbeddingFunction
ef = SentenceTransformerEmbeddingFunction(model_name="harims95/hobbylm-embed-140m",
                                          revision="ea708cee107818fa0c1871eebd26d82a1e3fb1aa",
                                          trust_remote_code=True, device="cpu")
q = ef(["query: " + t for t in QUERIES])
p = ef(["passage: " + t for t in PASSAGES])
print("dims", len(q[0]), "norms", [round(float((v * v).sum()) ** 0.5, 4) for v in q + p])

# end to end: in-memory collection, cosine space
col = chromadb.Client().create_collection("demo", embedding_function=ef, metadata={"hnsw:space": "cosine"})
col.add(ids=["vaccines", "paris"], documents=["passage: " + t for t in PASSAGES])
res = col.query(query_texts=["query: " + t for t in QUERIES], n_results=1)
print("top result per query:", res["ids"])

Output (real run):

dims 512 norms [1.0, 1.0, 1.0, 1.0]
top result per query: [['vaccines'], ['paris']]

The vectors are identical to Sentence Transformers (cosine 1.000000 on both queries and both passages). Long documents: add tokenizer_kwargs={"model_max_length": 2048} to SentenceTransformerEmbeddingFunction(...) (tested the same way on a 5,098-token passage: 512-d, norm 1.0, cosine 1.000000 vs Sentence Transformers with max_seq_length = 2048). Chroma keeps one loaded model per model_name in a Python process, so create the 2,048 version in a new process, not after a 512 one.

device="cpu" can be dropped on a CPU-only machine or changed to "cuda".

llama.cpp (GGUF)

1. Build llama.cpp (release v1.0.0, CPU)

git clone --depth 1 --branch v1.0.0 https://github.com/ggml-org/llama.cpp
cd llama.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=ON -DLLAMA_CURL=OFF -DLLAMA_BUILD_TESTS=OFF
cmake --build build -j 14 --target llama-embedding llama-quantize

Output (last lines):

[100%] Built target llama-common
[100%] Built target llama-embedding
[100%] Built target llama-quantize

2. Get the GGUF and the helper

pip install -U huggingface_hub
hf download harims95/hobbylm-embed-140m-gguf hobbylm-embed-140m-f16.gguf hobbylm-embed-140m-q8_0.gguf hobbylm_llamacpp_embed.py --local-dir .
sha256sum hobbylm-embed-140m-f16.gguf hobbylm-embed-140m-q8_0.gguf hobbylm_llamacpp_embed.py

Output:

7ecb311d06ac5f20e560dbf3ca2f92cd5a364ab7326cee7381f8abad90f77339 *hobbylm-embed-140m-f16.gguf
e192e27ce562a2e19e8980afcb1729b1a53ec1eee284be6ac3039cfea923a957 *hobbylm-embed-140m-q8_0.gguf
d8dd27990663dbe9a60e12f64e989f2bf70c4cff4cc7c00a6760930838454414 *hobbylm_llamacpp_embed.py

If the first download fails, retry. Step 3 uses the F16 file; for Q8_0, pass --model hobbylm-embed-140m-q8_0.gguf.

3. Embed texts

The helper needs only Python 3 (standard library). It runs llama-embedding --pooling none and pools the way the model was trained: the mean of the text tokens, excluding the final end-of-text token, then L2 normalisation.

printf "what is the capital of france\n" > queries.txt
printf "Paris is the capital and largest city of France.\nThe mitochondria is the powerhouse of the cell.\n" > passages.txt
B=./llama.cpp/build/bin/llama-embedding
python3 hobbylm_llamacpp_embed.py --bin $B --model hobbylm-embed-140m-f16.gguf --mode query queries.txt > q.jsonl
python3 hobbylm_llamacpp_embed.py --bin $B --model hobbylm-embed-140m-f16.gguf --mode passage passages.txt > p.jsonl
cut -c1-120 q.jsonl
python3 -c "
import json
q=[json.loads(l) for l in open('q.jsonl')]; p=[json.loads(l) for l in open('p.jsonl')]
for d in p: print(round(sum(a*b for a,b in zip(q[0]['embedding'], d['embedding'])),4), d['text'])
"

Output:

{"text": "what is the capital of france", "embedding": [0.0119629, -0.0288813, -0.0404069, -0.0176782, 0.0519803, 0.0387
0.7309 Paris is the capital and largest city of France.
0.378 The mitochondria is the powerhouse of the cell.
  • --mode query / --mode passage for retrieval; --mode none for similarity, classification and clustering.
  • One text per line; texts are stripped. The GGUF files are tested at 512 tokens; their context limit is 1,024 tokens. For long documents (up to 2,048 tokens) use Sentence Transformers with model.max_seq_length = 2048. llama.cpp does not truncate, so shorten longer texts yourself.

llama.cpp's built-in mean pooling includes the end-of-text token, so use the helper script for exact embeddings.

Ollama

ollama pull hariharanms95/hobbylm-embed-140m
curl http://localhost:11434/api/embed -d '{
  "model": "hariharanms95/hobbylm-embed-140m",
  "input": ["query: how do vaccines work?",
            "passage: Vaccines train the immune system to recognise a pathogen without causing the disease."]
}'

The response holds one 512-d, L2-normalised vector per input under "embeddings". As with the other runtimes, prefix retrieval queries with query: and documents with passage: , and use plain text for similarity, clustering and classification. The model runs with num_ctx 512.

Ollama's pooling includes the final end-of-text token, so its vectors are close to but not identical with the reference model: on normal sentences cosine is about 0.99 and task scores stay within ±0.4, but very short texts (one or two words) differ most (cosine about 0.92–0.97). Don't mix Ollama vectors with exact vectors in one index.

MLX (Apple Silicon)

pip install mlx tokenizers numpy huggingface_hub
import sys
from huggingface_hub import snapshot_download

path = snapshot_download("harims95/hobbylm-embed-140m-mlx")
sys.path.insert(0, path)
from hobbylm_mlx import Encoder

enc = Encoder(path, quant_dir=path)
q = enc.encode(["what is the capital of france"], prompt_name="query")
p = enc.encode(["Paris is the capital and largest city of France."], prompt_name="passage")
print(q @ p.T)   # vectors are L2-normalised: this is cosine similarity

Long documents (up to 2,048 tokens):

enc = Encoder(path, quant_dir=path, max_seq_length=2048)

Compatibility

RuntimeStatus
Sentence Transformers✅ tested (reference)
langchain-hobbylm / LlamaIndex / Chroma✅ tested, identical vectors
langchain-huggingface✅ tested; line breaks become spaces, so multi-line texts differ slightly
llama.cpp (GGUF F16 / Q8_0)✅ tested with our helper script
Ollama✅ tested, close but not identical
MLX (Apple Silicon, float16)✅ tested on Apple M4
Hugging Face Transformerssee the examples in the GitHub repo
LM Studionot supported yet

Limitations and disclaimer

  • English only. The GPT-2 tokenizer is also inefficient for code and non-English text.
  • Prompts matter. Retrieval needs query: / passage: ; mixing prompted and unprompted vectors in one index degrades results.
  • Input length. 512 tokens by default; up to 2,048 tested on LongEmbed; longer inputs are slower and nothing beyond 2,048 is tested.
  • Custom code. Loading requires trust_remote_code=True. The reference implementation runs experts in a loop, so batching texts together is much faster than encoding them one at a time.
  • Benchmark context. The MTEB score includes tasks whose training splits were used, and the checkpoint was selected on MTEB. Evaluate on your own data before relying on it.
  • No guarantees. Embeddings can reflect biases in public web and labelled data. The model is provided as is, without warranty.

License

ItemLicence
Model weightsApache-2.0
Model code (modeling_hobbylm.py, configs)Apache-2.0
GGUF tools and helper scriptMIT
MLX portApache-2.0

Training data notes

The model was trained on public datasets and on text generated by openly licensed models. Training data is not redistributed with this model, and third-party data remains under its own licences.

Credits

Built at Fuel Labs by Hariharan M. S. and Prabhurajhan R.

The architecture was designed by Harish Santhanalakshmi Ganesan for the HobbyLM model family (arXiv:2610.34582).

We thank Jarvis Labs for providing the compute for this work.

Citation

@misc{hobbylmembed2026,
  title  = {HobbyLM-Embed: Training a Sparse Mixture-of-Experts Text Embedding Model from Scratch},
  author = {Hariharan M. S. and Prabhurajhan R.},
  year   = {2026},
  url    = {https://huggingface.co/harims95/hobbylm-embed-140m}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · sentence-transformers

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
HobbyLMModel
Ревизия весов
21736fa

0 моделей