为了能|

KeanShi

园龄:1年7个月粉丝:4关注:0

【论文阅读笔记】大模型推理加速 —— FastV

论文地址:https://arxiv.org/pdf/2403.06764
代码地址:https://github.com/pkunlp-icler/FastV

image

Introduction

  • 现象(问题):大多数 LVLM 在深层的 attention 分数很低;
  • 推测:视觉信号的冗余导致在千层会被聚合为 "anchor" token,在深层中,网络更关注这些 "anchor";
  • FastV:应用于某一层中,前面的 layer 正常计算,后面的根据 threshold 随机丢弃;

image

Inefficient Visual Attention in VLLMs

Preliminaries

给定 image-question pair (d,t),利用 decoder 自回归生成过程:

p(y^)=i=1NpM(y^iy^1i1;d;t)

两种分数

αsysi,j,αimgi,j,αinsi,j,αouti,j 代表第 j 层,第 i 个 token 的注意力分数。则有下面两种分数:

total attention of system prompt in layer j: λsysj=i=1nαsysi,j

attention efficiency of image tokens in layer j: ϵimgj=i=1nαimgi,j|img|

结果分析

image

FastV

Overview

image

Re-rank and Filtering module (core)

ranking  function:fϕ

filtering  layer:K

filtering  ratio:R

在第 K 层后,利用 fϕ 对 token 的注意力分数进行排序(利用该 token 对于其他所有 token 的平均注意力得分),后 R% 会被丢弃。

Thought

Same as LoRA, so straightforward that everyone can make delevopment based on this. It's a good start for MLLM's inference using plug-and-play module.

本文作者:KeanShi

本文链接:https://www.cnblogs.com/keanshi/p/18489607

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   KeanShi  阅读(128)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起