🤖 AI Hot

Xiaohongshu's PIPO: A Smarter Way to Speed Up LLM Inference

A
Alex Chen

Xiaohongshu — the Chinese social platform most Western developers know as “China’s Instagram” — has a research lab, and it just dropped something interesting. A team from Xiaohongshu, Renmin University of China, UESTC, and the Chinese Academy of Sciences has published PIPO, a new architecture for making large language model inference faster without losing accuracy. The paper is on arXiv (2605.27255) and the code is open source on GitHub under redai-infra/PIPO.

PIPO stands for Pair-In, Pair-Out. The name tells you the core idea: treat input compression and output prediction as mirror images of each other, then unify them into a single mechanism. It is one of those ideas that feels obvious after someone explains it, which is usually a sign that it is good.

Here is what PIPO does, why it matters, and how it compares to other inference acceleration techniques you might have heard about.

The problem PIPO solves: long reasoning is expensive

Before getting into PIPO, it helps to understand why this problem matters right now.

Chain-of-thought reasoning has become the standard way to get good answers from LLMs on hard problems. Models like OpenAI’s o3, Anthropic’s extended thinking mode, and DeepSeek-R1 all generate thousands of thinking tokens before producing a final answer. These thinking tokens are not shown to the user, but they cost just as much compute as visible tokens.

The result is that long reasoning is slow and expensive. A query that takes 2 seconds with a standard model can take 30-60 seconds with chain-of-thought. For applications that need real-time responses — coding assistants, customer support, interactive agents — this latency is a dealbreaker.

There are two established approaches to this problem, and both have tradeoffs:

Input compression reduces the number of tokens the model has to process by compressing the prompt. Techniques like prompt caching, KV-cache compression, and latent token merging fall into this category. They help with prompt processing but do nothing for the output side.

Multi-token prediction (MTP) makes the model predict multiple output tokens at once instead of one at a time. This speeds up generation but adds complexity and can hurt quality if not done carefully. Medusa, Eagle, and various speculative decoding methods are examples.

PIPO’s key insight is that these two problems — compressing inputs and predicting multiple outputs — are structurally the same operation, just in opposite directions. If you can solve one elegantly, you can solve both with the same mechanism.

How PIPO works, in plain terms

The architecture has two components that mirror each other:

Pair-In (the compressor): takes two consecutive input tokens and folds them into a single latent representation. This reduces the sequence length the model has to process. Instead of processing 10,000 tokens one at a time, the model processes 5,000 compressed representations. Half the work, same information.

Pair-Out (the MTP head): takes one hidden state and unfolds it into one additional output token prediction. In practice, this means the model predicts two tokens per forward pass instead of one. Again, roughly half the work for the same output.

The clever part is that these two components share the same underlying mechanism. The compressor is trained to “fold” tokens in a way that preserves the information the model needs. The MTP head is trained to “unfold” hidden states in a way that produces accurate predictions. Because they are symmetric operations, insights from training one improve the other.

PIPO also uses knowledge distillation to verify correctness during training. Instead of waiting until the full model is trained to check if the compression is lossy, a smaller teacher model validates the compressed representations mid-training. This front-loads the verification cost — you spend more compute during training to save compute during inference. For a model that will serve millions of queries, that is a good trade.

Performance: what the numbers say

The paper reports roughly 2x inference speedup on long chain-of-thought reasoning tasks with negligible accuracy loss. On standard benchmarks like MMLU and HumanEval, the compressed PIPO models perform within 1-2% of their uncompressed counterparts.

The speedup is not uniform across all workloads. Short prompts (under 500 tokens) see minimal benefit because the compression overhead roughly cancels out the gains. Long reasoning traces (5,000+ tokens) see the full 2x improvement. This makes PIPO particularly well-suited for deep reasoning models, agentic workflows that involve multi-step planning, and any application where the model generates long internal monologues before answering.

For comparison: Medusa-style MTP heads typically achieve 1.5-2x speedup but require additional training of the prediction heads and can degrade output quality on creative tasks. Speculative decoding with a draft model achieves similar speedups but needs a second model running in parallel, which doubles memory usage. PIPO’s unified approach avoids both problems — no separate draft model, no quality degradation from greedy prediction heads.

Why Xiaohongshu built this

Xiaohongshu is not the first company you think of for LLM infrastructure research. But it makes sense when you look at their workload.

Xiaohongshu runs one of the largest recommendation and content understanding systems in China. Their platform processes billions of user interactions daily — likes, comments, searches, content recommendations. Many of these pipelines now involve LLMs for content moderation, search ranking, and personalized recommendations.

Latency matters enormously in this context. A recommendation that takes 500ms to generate is useless; users scroll past in under a second. If PIPO can cut LLM inference latency in half for long-context tasks, it directly improves the user experience for hundreds of millions of people.

The open-source release is also strategically interesting. Xiaohongshu is sharing their inference research while most Western labs keep similar work proprietary or release it as a paper without code. The GitHub repo (redai-infra/PIPO) includes training scripts, model checkpoints, and evaluation code. This is the kind of openness that builds credibility in the research community and attracts talent.

Beginner’s guide: should you adopt PIPO?

If you are running LLMs in production and inference cost or latency is a pain point, here is a practical comparison to help you decide whether PIPO is worth investigating.

PIPO is a good fit if:

  • Your workload involves long chain-of-thought reasoning (5,000+ output tokens)
  • You are serving models with large context windows where prompt processing dominates cost
  • You want to reduce latency without running a separate draft model
  • You are willing to fine-tune your model with the PIPO architecture

PIPO is not a good fit if:

  • Your workload is mostly short prompts with short responses (chatbots, simple Q&A)
  • You need the absolute highest accuracy and cannot tolerate even 1-2% regression
  • You are using a hosted API where you cannot modify the model architecture
  • You have already invested in a speculative decoding pipeline that works well

For the curious developer: the GitHub repo has a minimal implementation that you can experiment with. Start with the provided checkpoints for Llama-3-based models. Run the evaluation script on your own benchmark suite before committing to a full training run. The distillation-based verification means training is more expensive than standard fine-tuning — budget for roughly 1.5-2x the typical training cost for the first run while you dial in hyperparameters.

For teams considering adoption: the biggest unknown is how PIPO generalizes to architectures beyond standard dense transformers. The paper tests on Llama-family models. Whether it works as well on MoE architectures (Mixtral, DeepSeek-V3) or non-transformer architectures (Mamba, RWKV) is an open question. If your stack is non-standard, run a small-scale experiment before committing.

How PIPO fits into the bigger inference optimization picture

PIPO enters a field that is already crowded with optimization techniques. Here is how it compares to the major approaches:

Quantization (GGUF, GPTQ, AWQ): reduces model precision from FP16 to INT8 or INT4. Typically 2-4x speedup, 1-3% accuracy loss, works on any model without retraining. PIPO is complementary to quantization — you can do both.

Speculative decoding: uses a small draft model to predict tokens, verified by the large model. 1.5-3x speedup, no accuracy loss, but doubles memory usage. PIPO avoids the memory overhead.

KV-cache compression (StreamingLLM, H2O, FastGen): reduces the memory footprint of long contexts. 2-5x memory reduction, minor accuracy loss on long-context tasks. PIPO addresses a different bottleneck (compute, not memory) so they can be combined.

FlashAttention / kernel fusion: low-level optimizations that speed up attention computation. 2-4x speedup on attention-heavy workloads, no accuracy loss. PIPO operates at the architecture level, FlashAttention at the kernel level. Use both.

The best practice for inference optimization in 2026 is to stack techniques: quantize your model, use FlashAttention, apply KV-cache compression for long contexts, and add PIPO or speculative decoding for the output side. Each technique addresses a different bottleneck, and the gains compound.

What this says about Chinese AI research

PIPO is worth paying attention to beyond the technical details. It represents a pattern I have been noticing in Chinese AI research over the past year: a shift from replicating Western results to contributing novel architectures optimized for practical deployment.

Xiaohongshu, ByteDance, Alibaba, DeepSeek — these companies are increasingly publishing original research that addresses real production constraints. They are not just training bigger models. They are solving the engineering problems that come after the model is trained: how to serve it efficiently, how to reduce costs, how to make it fast enough for consumer applications.

Western labs have their own inference optimization work — Google’s speculative decoding research, Anthropic’s constitutional AI for alignment, OpenAI’s system-level optimizations. But the Chinese labs are publishing more of it openly, and the quality is catching up fast.

For developers, this means more options and better tools regardless of where you are based. PIPO is Apache 2.0 licensed. You can use it. The paper is on arXiv. You can read it. The code is on GitHub. You can run it. That is a net positive for everyone building on LLMs.

The team behind PIPO is actively developing it — the GitHub repo shows recent commits and the paper has been updated to v2 on arXiv. If inference speed is on your roadmap this year, this is one to watch.

A practical tip if you want to try it today: clone the repo, grab one of the pretrained checkpoints, and run the provided benchmark script on a subset of your own eval data. The repo’s README has a one-command setup. You will know within an hour whether the speedup materializes on your specific hardware and workload. For teams running Llama-based models with long CoT traces, the odds are good.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen