news 2026/9/25 19:08:00

GLaMM

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
GLaMM

最值得抓住的一条主线:language generation + pixel grounding

即:模型一边生成自然语言,一边把语言里提到的实体/短语,直接绑定到图像中的像素级区域。

论文并不是单纯“LLM 后面接一个 SAM”,而是专门设计了一套语言 token → 分割 prompt → mask的连接机制,把“说什么”和“分哪里”统一到同一次生成过程中。


1. 论文想解决什么问题

(1)缺少pixel-level grounding

以前的多模态大模型,如 LLaVA、MiniGPT-4 等,主要解决的是:image → language

输入一张图,问:“这张图里有什么?”

模型回答:“一栋白色建筑,红色屋顶,周围有草坪和树木。”

模型虽然“说对了”,但没有说:“建筑”、“红色屋顶”、“草坪”、“树木”具体在哪些像素,有语言理解,但语言和图像空间没有真正绑定。

(2)缺少自然语言生成和复杂对话能力

传统 segmentation 模型,如 SAM,可以输出 mask,但不具备自然语言生成和复杂对话能力。

GLaMM 想做的就是:既让模型会说,又让它知道自己说的东西到底对应图像中的哪一片像素。


2. GLaMM 最核心的输出形式

可以把 GLaMM 想成LMM + segmentation decoder,但不是简单并列,是通过特殊 token 联系起来。如模型生成:

A <p>man</p><SEG> and a <p>boy</p><SEG> sit on a <p>bench</p><SEG>.

这里有两个非常重要的概念:

(1)<p> ... </p>

表示:这个文本片段是需要被视觉 grounding 的 phrase。如:

<p>man</p>表示“man”这个短语需要对应图像中的某个区域。

(2)<SEG>

表示:请为前面这个 phrase 生成一个 segmentation mask。

论文在 GCG(Grounded Conversation Generation)输出表示中采用<p>、</p>和<SEG>这些特殊 token,用来把语言片段和对应的区域 mask 联系起来。

整个生成过程可以理解成:生成语言 → 遇到<SEG>→ 同时触发像素级分割。

这就是 language generation 和 pixel grounding 最直接的接口。

grounding 是“建立文本和视觉区域之间的对应关系”,

生成 mask 是“把这个对应关系具体落实成像素级区域”。

比如一句话:<p>man</p><SEG>

这里可以拆成两件事:

  • <p>man</p>:“man”是一个需要被定位到图像中的 phrase,也就是要 grounding。
  • <SEG>:要求模型进一步输出这个 “man” 对应的像素级 segmentation mask。

grounding = 找到“这个词说的是图里的谁/哪里”

mask generation = 把“哪里”精确到每一个像素

grounding 可以用很多方式表达,如:bounding box、point、region、segmentation mask

因此grounding 是一个更大的概念,mask 只是 grounding 的一种更精细的表示形式。

GLaMM 里做的是pixel-level grounding,所以最终 grounding 的结果就是 segmentation mask。也就是说,这篇论文里两者关系可以写成:

grounding 是目标,mask 是实现 grounding 的像素级形式。


3. 整个 GLaMM 架构

论文把 GLaMM 分为五个核心组件:

  1. Global Image Encoder
  2. Region Encoder
  3. LLM
  4. Grounding Image Encoder
  5. Pixel Decoder

可以简单画成:

┌───────────────┐ Image ────────────► Global Encoder │ └───────┬───────┘ │ ▼ LLM │ natural language tokens │ <SEG> │ ▼ L-P Projection │ ▼ Image ───► Grounding Image Encoder ───► Pixel Decoder │ ▼ Mask

这里真正完成统一的是中间这一条:

LLM hidden state of<SEG>→ segmentation prompt → Pixel Decoder


4. language generation

语言部分先用一个全局图像编码器:ViT-H/14 CLIP将输入图像编码成视觉特征。

记为:

然后通过一个Vision-to-Language projection layer,V-L projection:把视觉特征映射到 LLM 的语言特征空间。

最后 LLM 同时接收:image features 和 text instruction,并生成文本:

Image ↓ CLIP ↓ Visual features ↓ V-L Projection ↓ LLM embedding space ↓ LLM ↓ language tokens

这一部分跟普通 LMM 很像。

如:

Image + “Describe this image.” ↓ LLM ↓ “A large hot air balloon is flying over the river...”

因此单看这一部分,GLaMM 本质上仍然是一个 image-conditioned language model。


5. pixel grounding

为了得到像素级 mask,GLaMM另外引入:Grounding Image Encoder、Pixel Decoder

Grounding Image Encoder 用pretrained SAM encoder,Pixel Decoder 用类似 SAM decoder 的架构。

Image → SAM image encoder → dense visual feature map

这套视觉特征与 CLIP 的作用完全不同。

CLIP 主要负责:“图里有什么?”SAM image encoder 主要负责:“这些东西具体在哪些像素?”

可以粗略理解成:

CLIP feature → semantic understanding SAM feature → spatial / pixel representation

6. 语言是怎么变成 segmentation mask 的?

GLaMM 在 LLM 的 vocabulary 里面新增了一个:<SEG>token

如用户问:

Please segment the man in red.

LLM 可能生成:

Sure, it is <SEG>.

这里的<SEG>不是普通 token。

模型取出<SEG>在 LLM 最后一层对应的 hidden embedding:,然后通过一个Language-to-Prompt Projection,L-P projection,记作:,把语言 embedding 映射到 segmentation decoder 能理解的 prompt space。

最后:

其中:

  • :LLM 中<SEG>token 的 hidden state
  • :language-to-prompt projection
  • :SAM grounding image encoder 特征
  • P:pixel decoder
  • M:最终 segmentation mask

论文就是这样定义 pixel-level grounding 的。

整个核心过程其实可以压缩成:

language meaning ↓ <SEG> hidden state ↓ L-P projection ↓ segmentation prompt ↓ SAM-like mask decoder ↓ pixel mask

这就是language generation + pixel grounding 的真正连接点。


7. 为什么<SEG>hidden state 能表示“要分割谁”?

假设模型生成:

A <p>red car</p><SEG>

虽然<SEG>本身只是一个 token,但它前面的 language context 是:

A red car

Transformer 的 self-attention后,<SEG>的 hidden state 并不是“SEG 这个符号”的静态 embedding。它实际上已经吸收了上下文信息:red、car、当前图像内容、前面所有文本、多模态视觉信息

所以:可以理解成:“当前这次 segmentation 到底应该找什么”的语义表示。

如:

<p>red car</p><SEG>

得到一个 hidden state:

representation of: “the red car referred to in this image”

而:

<p>person wearing blue</p><SEG>

得到的是另一个 hidden state:

representation of: “the person wearing blue”

然后 L-P projection 把这个语言语义表示变成 SAM decoder 能理解的 prompt。

所以本质上LLM 负责决定“要找什么”,SAM decoder 负责决定“它具体在哪”。


8. 这与直接使用文本 prompt 做 segmentation 有什么区别

与“ 把‘red car’直接输入 SAM 吗?”的区别:

SAM 原始的 prompt 主要是:point、box、mask,并不是复杂自然语言。

而 GLaMM 是:

整段自然语言上下文 ↓ LLM ↓ <SEG> contextual hidden state ↓ projection ↓ SAM decoder prompt

所以真正送给 decoder 的不是字符串:"red car",而是已经经过 LLM 多模态推理后的语义 embedding。因此理论上它可以表达更复杂的东西。

如:

the smaller cup

它不是单纯类别“cup”。模型需要理解:

cup + multiple cups + size comparison + which one is smaller

然后<SEG>hidden state 承载这个经过上下文消歧后的语义,再交给 pixel decoder。

论文的 Figure 5 就展示了类似的多轮对话:

先问:“Can you segment the McDonald's cup?” ,然后继续问:“Can you please segment the smaller cup now?”,说明 segmentation target 可以受到对话上下文影响。


9. “统一”到底统一在哪里?

这里可以分成三个层次理解。

第一层:输出形式统一

传统:

VLM: image → text Segmentation: image + prompt → mask

GLaMM:

image + text → language sequence + segmentation masks

即:文本和 mask 出现在同一个 response 里。


第二层:语义表示统一

更关键的是:mask 的 prompt 来自 LLM 的 token hidden state。

也就是说:语言模型中的语义直接变成视觉分割的 prompt:

所以 language space 和 segmentation space 被连接起来:

LLM language space ↓ L-P projection ↓ segmentation prompt space

这才是架构意义上的统一。


第三层:任务统一

GLaMM 提出的Grounded Conversation Generation, GCG更进一步。

它不再把这些任务分别处理:

captioning、referring segmentation、phrase grounding、region understanding、conversation

而是统一成:

image + natural language interaction ↓ grounded natural language response

例如:

A <man><SEG> and a <boy><SEG> sit on a <bench><SEG> next to an <old white car><SEG>.

一句 caption 本身同时完成:image captioning、phrase grounding、segmentation、dense scene understanding


10. 两套 image encoder

Global Image Encoder

CLIP ViT-H/14:

Image → CLIP → high-level semantic features → LLM

主要服务:language generation / scene understanding,如:“这里有一栋建筑,旁边有树。”


Grounding Image Encoder

SAM encoder:

Image → SAM encoder → dense spatial feature map → mask decoder

主要服务:pixel grounding

如:“建筑到底是哪几个 pixel。” 所以可以把它理解为:

┌── semantic branch ──► language Image ────┤ └── spatial branch ───► segmentation

而<SEG>hidden state 是连接这两个 branch 的桥梁。<SEG>hidden state 把 LLM 中“要分割什么”的语义信息传递给 Pixel Decoder,让像素分支知道应该在图像中寻找哪个目标。


11. Region Encoder

除此之外,还有一个Region Encoder。它解决的是用户指出某个区域,让模型理解这个区域。

如:

Can you describe this region?

然后用户给一个 bounding box。GLaMM 会:

CLIP intermediate features ↓ feature pyramid ↓ RoIAlign ↓ region feature ↓ V-L projection ↓ LLM

论文用四个CLIP层构建hierarchical feature pyramid,再通过RoIAlign得到的区域特征。

所以 GLaMM 实际上有三个粒度(对应三个encoder):

Scene-level → Global Image Encoder Region-level → Region Encoder Pixel-level → SAM encoder + Pixel Decoder

这也是这篇论文设计很完整的一点。

12. GCG 任务为什么重要

作者认为,只做:

“segment the dog”

还不能真正体现 LMM 的优势。因为这实际上还是传统 referring segmentation。

所以他们提出了:Grounded Conversation Generation,GCG

要求模型:生成自然语言,同时把语言中重要的 phrase 都对应到 mask。

例如:

A man and a boy sit on a bench next to an old white car.

不只是输出这句话,而是变成:

<p>A man</p><SEG> and <p>a boy</p><SEG> sit on <p>a bench</p><SEG> next to <p>an old white car</p><SEG>

每个<SEG>都有自己的 pixel mask。

所以 GCG 实际上要求语言生成过程中持续发生 grounding。而不是先生成整句话,再用另一个模型去 phrase grounding


13. 怎么理解它的“统一”

语言负责语义,分割负责空间,<SEG>token 负责桥接。

更具体一点:

Image semantic features ↓ LLM ↓ “what should be segmented?” ↓ <SEG> hidden state ↓ L-P projection ↓ segmentation prompt ↓ SAM visual features ↓ Pixel Decoder ↓ “where is it?”

LLM 解决 WHAT,SAM-like decoder 解决 WHERE。

但是二者不是独立运行,而是通过<SEG>的 contextual representation 连接。


14. 和之前看的 LISA 有什么关系

如果之前已经理解了 LISA,那么 GLaMM 就很好理解。

LISA 的核心也是:

LLM → <SEG> → hidden embedding → SAM decoder → mask

GLaMM 延续了这个核心范式,但做得更进一步:

LISA 更偏 reasoning segmentation / referring segmentation:

question → determine target → one segmentation mask

而 GLaMM 把它扩展成:

自然语言生成 + 多个 phrase + 多个 masks + region input + multi-turn conversation

所以从任务上看,LISA:language → mask

而 GLaMM 更强调:language generation ↔ pixel grounding

也就是在一整段自然语言生成过程中,可以不断插入 grounding。


15. 有一个值得注意的地方

虽然论文称之为“统一”,但是从 architecture 上看,其实不是:一个完全统一的视觉表示模型。

因为仍然有:

CLIP image encoder + SAM image encoder

两套视觉 backbone。

所以更准确地说:GLaMM 统一的是 language generation 和 segmentation 的交互接口与训练目标,而不是彻底统一底层视觉表示。

也就是说它做的是:

language representation ↓ shared semantic interface ↓ pixel decoder

而不是:

one universal representation simultaneously generates text and pixels

这个区别对你后面看更现代的 pixel-grounded VLM 很重要。


16. 最后给一个最精炼的理解

如果只记住这篇论文的核心机制,建议记这条链:

Image ↓ CLIP → LLM → natural language ↓ <SEG> ↓ <SEG> hidden state ↓ L-P projection ↓ Image → SAM Encoder → Pixel Decoder ↓ mask

所以所谓:language generation + pixel grounding

真正实现统一的关键就是:

让 LLM 在生成语言时产生一个特殊<SEG>token,并把该 token 的上下文化 hidden state 当成 segmentation prompt,送入 SAM-like pixel decoder,从而让“生成的语言语义”直接驱动“对应目标的像素级分割”。

而 GCG 则进一步把这种机制扩展到一段自然语言中的多个 phrase:

phrase₁ → <SEG>₁ → mask₁ phrase₂ → <SEG>₂ → mask₂ phrase₃ → <SEG>₃ → mask₃ ...

因此,GLaMM 的真正贡献可以理解为:

不再让模型只回答“图里是什么”,而是让模型在回答“是什么”的同时,也回答“它在哪里”。


网络结构图解释

这张图基本就是把 GLaMM 的三层能力串起来了:

scene-level understanding → region-level understanding → pixel-level grounding

它最核心的主线还是:

图像/区域 → LLM 生成语言 → 语言中的特定语义再去驱动 mask 生成。

左侧输入:模型接收一张图像,同时也可额外接收用户指定的区域,比如图中的红框区域。整张图像会先送入Global Image Encoder,提取全局视觉语义;如果用户还指定了某个 region,这个区域会通过Region Encoder得到更细粒度的区域特征。

Global Image Encoder:看整张图是什么场景。
Region Encoder:重点看用户圈出来的这一块是什么。

这些图像特征和区域特征会形成Image-region prompts。但由于视觉和语言空间的特征维度、语义分布不同,这些特征不能直接送进 LLM,要经过V-L(Vision-to-Language)projection:visual features → LLM 能理解的 language-space embeddings

于是 LLM 接收到的输入就可以写成:

图像特征 / 区域特征 + 用户文本问题 → LLM

例如图里的问题:

Can you give a detailed description of this image?

LLM 就可以生成:

A large, colorful hot air balloon is flying over the river.
The sky is overarching the river, trees, and buildings.

到这里为止,和普通 VLM 比较接近:图像 → 语言生成。

真正体现 GLaMM 特点的是右半部分:Grounding Image Encoder + Pixel Decoder。

同一张原始图像还会走另一条视觉分支:

Image → Grounding Image Encoder → dense image features

Grounding Image Encoder 使用适合像素级定位的视觉编码器,负责保留更细致的空间信息,为后面生成 segmentation mask 做准备。

两套 encoder:

Global Image Encoder → 偏语义理解 → 给 LLM 用 Grounding Image Encoder → 偏空间 / 像素信息 → 给 Pixel Decoder 用

接下来就是整张图最重要的连接:L-P(Language-to-Prompt)projection。

LLM 在生成语言时,如果某个 phrase 需要对应到图像区域,比如:

hot air balloon、river、sky、trees、buildings

模型为需要 grounding 的内容产生相应的 segmentation-related token,本质上就是<SEG>。

LLM 中<SEG>对应的 hidden embedding,包含了当前语言上下文的语义,比如:

“我要找的是那个 hot air balloon”

再通过L-P projection把语言 embedding 转成 Pixel Decoder 可接受的 prompt embedding。

所以右侧可以理解为:

LLM → <SEG> hidden state → L-P projection → Output prompt → Pixel Decoder

而 Pixel Decoder 同时还接收:

Grounding Image Encoder 提取的图像特征

于是最终它做的是:

“我要找什么” + “整张图每个位置长什么样” ↓ Pixel Decoder ↓ segmentation mask

语言负责告诉 decoder:找谁。
Grounding Image Encoder 负责告诉 decoder:图像空间在哪里。
这两者共同决定最终的 mask。

把整条主流程压缩一下,就是:

┌→ Global Image Encoder Image ──────────────────┤ │ ↓ │ V-L projection │ ↓ Text question ───────────────→ LLM ↓ language response ↓ <SEG> ↓ L-P projection ↓ mask prompt ↓ Image → Grounding Image Encoder → Pixel Decoder ↓ mask

这里V-L和L-P是两个非常关键、方向相反的桥梁:

V-L: Vision → Language 让 LLM 看懂图像 L-P: Language → Prompt 让 segmentation decoder 看懂语言意图

可以把 GLaMM 的整个结构理解成一个闭环:Vision → Language → Pixel

这也正是它把 language generation 和 pixel grounding 统一起来的地方。


再看图下方的几个任务会更容易理解为什么设计成这样。

Image Level Captioning只需要:

Global Image Encoder → LLM → text

不需要生成 mask。

Region Level Captioning则多了用户指定区域:

Image → Region Encoder → LLM → region description

比如用户框住热气球,问:

Could you tell me more about this region?

模型回答:

A yellow, red and blue hot air balloon.

Referring Expression Segmentation则正好反过来:

“segment the balloon” ↓ LLM ↓ <SEG> ↓ L-P projection ↓ Pixel Decoder ↓ balloon mask

这时候语言只是为了确定目标,最终主要输出 mask。

Phrase Grounding则是:

“A <hot air balloon> over the <river>”

要分别把 hot air balloon、river 对应到图像中的区域,所以一段文本中可能产生多个 grounding。

而图中央橙色框里的Grounded Conversation Generation(GCG),其实就是把这些能力全部合在一起。生成一句自然语言:

A large, colorful hot air balloon is flying over the river. The sky is overarching the river, trees, and buildings.

同时其中多个 phrase:

hot air balloon、river、sky、trees、buildings

都可以产生各自的 segmentation mask。

所以它不是:

生成一句话,然后另一个模型再去分析这句话,然后再分割

而是更接近:

LLM 一边生成 ↓ 遇到需要 grounding 的 phrase ↓ 产生 <SEG> ↓ 立刻把对应 hidden state 送给 Pixel Decoder ↓ 生成对应 mask

这就是图里所谓的interleaved language and masks。

如果你现在在读这篇论文,我建议你重点记住这四个模块之间的分工:

模块主要作用
Global Image Encoder提供整图高级语义
Region Encoder提供用户指定区域的细粒度语义
LLM理解问题、生成语言、确定要 grounding 的概念
Grounding Image Encoder + Pixel Decoder把语言概念落实到具体像素

两个 projection 就是整个系统的桥:

V-L:图像语义进入语言模型。L-P:语言语义进入分割模型。

这张结构图最核心的一句话就是:

GLaMM 先让视觉信息进入 LLM 完成语义生成,再把 LLM 中与 grounding 相关的语义表示转成 segmentation prompt,由像素解码器输出 mask。

也就是:Image → Language → Pixel。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/9/25 19:05:49

桌面沟通型CRM:让客户管理融入日常沟通的新思路

1. 内容整体设计与思路拆解1.1 为什么我会盯上DeskcommCRM这个名字说实话&#xff0c;我第一次看到DeskcommCRM这几个字的时候&#xff0c;第一反应是这又是个套壳的客户管理系统。国内叫CRM的产品没有一千也有八百&#xff0c;从Salesforce到纷享销客、销售易&#xff0c;再到…

作者头像 李华
网站建设 2026/9/25 19:03:40

SSE流式传输实战:从协议原理到生产环境性能调优

1. 流式传输到底在解决什么问题第一次接触流式传输这个概念&#xff0c;很多人会以为它是什么高深的新技术。其实你每天都在用它&#xff0c;只是没意识到而已。打开ChatGPT看它一个字一个字往外蹦回答&#xff0c;用手机看直播画面实时传过来&#xff0c;甚至你在终端里跑一个…

作者头像 李华
网站建设 2026/9/25 18:54:06

为什么现在聚焦 kv cache;分清楚:kv权重 和 kv向量

权重只存一份,KV 是每个 token 存一份,token 够多 kv 向量越大 目录 权重只存一份,KV 是每个 token 存一份,token 够多 kv 向量越大 一、先看两者怎么随长度变化 二、算出来的结果 三、为什么必然如此(本质) 四、现代大模型呢 一、先看两者怎么随长度变化 模型权重:固定…

作者头像 李华
网站建设 2026/9/25 18:51:22

G Hub宏失效的解决方法

都是用了5年了的罗技老用户了&#xff0c;虽然lgHub挺好用的&#xff0c;但是还是偶尔会出现一些小问题。比如找不到 lg设备&#xff0c;设备自定义宏失效&#xff0c;自启动失效&#xff0c;lgHub卡在加载动画进不去的问题。这里只说鼠标宏无法触发&#xff0c;常见原因多源于…

作者头像 李华
网站建设 2026/9/25 18:44:14

Atlas 300V 24G部署YOLO全流程:从ONNX转换到推理优化实战

Atlas这个词&#xff0c;搞AI的人这几年应该都不陌生。只要你在硬件选型阶段多看了几眼推理加速卡&#xff0c;大概率会碰到华为昇腾的Atlas系列。老实说&#xff0c;我最早接触Atlas是朋友让我帮他看一块二手卡&#xff0c;说是“300V 24G”&#xff0c;第一反应这尺寸是不是类…

作者头像 李华