多模态对齐:共同锚点与未见方向
Cross-modal alignment
求解正交对齐,观察不完整锚点留下的歧义。
multimodal-alignment两张地图可以描绘同一地点,却采用不同坐标
图像和声音可以指向同一只正在叫的狗,但原始坐标无法直接比较。对齐试图让这种关系可用:配对观测应在共同表示中对应,或能够恢复彼此关系。融合则是另一个问题:怎样把可用输入结合起来完成任务。
CLIP以对比目标对齐配对图文。ImageBind使用与图像配对的模态训练,并报告某些未直接配对训练的模态之间也出现了对齐。这是经验结果,不证明共享一个锚点模态就总能确定全部相关关系。建议先读CLIP与SVD。
一个可以精确求解的对齐问题
A的n行是锚点向量,X的各行是在另一个d维坐标系中的配对观测。将映射限制为正交矩阵W,它保留长度和角度、允许反射,并假定无需平移或缩放:
这个原创教学问题是正交Procrustes,不是ImageBind的神经目标。展开Frobenius范数平方:
前两项不变。若交叉乘积的奇异值分解为XᵀA=UΣVᵀ,迹的上界是奇异值之和,下面的映射达到该上界:
例如,将八个单位圆锚点旋转后观测,精确解就是逆旋转。分别把音频侧和文字侧坐标拟合到锚点,再比较归一化后的映射向量:
对两种表示共同施加正交坐标变换R,比较结果不变:
共同几何没有唯一有意义的绝对朝向。更关键的是,不完整锚点可能连相对朝向也无法确定。若锚点只在水平轴上,恒等I和垂直反射F都能完美拟合:
对未见过的垂直向量,I保留目标身份,F却把它们交换。训练对齐误差为零,没有在两者之间作出选择。满秩能够排除这个特定的零空间歧义,却不保证线性模型适用于新总体。
拟合、旋转,再删去一个锚点方向
保存为multimodal_alignment.py,使用Python3.12与NumPy1.26.4。合成音频侧坐标旋转.8弧度,文字侧旋转−.5弧度;它们是数值观测,不是真实录音或文字。两个映射都由SVD求解,无梯度下降。计算交叉乘积需要O(nd²),稠密SVD需要O(d³),完整n×n检索比较需要O(n²d)时间和O(n²)分数存储。
"""Original orthogonal alignment and an unobserved-direction counterexample."""
import json
import numpy as np
def matrix(x):
x = np.asarray(x, dtype=float)
if x.ndim != 2 or not 1 <= min(x.shape) or max(x.shape) > 256 or not np.isfinite(x).all():
raise ValueError('Expected bounded finite matrix')
return x
def align(x, anchor):
x, anchor = matrix(x), matrix(anchor)
if x.shape != anchor.shape: raise ValueError('Paired shapes must match')
u, s, vt = np.linalg.svd(x.T @ anchor)
return u @ vt, s
def retrieval(x, y):
x, y = matrix(x), matrix(y)
if x.shape != y.shape: raise ValueError('One corresponding target per query')
nx, ny = np.linalg.norm(x, axis=1), np.linalg.norm(y, axis=1)
if np.any(nx == 0) or np.any(ny == 0): raise ValueError('Zero embedding')
scores = (x/nx[:, None]) @ (y/ny[:, None]).T
return float(np.mean(scores.argmax(axis=1) == np.arange(len(x)))), scores
def paired_loss(x, anchor, w):
x, anchor, w = matrix(x), matrix(anchor), matrix(w)
if x.shape != anchor.shape or w.shape != (x.shape[1], x.shape[1]): raise ValueError('Invalid shapes')
return float(np.mean((x @ w-anchor)**2))
def rotation(angle):
c, s = np.cos(angle), np.sin(angle)
return np.array([[c, -s], [s, c]])
def geometry(offset=0):
a = (np.arange(8)+offset)*np.pi/4
return np.stack([np.cos(a), np.sin(a)], axis=1)
def demo():
anchor = geometry(); audio = anchor @ rotation(.8); text = anchor @ rotation(-.5)
wa, _ = align(audio, anchor); wt, _ = align(text, anchor)
held = geometry(.5)
bad, _ = align(audio, np.roll(anchor, 2, axis=0))
# Anchors on the horizontal axis cannot distinguish a vertical reflection.
observed = np.array([[-1., 0], [1., 0]])
identity, flip = np.eye(2), np.diag([1., -1.])
unseen = np.array([[0., 1], [0., -1]])
losses = [paired_loss(observed, observed, w) for w in [identity, flip]]
scores = [retrieval(unseen @ w, unseen)[0] for w in [identity, flip]]
common = rotation(.37)
before = retrieval(audio @ wa, text @ wt)[1]
after = retrieval(audio @ wa @ common, text @ wt @ common)[1]
return dict(before_accuracy=retrieval(audio, text)[0], aligned_accuracy=retrieval(audio @ wa, text @ wt)[0],
heldout_accuracy=retrieval(held @ rotation(.8) @ wa, held @ rotation(-.5) @ wt)[0],
mispaired_accuracy=retrieval(audio @ bad, text @ wt)[0],
paired_mse=paired_loss(audio, anchor, wa), singular_values=align(audio, anchor)[1].tolist(),
rank_deficient_losses=losses, rank_deficient_unseen_accuracy=scores,
common_rotation_error=float(abs(before-after).max()),
anchor=anchor.tolist(), audio=audio.tolist(), aligned=(audio @ wa).tolist(),
scope='Closed-form paired orthogonal fits, not ImageBind training or a universal transfer theorem.')
if __name__ == '__main__': print(json.dumps(demo(), indent=2))
对齐前配对检索准确率为零;对齐后,八个锚点与八个交错角度留出点都为一。交叉乘积奇异值是[4,4]。这验证了设定的旋转关系,不是零样本识别。故意把锚点配对循环移动两位,会拟合错误对应,检索准确率重新变成零。秩不足例子的两个解训练损失都为零,未见点检索准确率却分别为一和零。
锚点只能帮助保留它携带的区别
所选ImageBind方法对与图像配对的观测做对称对比学习,在所述设置中冻结图像/文字编码器。其结果依赖数据、表示和优化。若锚点模态遗漏某个重要区别,匹配锚点不会自动把该区别从其他模态找回来。本例没有证明普遍的涌现对齐。
固定发布模型先对模态特征归一化,再对多个输出使用不同logit尺度。因此,“共同空间”不表示每个返回向量都是单位范数,也不表示任意模态对分数都有相同校准。本例明确归一化后计算余弦检索,只评估配对排名。
时间同步、重复正例、错误配对、总体差异和多对一关系,都需要单独检查。正交拟合不能修复非线性畸变或凭空补足信息。较低配对损失与有用的跨模态任务成绩是相关证据,不能彼此替代。
找出无法确定的部分
- 推导。 若X=AR,R正交且锚点满秩,哪个映射能得到零误差? 答案:W=Rᵀ,使XW=ARRᵀ=A。前提是纯正交畸变,且各行配对正确。
- 诊断。 水平锚点损失为零,垂直检索为什么仍会失败? 答案:水平锚点无法区分I与反射F,两种映射在未见垂直点上不一致。
- 实现。 给两种已对齐模态共同旋转,余弦检索会改变吗? 答案:不会。正交变换保留内积和范数;但只旋转一种模态,通常会改变分数。
- 迁移。 错配锚点上的零损失能证明语义对齐吗? 答案:不能。目标服从给定对应关系;移位配对实验拟合出一致但错误的映射,检索到错误目标。
把配对、对齐和融合分开讨论
CLIP给出配对对比模型,ImageBind研究以图像为中心连接多种模态。这里的SVD推导是关于可辨识性的精确反例,不是替代两者的架构。继续读多模态融合,研究怎样组合已经对应的信息。
先判断,再看解释
在水平锚点上完美拟合,就确定了垂直方向吗?
学习目标
- 推导正交Procrustes解。
- 构造不可辨识的未见方向。
- 区分配对拟合与涌现迁移。
先修与延伸
查看知识关联图 →参考文献
- ImageBind: One Embedding Space To Bind Them All (CVPR2023)
Rohit Girdhar; Alaaeldin El-Nouby; Zhuang Liu; Mannat Singh; Kalyan Vasudev Alwala; Armand Joulin; Ishan Misra · 2023 - Learning Transferable Visual Models From Natural Language Supervision (ICML2021)
Alec Radford; Jong Wook Kim; Chris Hallacy; Aditya Ramesh; Gabriel Goh; Sandhini Agarwal; Girish Sastry; Amanda Askell; Pamela Mishkin; Jack Clark; Gretchen Krueger; Ilya Sutskever · 2021 - facebookresearch/ImageBind: imagebind/models/imagebind_model.py @53680b0
facebookresearch/ImageBind contributors
版本1 · 编写状态: 已完成记录中的技术复核
查看技术检查记录(AI)
Codex · 2026-09-20 · Single AI author checked ImageBind selected sections3.1-3.3/frozen encoders, reused unchanged CLIP source and checked fixed modality postprocessors. Six paired equations and four explained exercises; original orthogonal Procrustes derivation, trace optimum, rotations/reflections, pairing errors and rank-deficient unseen directions. No ImageBind training or universal emergent-transfer theorem.
- 核SVD迹上界、反射/旋转、共同坐标不变、错误配对及未见方向歧义;零锚点损失不是普遍迁移保证。
- 每题四张计算SVG;15数值/几何与36响应式组合通过,实看12张最终中文手机/英文桌面图。初版文案整理和英文手机标题越界修正保留;完整页面验收另记。
核对的来源位置:
- ImageBind: One Embedding Space To Bind Them All (CVPR2023) · Read sections3.1-3.3 and selected frozen-encoder setup in4; PDF3 viewed. Emergent alignment is an empirical report, not a universal theorem.
- Learning Transferable Visual Models From Natural Language Supervision (ICML2021) · Read selected2.2-2.3, Figure3 and candidate-classification description; PDF page3 viewed. No original training or natural-image benchmark reproduction.
- facebookresearch/ImageBind: imagebind/models/imagebind_model.py @53680b0 · Read418-470: modality postprocessing and call order. Fixed LICENSE says CC BY-NC-SA4.0; heading/opening only. No code/weights reused.
相关主题