triton-inference-server / tensorrtllm_backend

The Triton TensorRT-LLM Backend
Apache License 2.0
581 stars 81 forks source link

Implement XC-Cache to improve long context inference performance #460

Open avianion opened 1 month ago

avianion commented 1 month ago

https://arxiv.org/abs/2404.15420

"In-context learning (ICL) approaches typically leverage prompting to condition decoder-only language model generation on reference information. Just-in-time processing of a context is inefficient due to the quadratic cost of self-attention operations, and caching is desirable. However, caching transformer states can easily require almost as much space as the model parameters. When the right context isn't known in advance, caching ICL can be challenging. This work addresses these limitations by introducing models that, inspired by the encoder-decoder architecture, use cross-attention to condition generation on reference text without the prompt. More precisely, we leverage pre-trained decoder-only models and only train a small number of added layers. We use Question-Answering (QA) as a testbed to evaluate the ability of our models to perform conditional generation and observe that they outperform ICL, are comparable to fine-tuned prompted LLMs, and drastically reduce the space footprint relative to standard KV caching by two orders of magnitude. "

It would be good to implement this paper to improve the efficiency of current KV caching operations in tensorrtllm_backend.

hijkzzz commented 3 weeks ago

Thank you for your advice. We currently support KV Cache reuse (RadixAttention) and offloading. By the way, support for YOCO or encoder-decoder architectures needs to be developed in a future release.