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

推荐订阅源

S
Secure Thoughts
雷峰网
雷峰网
罗磊的独立博客
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Cisco Talos Blog
Cisco Talos Blog
Engineering at Meta
Engineering at Meta
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
D
DataBreaches.Net
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
U
Unit 42
Security Latest
Security Latest
M
MIT News - Artificial intelligence
月光博客
月光博客
Scott Helme
Scott Helme
G
Google Developers Blog
有赞技术团队
有赞技术团队
T
Tor Project blog
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - Franky
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
V
V2EX
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Securelist
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
TaoSecurity Blog
TaoSecurity Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
腾讯CDC
D
Docker
Google Online Security Blog
Google Online Security Blog

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 Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Embedding 685 million texts in 32 minutes
Coach Danis · 2026-05-21 · via DEV Community

My embedding pipeline used to take many hours. I'd kick it off, go do other work, come back, find a problem in the output, fix it, run it again. A single version of my semantic pipeline took three or four full runs before I was happy with it. That's a full working day burned on plumbing before the actual model work even starts.

Most embedding infrastructure is built to serve requests. I needed something different: a file-to-file engine that could keep eight GPUs busy until the corpus was done.

Now it takes 32 minutes. 357,893 msg/s sustained on 8x A100s, 2.6x faster than TEI in the reproducible benchmark, $6.75 in spot compute for the full production run.

Why I needed this

I'm building a behavioral intelligence model that needs semantic representations of public text. Think LinkedIn's "People You May Know," but generalized to open questions about a population. Who's emerging in the Rust scene, which ideas are gaining momentum among the people building the next decade.

The model needs semantic features from a large corpus of public text. Billions of raw messages. After filtering bots, deleted accounts, and noise, hundreds of millions of usable texts. Every one of them has to be embedded before the model ever sees it.

The part that bit me was iteration. You don't run an embedding pipeline once. You run it, look at the output, realize your filtering is wrong, fix it, run again. Change the model, run again. A single "version" is three-to-five full passes before you're happy with it. Whatever your wall-clock time is, multiply by at least four. That's the real cost.

What I tried first

I started with a Python pipeline running multilingual-e5-small on 8x A100s. PyTorch with BF16 for inference, HuggingFace tokenizers, manual multi-GPU dispatch, JSONL in and .npy out. This was already heavily optimized: stock sentence-transformers.encode() only gets about 2,500 msg/s on a single A100 (CPU tokenization bottlenecks the whole thing), so the custom batching and dispatch was doing 14x that out of the box. First fully optimized run came in around 35K msg/s, about 3+ hours wall clock on the full corpus. Over the next few weeks I pushed it to ~45K. That was the ceiling.

The deeper problem only showed up after four full runs. Every new dataset wanted its own optimization pass: different file shapes, different size distributions, different bottlenecks. The throughput was bad. Instability made it worse. I'd push it to 45K on one corpus, add a new source, and watch it regress to 37K. I was spending time re-tuning a pipeline that was too slow even when perfectly tuned.

I spent a day on landscape research: docs, design notes, GitHub issues, back-of-envelope throughput math. The closest off-the-shelf option was HuggingFace's Text Embeddings Inference (TEI), the obvious choice for embedding throughput. But TEI is a server. Every batch goes through an HTTP interface, the architecture built around answering API calls, not chewing through files on disk. OpenAI: $932 per pass, around $4K to validate a single pipeline change. Triton: another serving stack, gRPC overhead, complex deployment. candle: Rust, native, right direction, but not the TensorRT-style compiled inference path I needed.

After that pass, I stopped thinking of this as a "faster inference" problem. Everything I found assumed you were serving embeddings to clients. I was trying to produce them from a corpus. Different problem, different architecture.

What I needed was physical and boring: read hundreds of huge compressed files, extract text, embed every line, and write output with every CPU core pinned, every byte of RAM doing useful work, and every GPU saturated. No idle hardware anywhere in the chain. If I'm paying for an 8-GPU box by the hour, every component should be earning its keep.

Hitting the wall

On the last day with Python I threw the kitchen sink at it. Five attempts, four failures and one tiny win:

  • Multi-stream CUDA. Theory: threads release the GIL during the GPU forward pass, so data prep overlaps across streams. Reality: tensor creation, .to(device), and the tokenizer wrappers all hold the GIL for ~100ms between launches. Only one or two GPUs were ever active at once. No measurable gain.
  • torch.compile. CUDA graphs are shape-specific, so every new padded length triggered a multi-minute recompilation. Some runs came in nearly 3x slower than baseline. 64 simultaneous compilations across 8 GPUs hung a 96-vCPU machine for over an hour. Net negative.
  • ONNX Runtime with the TensorRT execution provider. ORT needs specific CUDA libraries on LD_LIBRARY_PATH, but PyTorch installs CUDA under non-standard pip paths ORT can't see. ORT silently fell back to its CPU executor (100x slower, indistinguishable from a hang) and I lost an hour before catching it.
  • SDPA / Flash Attention. Already on by default in transformers 4.48. No improvement.
  • Double-buffer pipeline. Tokenize the next chunk while inference runs on the current one. A real 10% gain. The only thing that moved the needle.

That night I wrote a retrospective. The diagnosis was structural, not tunable. The inference tooling available in Python is good at single-process model calls and latency-sensitive serving. Batch embedding at scale (millions of texts, eight GPUs, throughput-only) is neither. The GIL serializes every CPU-side operation. Library boundaries create version-coupling problems. Abstractions hide failures. For a 33M-parameter model where CPU work is 25-30% of total time, no amount of tuning gets past that ceiling. You have to leave Python.

What changed when I left Python

The constraint wasn't inference speed. It was system boundaries. In Python, I was orchestrating GPU inference through layers of abstraction: framework APIs, runtime sessions, serialization between processes. Each boundary adds latency that's easy to miss in a profile but obvious when GPUs are waiting for work.

Rust gave me one process controlling everything: file reading, tokenization, batching, multi-GPU dispatch, inference, and output. No GIL. No IPC. No abstraction between "prepare the batch" and "run inference." When you own the whole path in one address space, you can keep hardware saturated in ways that no amount of Python optimization allows.

I set targets before writing code: 3x conservative, 5x optimistic. Then I built the smallest thing that could prove or kill the idea. One long push: start single-threaded, measure, parallelize one stage, measure again. Started at 10K msg/s, hit 196K by dinner. Past the optimistic target.

Then I profiled ONNX Runtime's session.run(): 160ms per call, only 10ms was actual GPU compute. Wrote a C++ wrapper around TensorRT's native API, called it from Rust via FFI. With correct batch sizing: 265K msg/s on 8x A100. 5x the Python baseline.

The prototype proved the architecture. I committed a clean break: moved it to prototype/ and started the real engine from scratch. Next day: proper library plus thin CLI. Pointed it at the full corpus and watched it sustain 245K msg/s for over an hour. Three days to prove it could be done. One more to make it reusable. The remaining week and a half was optimization, hardening, and benchmarking.

The bottleneck nobody warns you about

At 8 GPUs, when you're pushing 250K+ messages per second through inference, the bottleneck moves to the CPU. Not a metaphor. Literally.

250K tokenization calls per second on the CPU side. If you can't keep up, GPUs idle. You're paying for 8 A100s and they're waiting for work.

Model 1 GPU 8 GPU Scaling
e5-small-v2 50,127 253,578 5.1x
multilingual-e5-small 41,842 253,950 6.1x
multilingual-e5-base 17,319 122,169 7.1x
multilingual-e5-large 5,610 41,668 7.4x

e5-large gets 7.4x scaling from 8 GPUs. e5-small only gets 5.1x. With a small fast model, the GPUs finish their work before the CPU can prep the next batch. With a larger model, inference is slow enough that the CPU stays ahead easily.

The fix was architectural. Lock-free queues between every pipeline stage, one process driving all GPUs:

reader → tokenizer → batcher → GPU workers → writer

Enter fullscreen mode Exit fullscreen mode

Every stage concurrent. While the tokenizer prepares batch N+1, the GPUs run batch N, and the writer flushes batch N-1 to disk. The work after the prototype was keeping GPUs fed well enough that they're never sitting idle.

What IgniteMS does differently

IgniteMS is not an embedding server. It's a batch engine.

It owns the entire path: reading compressed input, tokenization, batching, multi-GPU dispatch, TensorRT inference, and writing output. No HTTP. No container-per-GPU stack. No inter-process communication. One process, lock-free, file-to-file.

This is the boring part that matters. At this scale, the overhead between stages is the product. Every serialization boundary, every context switch, every idle millisecond waiting for work compounds across hundreds of millions of texts. When you own the whole pipeline in one address space, those overheads stop dominating the run.

The numbers

Reproducible benchmark (1M MSMARCO passages, e5-small-v2, 8x A100 p4d):

Engine 1 GPU 8 GPU
IgniteMS 50,127 msg/s 253,578 msg/s
Hugging Face TEI 16,648 msg/s 96,492 msg/s
SentenceTransformers ~2,500 msg/s n/a

3x faster than TEI per GPU. 2.6x faster across all 8. Reproducible with python3 benchmark.py on the same hardware, data, and model.

Production run (real workload, not synthetic):

  • 685,520,494 messages embedded
  • 357,893 msg/s sustained (506K peak, 196K low on dense files)
  • 31.9 minutes wall clock
  • 1x p4d.24xlarge (8x A100 40GB), spot instance

Real social-media text. Variable length, multiple languages, messy formatting.

Cost: $6.75 at spot pricing. Embedding the same number of texts with OpenAI text-embedding-3-small: $932. That's $0.01 per million messages vs $1.36 per million.

What it doesn't do

  • Batch only. IgniteMS is for offline corpus embedding. If you need low-latency request/response serving today, use TEI, Triton, or another serving stack.
  • NVIDIA only. TensorRT. No AMD, no Apple Silicon.
  • Slow first run. TRT compiles engines for your GPU on first use (~5 min). Cached after that.
  • Tested on A100. Should work on Ampere+, haven't verified smaller GPUs.
  • HuggingFace encoders only. Anything that exports to ONNX with standard pooling. Tested with e5 family.

What this unlocks

At 35K msg/s, every run was a commitment. I'd plan my day around it. I'd avoid reprocessing unless I absolutely had to. I'd batch fixes: change three things, run once, hope they all worked. When they didn't I'd lose another day untangling which change broke what.

At 358K msg/s, embedding is a build step. I run it, check the result, act on it. If the output looks wrong I fix the issue and rerun in 30 minutes. I test ideas I wouldn't have tried before because the cost of being wrong is $7.

Embedding stops driving the schedule. It becomes another stage in the pipeline.

Try it

# Quickstart: downloads a dataset, embeds it, writes output
python3 quickstart.py

# Reproduce the benchmark against TEI
python3 benchmark.py --model e5-small-v2 --gpu-counts 1,8

# Production
docker run --rm --gpus all \
  -v "$PWD/data:/data" \
  -v ignite-ms-cache:/cache \
  ghcr.io/artain-ai/ignite-ms:latest \
  embed \
  --model intfloat/e5-small-v2 \
  --input /data/input.jsonl \
  --output /data/embeddings.npy \
  --cache-dir /cache \
  --gpus all

Enter fullscreen mode Exit fullscreen mode

Input: JSONL or plain text (.zst and .gz supported). Output: .npy or .parquet.


If your embedding workload is measured in files, shards, or corpora instead of API requests, this is what IgniteMS is built for.

If you run it on another encoder, I'd like to see the numbers. BGE, GTE, and newer multilingual models are next on my list.

Disclosure: I used AI tools to help edit and tighten this post. The system, benchmark runs, production numbers, and technical claims are mine and were checked against run logs.

Apache 2.0. Full engine, no gated features.

GitHub: https://github.com/Artain-AI/ignite-ms