Free · WaitlistJoin the waitlist for the free 2-day Vibecoding & AI Agents Intensive (autonomous Hermes + DeepSeek agent · led by Jemal Hamidun, Head of AI at Alpina Digital & MIPT)Join the waitlist →
ReleaseInsight · On RadarMachine Learning Mastery→ original

A Simple 500-Text Test: BGE Small Separated Topics 1.7 Times More Cleanly Than MiniLM

How do you choose an embedding model without building an entire RAG pipeline? Check how clearly it sorts documents by topic. In a Machine Learning Mastery guide, two models with 384-number vectors were run on 500 English-language posts from four topics. BGE Small scored 0.158 on clustering quality (silhouette), while all-MiniLM-L6-v2 scored 0.091, which makes BGE Small 1.7 times cleaner. Before choosing a model, run a script like this on your own texts.

AI-processed from Machine Learning Mastery; edited by Hamidun News
A Simple 500-Text Test: BGE Small Separated Topics 1.7 Times More Cleanly Than MiniLM
Source: Machine Learning Mastery. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceMachine Learning Mastery ↗
Editor-in-Chief
Key metric #1One million 1536-number vectors in float32 take about 6 GB of memory
Key metric #2Scalar quantization cuts memory by 4x, binary quantization by 32x
Key metric #3Many open models have a 512-token context; newer ones offer 8192+

Every semantic search and every RAG system starts with one decision: which model will turn text into vectors. An embedding is a set of numbers, the "coordinates" of a phrase's meaning, so texts with similar meanings end up close together. Pick the wrong model and search returns the wrong documents, while your memory bill grows. A Machine Learning Mastery guide offers a quick way to check the choice: instead of building the full pipeline, look at how clearly the model separates your texts by topic.

The title contains two numbers. "500 texts" refers to the first 500 posts from the 20newsgroups teaching dataset, covering four topics: computer graphics, space, cars, and politics. "1.7 times" is the ratio of two clustering scores, called silhouette coefficients: 0.1582 for BAAI/bge-small-en-v1.5 versus 0.0909 for all-MiniLM-L6-v2. The silhouette scale runs from −1 to 1. The higher the value, the more tightly texts of one topic group together and the farther they sit from other topics.

Four differences to watch

Vector dimensionality. This is the number of values the model outputs for each text. The lightweight all-MiniLM-L6-v2 produces 384 numbers, the mid-sized all-mpnet-base-v2 produces 768, and large commercial APIs produce 1536 or more. A longer vector captures more nuance, but it is more expensive to store.

Context length. This is the maximum number of tokens a model processes at once. Many open models cap it at 512, some lightweight ones at 256, and newer and commercial models at 8192 or more. If a document is longer, it gets split into chunks, and the meaning can break mid-sentence.

Multilingual support. Most standard models are built for English. Multilingual ones, such as paraphrase-multilingual-mpnet-base-v2, place dozens of languages in a single vector space. This lets you search Japanese documents with a Spanish query without an intermediate translation step.

Specialization. A general-purpose model handles legal contracts, medical reports, and source code less well. Those texts need models fine-tuned on domain vocabulary; otherwise, rare terms will be misunderstood.

What it costs in memory

Dimensionality directly determines RAM usage. Take a million documents and a vector of 1536 numbers, where each number is 32-bit (4 bytes). That gives 1,000,000 × 1536 × 4 bytes, or about 6 GB, before any search index overhead.

To fit a budget, teams apply quantization: numbers are stored with less precision. Scalar quantization converts 32-bit numbers into 8-bit integers and saves 4x the memory. Binary quantization is more aggressive: each number becomes a single bit, and memory drops 32x. It is less accurate and works best with models trained for binary embeddings, but it is considerably faster, and for some tasks the quality is good enough.

Using the article's formula for our million documents, scalar quantization comes to roughly 1.5 GB and binary quantization to about 200 MB. We calculated these two figures ourselves; the author does not provide them.

How the test works and what it showed

The test requires the scikit-learn and sentence-transformers libraries, the latter providing free pretrained models. The script loads 500 posts with known topics, builds an embedding for each, and computes the silhouette score using cosine distance. Both models have 384 dimensions but were trained differently, and both run on an ordinary CPU.

The results: all-MiniLM-L6-v2 scored 0.0909, and BGE Small scored 0.1582. The gap is about 0.07. The absolute values are modest because the texts are noisy: the posts are full of signatures, quotes, and off-topic chatter. Still, on identical data, the comparison shows which model separates topics more effectively.

The author believes BGE Small was trained as a "retrieval specialist," while MiniLM was trained as a generalist for overall sentence similarity. As a result, on messy topical text, the generalist is more easily distracted by common boilerplate vocabulary. This is the author's assumption, not a verified fact.

What follows and where the limits are

The practical takeaway is simple: compare candidates on your own data, not just on leaderboards. Identical dimensionality does not guarantee identical quality. It is also worth calculating memory use and quantization effects before going to production.

The caveats are significant. The test is small: 500 texts, four clearly distinct topics, English only. The silhouette score measures clustering, not search quality, so a final RAG decision requires running on real queries. The article does not measure how quantization affects accuracy. This is more of a practical guide for those choosing a first or new embedding model than a research study. But the example is short, reproducible, and saves time at the start.

Story

Key Questions Answered

What are the key details on Four differences to watch?

Vector dimensionality. This is the number of values the model outputs for each text. The lightweight all-MiniLM-L6-v2 produces 384 numbers, the mid-sized all-mpnet-base-v2 produces 768, and large commercial APIs produce 1536 or more. A longer vector captures more nuance, but it is more expensive to store. Context length. This is the maximum number of tokens a model processes at once. Many open models cap it at 512, some lightweight ones at 256, and newer and commercial models at 8192 or more.

What it costs in memory?

Dimensionality directly determines RAM usage. Take a million documents and a vector of 1536 numbers, where each number is 32-bit (4 bytes). That gives 1,000,000 × 1536 × 4 bytes, or about 6 GB, before any search index overhead. To fit a budget, teams apply quantization: numbers are stored with less precision. Scalar quantization converts 32-bit numbers into 8-bit integers and saves 4x the memory. Binary quantization is more aggressive: each number becomes a single bit, and memory drops 32x.

How the test works and what it showed?

The test requires the scikit-learn and sentence-transformers libraries, the latter providing free pretrained models. The script loads 500 posts with known topics, builds an embedding for each, and computes the silhouette score using cosine distance. Both models have 384 dimensions but were trained differently, and both run on an ordinary CPU. The results: all-MiniLM-L6-v2 scored 0.0909, and BGE Small scored 0.1582. The gap is about 0.07.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…