行业动态
marktechpost.com ·
@Asif Razzaq
Perplexity 详解 GPU 嵌入栈:Ivy、Tulip 和 ROSE 如何服务 pplx-embed
Perplexity 工程团队发布技术博客,深入解析其嵌入模型 pplx-embed 的 GPU 推理基础设施,包括 Ivy、Tulip 和 ROSE 等组件,旨在降低大规模索引的推理成本并提升检索质量。
AI推荐理由 Perplexity 工程团队发布的技术博客,详细介绍了 pplx-embed 的 GPU 推理基础设施(Ivy、Tulip、ROSE),属于官方技术分享,信息密度高,对 AI 基础设施和检索系统有实际参考价值。
85
正文
人工智能
AI基础设施
技术
AI简讯
应用
编辑精选
开发者专区
员工
科技新闻
未分类
AI搜索产品的检索质量受两个因素制约:嵌入模型有多好,以及你能多便宜地在索引上运行它。本周,Perplexity工程团队发布了《GPU上的快速嵌入》,深入介绍了后者——支撑pplx-embed和Perplexity Search、Computer及API平台中排名模型的服务基础设施。
Perplexity团队表示,在成熟的Hopper和Blackwell硬件上,GPU端的嵌入推理在各引擎间已基本趋同。优势在于模型周围的运行时和框架:CUDA图管理、异步结果跟踪抽象,以及Rust请求路径。
两种流量模式,一个引擎
Perplexity将嵌入服务视为两种工作负载。批量嵌入发生在构建或重新索引向量数据库时,此时吞吐量可最小化成本。在线嵌入发生在查询时,此时短查询必须快速嵌入。评分介于两者之间:在向量搜索后,对大批量文档进行排名,平衡两者。
关键决策是Perplexity没有构建单独的嵌入引擎。由于嵌入模型是小型Transformer,批量嵌入类似于计算受限的预填充,而在线嵌入(通常只有几个令牌)类似于内存受限的解码。因此,研究团队复用了其LLM堆栈中的预填充和解码内核。
Ivy、Tulip和ROSE
三个服务处理一个请求:
Ivy是一个Rust HTTP网关。它执行CPU端工作——JSON解析、分词、输入模板化、批次拆分——并将请求转换为自定义gRPC协议。它还将大批量请求拆分为块,并在副本间进行负载均衡,这纠正了生产负载大小不均时出现的负载不平衡。
Tulip是推理服务器接口:一个用Rust、tokio和tonic构建的gRPC服务器,在调度到引擎之前处理调度和批处理。
ROSE(运行时优化服务引擎)实现模型推理。它主要使用Python,提供内核、层和模型定义,管理CUDA图,并向Tulip暴露step()函数。
为何调度器刻意简单
Tulip按先到先服务选择序列,同时请求累积。这种简单性由一个测量结果证明:对于Perplexity服务的小型嵌入模型和序列长度,密集层的线性成本主导了注意力的二次成本。因此,延迟大致与令牌数量成正比,而非序列数量。一旦批次使GPU饱和(在亚十亿参数模型上约为512个令牌),打包更多序列并不会提高效率。
CUDA图和LazyTensors
在小批次上,CPU端内核启动可能超过GPU执行时间。Perplexity为所有嵌入模型构建全模型CUDA图,将每次启动捕获到单个驱动调用中。由于嵌入模型较小,GPU工作超过启动成本的拐点出现在数千令牌和数十序列的批次上。某些注意力实现因依赖动态主机端输入而阻止全模型图;Perplexity向上游FlashInfer提交了更改以启用捕获。
图必须按配置捕获,因此令牌数量被填充到64或256的倍数桶中。这仍然会产生数千个图,每个模型需要数分钟的捕获时间。解决方案是惰性捕获:每个配置先进行急切预热运行,然后在第二次命中时触发捕获和重放。这在启动时牺牲了p99延迟,但将数分钟的急切工作分散到数小时内。
第二个组件是LazyTensor,它跟踪一个页锁定主机缓冲区以及一个cudaMemcpyAsync和一个CUDA事件。step()不是阻塞在设备上,而是返回一个LazyTensor,让Rust异步任务在CPU排队N+1时等待批次N。
内核仍然重要
ROSE支持多种用于不规则输入的注意力后端:FlashInfer 2、FlashInfer 3和FlashAttention 4。Perplexity团队报告FlashAttention 4通常更快,但FlashInfer 3在基于Qwen的模型上、在非常长的序列长度下表现更优,因此后端选择是逐案进行的。值得注意的是,当服务嵌入模型时,ROSE不会实例化KV缓存,并调度到不规则注意力变体以避免填充。
基准测试
Perplexity在BF16下使用真实权重和评估派生输入对vLLM v0.22.0进行基准测试,预热运行验证余弦相似度差异在0.1%以内。绘制了四个套件:低延迟嵌入(批次1;128/512/4096令牌)、低延迟评分(批次5/25/50,512令牌)、高吞吐量嵌入(批次100,四个并发进程)和高并发嵌入(1到16个并发请求,包括Ivy分词和网络开销)。
关键要点
Perplexity的嵌入堆栈复用了其LLM预填充/解码内核,而非运行单独引擎。
延迟跟踪令牌数量而非序列数量;约512个令牌使亚10亿模型饱和。
全模型CUDA图加上惰性捕获减少了启动开销,无需数分钟启动时间。
LazyTensor将CPU批次准备与进行中的GPU工作重叠,而非阻塞同步。
Ivy、Tulip和ROSE是内部的;pplx-embed可通过Perplexity的嵌入API访问。
查看技术细节。另外,欢迎在Twitter上关注我们,别忘了加入我们的150k+ML SubReddit并订阅我们的新闻通讯。等等!你在Telegram上吗?现在你也可以在Telegram上加入我们。
需要与我们合作推广你的GitHub仓库或Hugging Face页面或产品发布或网络研讨会等?请联系我们。
Asif Razzaq
网站 | + 帖子简介
Asif Razzaq是Marktechpost Media Inc.的首席执行官。作为有远见的企业家和工程师,Asif致力于利用人工智能的潜力造福社会
。他最近的努力是推出了人工智能媒体平台Marktechpost,该平台以深入报道机器学习和深度学习新闻而著称,这些新闻在技术上可靠且易于广大受众理解。该平台每月浏览量超过200万,显示了其在受众中的受欢迎程度。
Asif Razzaq
Reducto发布r-1:单遍文档解析模型,每页1美分,错误减少20%
Asif Razzaq
IFM发布K2 Horizon:六个Apache 2.0模型,从0.9B到375B
Asif Razzaq
H Company发布NeoMME:260M和800M单塔多模态编码器系列,去掉了视觉塔和因果解码器
Asif Razzaq
Meta FAIR推出AI研究偏好模型(RPM):在花费GPU小时之前对ML实验进行排名
查看原文(中文正文为 AI 翻译)
Artificial Intelligence
AI Infrastructure
Technology
AI Shorts
Applications
Editors Pick
For Devs
Staff
Tech News
Uncategorized
Retrieval quality in an AI search product is bounded by two things: how good the embedding model is, and how cheaply you can run it across an index. This week, Perplexity Engineering team published Fast Embeddings on GPUs, an under-the-hood account of the second — the serving infrastructure behind pplx-embed and the ranking models used across Perplexity Search, Computer and the API Platform.
Perplexity team states that embedding inference on the GPU side has largely converged across engines on mature Hopper and Blackwell hardware. The wins sit in the runtime and harness around the model: CUDA graph management, an async result-tracking abstraction, and a Rust request path.
Two traffic patterns, one engine
Perplexity frames embedding serving as two workloads. Batch embedding happens when building or re-indexing the vector database, where throughput minimizes cost. Online embedding happens at query time, where a short query must be embedded fast. Scoring sits in between: after vector search, large document batches are ranked, balancing both.
The key decision is that Perplexity did not build a separate embedding engine. Because embedding models are small Transformers, batch embedding resembles compute-bound prefill and online embedding, often a few tokens, resembles memory-bound decode. So the research team reuses the prefill and decode kernels from its LLM stack.
Ivy, Tulip and ROSE
Three services handle a request:
Ivy is a Rust HTTP gateway. It does the CPU-side work — JSON parsing, tokenization, input templating, batch splitting — and translates requests into a custom gRPC protocol. It also splits large-batch requests into chunks and load-balances them across replicas, which corrects the load imbalance that arises when production payloads vary in size.
Tulip is the inference server interface: a gRPC server built with Rust, tokio and tonic, handling scheduling and batching before dispatching to the engine.
ROSE (Runtime-Optimized Serving Engine) implements model inference. It is primarily Python, provides kernels, layers and model definitions, manages CUDA graphs, and exposes a step() function to Tulip.
Why the scheduler is deliberately simple
Tulip picks sequences first-come, first-served while requests accumulate. That simplicity is justified by a measurement: for small embedding models at the sequence lengths Perplexity serves, the linear cost of dense layers dominates the quadratic cost of attention. Latency is therefore roughly proportional to token count, not sequence count. Once a batch saturates the GPU, around 512 tokens on a sub-billion-parameter model, packing in more sequences does not improve efficiency.
CUDA graphs and LazyTensors
On small batches, CPU-side kernel launching can outweigh GPU execution. Perplexity builds whole-model CUDA graphs for all embedding models, capturing every launch into a single driver call. Because embedding models are small, the inflection point where GPU work exceeds launch cost arrives at batches of thousands of tokens and tens of sequences. Some attention implementations block full-model graphs by depending on dynamic host-side inputs; Perplexity upstreamed changes to FlashInfer to enable capture.
Graphs must be captured per configuration, so token counts are padded to buckets that are multiples of 64 or 256. That still yields thousands of graphs and multiple minutes of capture per model. The fix is lazy capture: each configuration gets an eager warmup run, then triggers capture and replay on its second hit. This costs p99 latency at startup but spreads minutes of eager work across hours.
The second piece is the LazyTensor, which tracks a page-locked host buffer plus a cudaMemcpyAsync and a CUDA event. Instead of step() blocking on the device, it returns a LazyTensor, letting a Rust async task wait on batch N while the CPU enqueues N+1.
Kernels still matter
ROSE supports multiple attention backends for ragged inputs: FlashInfer 2, FlashInfer 3 and FlashAttention 4. Perplexity team reports FlashAttention 4 is generally faster, but FlashInfer 3 outperforms it on Qwen-based models at very long sequence lengths, so backend selection is made case by case. Notably, when serving an embedding model ROSE does not instantiate a KV cache and dispatches to ragged attention variants to avoid padding.
Benchmarks
Perplexity benchmarks against vLLM v0.22.0 in BF16 on real weights and eval-derived inputs, with warmup runs verifying cosine similarity divergence within 0.1%. Four suites are charted: low-latency embeddings (batch 1; 128/512/4096 tokens), low-latency scoring (batch 5/25/50 at 512 tokens), high-throughput embeddings (batch 100, four concurrent processes) and high-concurrency embeddings (1 to 16 concurrent requests, including Ivy tokenization and network overhead).
Key Takeaways
Perplexity’s embedding stack reuses its LLM prefill/decode kernels rather than running a separate engine.
Latency tracks token count, not sequence count; ~512 tokens saturates a sub-1B model.
Whole-model CUDA graphs plus lazy capture cut launch overhead without minutes-long startup.
LazyTensor overlaps CPU batch prep with in-flight GPU work instead of blocking on sync.
Ivy, Tulip and ROSE are internal; pplx-embed is reachable via Perplexity’s Embeddings API.
Check out the Technical details. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
Asif Razzaq
Website | + postsBio
Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.
Asif Razzaq
Reducto Releases r-1: A Single Pass Document Parsing Model That Cuts Errors 20% at 1 Cent Per Page
Asif Razzaq
IFM Releases K2 Horizon: Six Apache 2.0 Models From 0.9B to 375B
Asif Razzaq
H Company Releases NeoMME: A Family of 260M and 800M Single-Tower Multimodal Encoders That Drop the Vision Tower and Causal Decoder
Asif Razzaq
Meta FAIR Introduces AI Research Preference Models (RPMs): Ranking ML Experiments Before Spending GPU Hours