惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
罗磊的独立博客
雷峰网
雷峰网
量子位
V
Visual Studio Blog
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
月光博客
月光博客
Martin Fowler
Martin Fowler
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
腾讯CDC
Engineering at Meta
Engineering at Meta
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
Jina AI
Jina AI
A
About on SuperTechFans

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Understanding Embeddings easily.
Daniel Odii · 2026-05-23 · via DEV Community

I've been hearing about embeddings for a while now, and even as someone who's very conversant with using LLMs as a daily driver and for integrating into smart systems, I wasn't really sure what exactly embeddings were and how they connected with everything else.

In this writeup, I'll be unpacking some of the things I've been able to learn about embeddings — what they are and how to use them as a software developer/engineer.


Turning Meanings into Coordinates

Think of embeddings as turning meanings into coordinates. LLMs are not built to — and cannot — understand words the same way humans do, so they convert text into lists of numbers that represent meaning.

Take the word "dog" for example. An LLM wouldn't straightforwardly understand what the word means until it converts it into a group of numbers:

"dog" → [0.21, -0.88, 0.44, ...]

Enter fullscreen mode Exit fullscreen mode

What the Numbers Are NOT Based On

The number of values in an embedding has nothing to do with:

  • Word length
  • Number of letters
  • Number of characters

This is because embeddings don't encode spelling — they encode meaning and features. The embedding size is determined by:

  • The embedding model's architecture
  • How much semantic information the model wants to represent

So the embedding dimension is directly proportional to the model size.

Key Properties

  • Similar meanings end up close together
  • Different meanings end up farther apart

You could say that embeddings are basically "a mathematical location for meaning."


Real-World Analogy

Imagine a large city map:

  • Tailors live in one district
  • Doctors live in another district
  • Developers live in a separate district

Now replace people with words, sentences, documents, or even images. That's basically embeddings!

A few more examples to drive it home:

Pair Relationship
"JavaScript" and "React" Close together
"Needle and thread" and "fashion design" Close together
"Dog" and "cat" Close together
"Bank" (money) and "banana" Far apart

Why Do Embeddings Matter?

Embeddings are what make AI able to:

  • Search semantically — find results based on meaning, not just keywords
  • Recommend similar content
  • Retrieve relevant context
  • Power Retrieval-Augmented Generation (RAG) systems
  • Compare meanings instead of exact words

Case Study: Semantic Search

Without embeddings, AI search would behave like old-school keyword search — returning results based on exact phrase matching.

With embeddings, a query like "How to fix app crashing" would also surface results like:

  • "Application keeps closing"
  • "React Native app freezes"
  • "Unexpected mobile app shutdown"

...because the meanings are close, even if the words are different.


What Can Be Embedded?

Almost anything:

  • Words — e.g., "King"
  • Sentences — e.g., "How to build a React app"
  • Entire documents — e.g., PDFs, docs, chats, codebases, etc.
  • Images — this is how Google reverse image search works

What Happens Behind the Scenes?

The system compares embeddings using similarity/distance metrics:

  • Cosine similarity — measures how similar two embeddings are based on their direction, regardless of size. If two vectors point almost the same way, they likely have similar meaning.
  • Euclidean distance — measures the actual straight-line distance between two embeddings in vector space. A smaller distance means the meanings are closer together.

Applying Embeddings in RAG

Let's look at how embeddings fit into a RAG (Retrieval-Augmented Generation) pipeline. Here's an example: building an enhanced search engine for a company website.

Step 1 → Convert documents into embeddings
         (e.g., PDFs, notes, product catalogs, support docs)

Step 2 → Store them in a vector database
         (e.g., Pinecone, Weaviate, Chroma, PGVector)

Step 3 → A user asks: "How do suppliers onboard?"

Step 4 → The question is converted into an embedding too

Step 5 → The system searches for nearby embeddings
         (semantically similar documents)

Step 6 → Relevant chunks are sent to the LLM

Enter fullscreen mode Exit fullscreen mode

This is essentially how most "Chat with your docs" implementations work.


A Common Misconception

Some people think embeddings store knowledge — but that's not quite right.

Embeddings store:

  • Semantic relationships
  • Meaning patterns

The actual reasoning still happens in the LLM. Embeddings mainly help the model find relevant information, not process it.


Embedding Models

Open-Source / Free

These can be downloaded, run locally, fine-tuned, and used without API costs:

Model Notes
BGE Embeddings Strong general-purpose embeddings
E5 Embeddings Great for retrieval tasks
Sentence Transformers Very popular for semantic search
Hugging Face models Wide variety available

Closed / Paid APIs

These are accessed through APIs and are typically billed per token or request:

Provider Notes
OpenAI Embeddings Widely used, easy to integrate
Cohere Embeddings Strong multilingual support
Voyage AI Embeddings Optimized for retrieval

If you've read to this point — congratulations, you're already on your way to becoming a pro RAG engineer. (Just kidding.)

Thanks for reading through though.