让vLLM模型可编程内部状态,支持实时干预与分析。
vLLM Hook v0: A Plug-in for Programming Model Internals on vLLM
- 通过配置文件捕获模型内部状态,实现无侵入探测与主动干预。
- 支持攻击检测、检索增强与激活调控等三类应用,效果显著。
- 开源插件,适合研究者和工程师优化大模型推理行为。
现代人工智能模型部署在推理引擎中以提升运行效率和资源分配,尤其是基于Transformer的大语言模型(LLMs)。vLLM是一个重要的开源库,用于支持模型服务与推理。然而,当前vLLM的实现限制了已部署模型内部状态的可编程性,阻碍了测试时模型对齐与增强方法的应用。例如,无法基于注意力模式检测对抗性提示,也无法通过激活控制调整模型输出。为填补这一关键空白,我们提出vLLM Hook,一个开源插件,使vLLM模型能够编程内部状态。基于配置文件指定需捕获的内部状态,vLLM Hook 提供无缝集成,并支持两种核心功能:被动编程(探查内部状态用于后续分析,保持生成不变)与主动编程(通过修改选定内部状态实现高效干预)。除核心功能外,我们在版本0中展示了三个应用案例:提示注入检测、增强型检索增强生成(RAG)与激活引导。我们欢迎社区通过 https://github.com/ibm/vllm-hook 贡献改进。
原文摘要 · Abstract (English)
Modern artificial intelligence (AI) models are deployed on inference engines to optimize runtime efficiency and resource allocation, particularly for transformer-based large language models (LLMs). The vLLM project is a major open-source library to support model serving and inference. However, the current implementation of vLLM limits programmability of the internal states of deployed models. This prevents the use of popular test-time model alignment and enhancement methods. For example, it prevents the detection of adversarial prompts based on attention patterns or the adjustment of model responses based on activation steering. To bridge this critical gap, we present vLLM Hook, an opensource plug-in to enable the programming of internal states for vLLM models. Based on a configuration file specifying which internal states to capture, vLLM Hook provides seamless integration to vLLM and supports two essential features: passive programming and active programming. For passive programming, vLLM Hook probes the selected internal states for subsequent analysis, while keeping the model generation intact. For active programming, vLLM Hook enables efficient intervention of model generation by altering the selected internal states. In addition to presenting the core functions of vLLM Hook, in version 0, we demonstrate 3 use cases including prompt injection detection, enhanced retrieval-augmented retrieval (RAG), and activation steering. Finally, we welcome the community's contribution to improve vLLM Hook via https://github.com/ibm/vllm-hook.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。