话本小说网 > 幻想小说 > 数学使徒(MathematicalApostle)
本书标签: 幻想 

范畴论(解释)一

数学使徒(MathematicalApostle)

读《on the power of foundation

model》-从范畴论的角度理解foundation

model

用范畴论的框架来解释我们在做什么

• 旧有的语言--初等函数论的角度:我们希望学习一个函数f:X → Y so that accurately predicts the label x∈X . We also define a loss function $ L(f(x),y) $ to measure the distance between the prediction $f(x)$ and the correct label, which is hopefully close to 0 .

• 范畴论的语言:我们有两个范畴: X 和 y ,我们想学习的是一个functor F X → y;它能够给出input X的正确output Y。

注:范畴和简单变量的最大区别在于,它的物体之间还存在态射(morphism),是一种更加复杂的事物。

假如说唯一存在的态射是恒等态射,那么跟初等函数论之间也没什么区别。In this case, learning F is impossible, because it maps a set to another set without anyprior knowledge.(等于你对所有X,Y之间可能的所有映射做随机抽样)

第一个重点来了!:

传统的学习理论对F的class做假设来证明有一些算法更加有优势,因为他们没有对X本身的结构做出限制(事实上也没有这个可能,因为他们的建模不对);而本文假设范畴 X 具有更多的“抓手”, F 作为functor能保留这些性质,那么它也可能更加好学!

注意:这里的“好学”更多的是说是否learnable,而不涉及到具体适合的算法。这种functor是否能被学到,也有助于我们查清楚一种任务上的能力能否迁移到另外一种任务。

疑惑:可没有态射随机抽样总是能学到的?

答:有这种态射+ideal foundation model, prompt+微调就可以进行学习。

第二个重点:Pretask的价值:

一言以蔽之:all the existing pretext tasks can be seen as building morphisms between two objects in C .

注:我觉得还有一句话:假如foundation model完全学到了pretask的信息(正如下文所定义的ideal foundation model那样),那么它在微调前所拥有能力能解决的全部任务就是所构建的态射诱导的functor的同构集。

对以上注的两点补充:

一、functor的同构:1.F和G同构通过η ,如果对任意态射f, η 诱导的态射与functor可交换。2, η 诱导的态射是同构,对每一个object.

所以如果functor之间不同构,那么他们俩之间的同一个input的像一定有不同构的。这对之后解任务的定义至关重要。

第三个重点:什么是好的foundation model?

• 它是一个 f:C → H 的representation learning的过程

• 它应该要学会所有pretask所定义的态射(morphism)

• 受RKHS的启发,最后给出如下定义:

Definition 2 (Ideal foundation model).Giνen α cαtegory C defined by α pretext tαsk, α foundαtion modelf:C → H is ideαl,if there exists α dαtα-obliνious function kf:H × H → Set so thαt for αny X。Y ∈ C。kf(f(X),f(Y))= Homᴄ(X,Y).

第四个重点:任务是什么?什么叫做解决了一个任务?

Definition 4 (Task). A tαsk T is α functor in C⌃.

Definition 5 (Task solving). We sαy the model solνes α tαsk T,if for αny input X ∈ C,the model outputs α solution thαt is isomorphic to T(X).

其中

Theorem 3 (Generalization theorem for structural learning). Consider twο cαtegories B,C αnd α full embedding F:C → B. In the leαrning scenαrio,αn ideαl foundαtion model hᴄ for C together with α feαture-αligned functor F:F:C ⌃ → B⌃,preserνes the structure of C in α full subcαtegory A of B:for αny X,Y ∈ C,Homᴄ(X,Y) ≃ Homᴀ⌃ (F(hᴄ(X)),F(hᴄ(Y))). Moreoνer,when hʙ is αναilαble αnd inνertible,we hανe F(X) ≃ hʙ⁻¹(F(hᴄ(X))) for αny X ∈ C.

是 C → Set 的functor的范畴。

注:定义五和之前supervised learning的定义是一致的,区别在于两点:

• 像是 Set 范畴。这个范畴有点抽象,我还不太明白。

• 在同构意义下和“coorect label”相等。

范畴论可以给出的结果

1. Prompt可以解决所有representable的问题:

Definition 6 (Representable functor).A functor T ∈ C⌃ is representαble if there is αn isοmοrphism hᴄ(X) ~ T for sοme X ∈ C.Such οbject X is cαlled α representαtiνe of T.

这和我之前所说的能解决所构建的态射诱导的functor的同构集是一致的。

2. 给与足够的资源(能训练出来ideal foundation model),finetuneing能解决所有任务。

这有点像告诉我们ideal foundation model所得到的f总是在某种意义下可逆的。是一个lower bound.

• 思考:prompt所得到的解和正确解是一个同构。有些时候这可以被接收(比如说有很多多样化的图片同构),有时候这不可以被接受,需要重新拟合训练得到这个同构。这个过程更像我们实际中在用的finetune,而上文所提到的finetune其实有点像一个lowerbound,就是“我总能把他扭回来。

现在考虑学习两个更加具体的category之间的functor:

有C (比如说描述图片的语言范畴)和 B(图片范畴),想学习functor F C → B 。直接学习或许有点抽象。

但我们现在有两个在pretask上学习的functor: hᴄ 和 hb 。他们把object打到feature space里,那我们能不能在feature space里面学习,使得我们可以找到 F(X) 的同构类,对任意 X∈C ? 更加宽泛的说,能不能把 C 的strutucal infomation(态射) 在 B 的feature space的态射中再现出来?

答案是肯定的,但我们需要在feature space里面学一个feature-aligned functor:

Definition 7 (feature-aligned functor).Giνen twο cαtegories B,C.α full embedding F: C⌃ → B⌃,denote the corre-sponding foundαtion model αs hʙ,hᴄ. A function F:C⌃ → B⌃,is feαture-αligned with F if for αny X ∈ Ob(C),

F(hᴄ(X)) ≃ hʙ(F(X)).

注意:Clip在embedding space里面做pair就可以理解为在学习这个 F

然后我们有

Theorem 3 (Generalization theorem for structural learning). Consider twο cαtegories B,C αnd α full embedding F:C → B. In the leαrning scenαrio,αn ideαl foundαtion model hᴄ for C together with α feαture-αligned functor F:F:C ⌃ → B⌃,preserνes the structure of C in α full subcαtegory A of B:for αny X,Y ∈ C,Homᴄ(X,Y) ≃ Homᴀ⌃ (F(hᴄ(X)),F(hᴄ(Y))). Moreoνer,when hʙ is αναilαble αnd inνertible,we hανe F(X) ≃ hʙ⁻¹(F(hᴄ(X))) for αny X ∈ C.

注意:这里有一个full embedding的要求。这意味着你想要迁移的原始object不能比迁移后的structure infomation还要多,且在这些object上,他们应该要能够同构。

同构这一点实际不能完成:同一句话可能对应多张图片;所以我们需要Dalle-E2:because these two categories are not purely isomorphic. When we type “a photo of dog”, there exists millions of different matching images. Therefore, Dall-E2 modifies the definition of image category, so that each object is a probability distribution of images. From this perspective, the diffusion model is a generator of images, while Clip learns the functor from the category of texts to the category of probability distributions of images

从clip到dalle-2的演变,或许可以motivate出新的工作??

一个横贯本文的问题:虽然同构在数学上很优美,但是鉴于这个同构映射一直在变化,它真的有那么好学吗??

上一章 Stewart Shapiro SEP原文(二) 数学使徒(MathematicalApostle)最新章节 下一章 数学哲学译文丨综合数学简介