On Affine Homotopy between Language Encoders

Authors: robin s m chan
reda  boumasmoud
anej  svete
yuxin  ren
qipeng  guo
zhijing  jin
shauli  ravfogel
mrinmaya  sachan
bernhard  schölkopf
mennatallah  el-assady
ryan  cotterell
eth  zürich
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-15 16:37:17

Abstract: Pre-trained language encoders---functions that represent text as vectors---are an integral component of many NLP tasks.
    We tackle a natural question in language encoder analysis: What does it mean for two encoders to be similar?
    We contend that a faithful measure of similarity needs to be \emph{intrinsic}, that is, task-independent, yet still be informative of \emph{extrinsic} similarity---the performance on downstream tasks.
    It is common to consider two encoders similar if they are \emph{homotopic}, i.e., if they can be aligned through some transformation.
    In this spirit, we study the properties of \emph{affine} alignment of language encoders and its implications on extrinsic similarity.
    We find that while affine alignment is fundamentally an asymmetric notion of similarity, it is still informative of extrinsic similarity.
    We confirm this on datasets of natural language representations.
    Beyond providing useful bounds on extrinsic similarity, affine intrinsic similarity also allows us to begin uncovering the structure of the space of pre-trained encoders by defining an order over them.

Main paper: 
 introduction: 
 A common paradigm in modern natural language processing (NLP) is to pre-train a language encoder on a large swathe of natural language text. Then, a task-specific model is fit (fine-tuned) using the language encoder as the representation function of the text. More formally, a language encoder is a function h : Σ ˚Ñ R D , i.e., a function that maps a string over an alphabet Σ to a finite-dimensional vector. Now, consider sentiment analysis as an informative example of a task. Suppose our goal is to classify a string y P Σ ˚as one of three polarities Π " t , , u. Then, the probability of y exhibiting a specific polarity is often given by a log-linear model, e.g., the probability of is pp | yq " softmaxpE hpyq `bq (1) where E P R 3ˆD , b P R 3 and softmax : R N Ñ ∆ N ´1. Empirically, using a pre-trained encoder h leads to significantly better classifier performance than training a log-linear model from scratch.In the context of the widespread deployment of language encoders, this paper tackles a natural question: Given two language encoders h and g, how can we judge to what extent they are similar? This question is of practical importance-recent studies have shown that even small variations in the random seed used for training can result in significant performance differences on downstream tasks between models with the same architecture [13, 35] In this case, we say that two such language encoders exhibit an extrinsic difference, i.e., the difference between two encoders manifests itself when considering their performance on a downstream task. However, we also seek an intrinsic notion of similarity between two language encoders, i.e., a notion of similarity that is independent of any particular downstream task. Moreover, we may hope that a good notion of intrinsic similarity would allow us to construct a notion of extrinsic similarity that holds for all downstream tasks.Existing work studies language encoder similarity by evaluating whether two encoders produce similar representations for a finite dataset of strings [3, 20, 22, 42, inter alia], often by analyzing whether the representation sets can be approximately linearly aligned [22, 27] . More formally, two encoders are considered similar if there exists a matrix A such that hpyq « A gpyq holds for strings y in some finite set D Ă Σ ˚. 2 This assumes that examining finitely many outputs provides sufficient insight into encoder behavior. In contrast, we set out to study the relationships between language encoders, i.e., functions, themselves. This decision, rather than being just a technicality, allows us to derive a richer understanding of encoder relationships, revealing properties and insights that remain obscured under conventional finite-set analysis. Concretely, we ask what notions of similarity between encoders one could consider and what they imply for their relationships.The main contributions of the paper are of a theoretical nature. We first define an (extended) metric space on language encoders. We then extend this notion to account for transformations in a broad framework of S-homotopy for a set of transformations S, where g is S-homotopic to h if g can be transformed into h through some transformation in S. As a concrete application of the framework, we study affine homotopy-the similarity of h and ψ ˝g for affine transformations ψ. The notion of intrinsic similarity induced by such one-sided alignment is not symmetric and can be seen as the cost of transforming g into h. Nevertheless, we show it is informative of extrinsic similarity: If one encoder can be affinely mapped to another, we can guarantee that it also performs similarly on downstream tasks. We confirm this empirically by studying the intrinsic and extrinsic similarities of various pretrained encoders, where we observe a positive correlation between intrinsic and extrinsic similarity.Beyond measuring similarity, homotopy also allows us to define a form of hierarchy on the space of encoders, elucidating a structure in which some encoders are more informative than others. Such an order is also suggested by our experiments, where we find that certain encoders are easier to map to than others which shows in the rank of the learned representations and affects their transfer learning ability. 
language encoders: 
 Let Σ be an alphabet-a finite, non-empty set of symbols y-and EOS R Σ a distinguished end-ofstring symbol. With Σ ˚def " Ť 8 n"0 Σ n we denote the Kleene closure of Σ, the set of all strings y. A language encoder is a function h : Σ ˚Ñ V def " R D that maps strings to real vectors. 3 We write E V def " V Σ ˚for the R-vector space of language encoders, and E b def " th P E V | hpΣ ˚q is boundedu Ă E V for its sub-vector space of bounded encoders.There are two common ways that language encoders are created [7] . The first is through autoregressive language modeling. A language model (LM) is a probability distribution over Σ ˚. 4 Autoregressive LMs are defined through the multiplication of conditional probability distributions p h py t | y ăt q as p LM h pyq " p h pEOS | yqEQUATIONwhere each p h p¨| y ăt q is a distribution over Σ Y tEOSu parametrized by a language encoder h:EQUATIONwhere E P R p|Σ|`1qˆD . An autoregressive LM provides a simple manner to learn a language encoder from a dataset of strings D " ty pnq u N n"1 by minimizing D's negative log-likelihood. We may also learn a language encoder through masked language modeling (MLM), which defines the conditional probabilities based on both sides of the masked symbol's contextEQUATIONMaximizing the log-likelihood of a corpus under a language model derived from a language encoder h with a gradient-based algorithm only requires h to be a differentiable function of its parameters. Once a language encoder has been trained on a (large) corpus, its representations can be used on more fine-grained NLP tasks such as classification. The rationale for such transfer learning is that representations h pyq stemming from a performant language model also contain information useful for other downstream tasks on natural language. An NLP practitioner might then implement a task-specific transformation of h pyq. To tackle the problem that the tasks of interest are often less resource-abundant and to keep the training costs low, task-specific transformations are usually simple, often in the form of linear transformations of h pyq, as in Eq. ( 1).VpV,∆q ph, gq ď cpλqd H AffpV,W q ph, gq.3. d AffpV q ph, gq " 0 ñ d H AffpV,W q ph, gq " 0 ñ d H VpV,∆q ph, gq " 0.Lem. 5.2 shows that Á Ext is finer than Á Aff . This means that the affine intrinsic preorder is contained in the extrinsic preorder, i.e., h Á Aff g ñ h Á Ext g. Lastly, we can show that d H VpV,∆q ph, gq is upper bounded by the intrinsic hemi-metric d H AffpV q . Theorem 5.1 (ϵ-Intrinsic ñ Opϵq-Extrinsic). Let h, g P E V be two encoders. Then,d HVpV,∆q ph, gq ď cpλq d H AffpV q ph, gq.6 Linear Alignment Methods for Finite Representation Sets § § 4 and 5 introduce ways of comparing language encoders as functions, which holistically characterizes relationships between them. We now address a more practical concern: Given two language encoders h and g, how can we approximate their similarity in practice? Rather than comparing h pyq : Σ ˚Ñ R D with g pyq : Σ ˚Ñ R D over the entire Σ ˚, 19 we compare them over a finite set of strings Y " ty pnq u N n"1 . We combine Y's representations given by h and g into matrices H, G P R N ˆD , where we denote H y,¨" h pyq and G y,¨" g pyq. We can approximate the notions of similarity from §3 by optimizing over the affine maps AffpV q (for example, using gradient descent). Particularly, we approximate intrinsic similarity asEQUATIONand extrinsic similarity for some task-specific fixed ψ 1 asEQUATIONUnfortunately, the max over Y makes the optimization in Eqs. ( 19) and ( 20) difficult. For simplicity, we turn to commonly used linear alignment methods, which we review for completeness.Orthogonal Procrustes Problem. Rather than optimizing the infinity norm over Y as Eqs. ( 19) and ( 20), the orthogonal Procrustes problem finds the orthogonal transformation minimizing the Frobenius norm [34] by solving argmin APOpV q }H´AG} F . Given the singular-value decomposition H J G " UΣV J , the optimum is achieved by UV J . 20 Since the argmin is over OpV q, this defines an extended pseudo-metric space by Prop. 3.1.. CCA [20] is a linear alignment method that finds the matrices A, B that project H and G into subspaces maximizing their canonical correlation. Let A ¨,j and B ¨,j be the jth column vectors of A and B, respectively. The formulation is as followsEQUATIONThe representation similarity is measured in terms of the goodness of CCA fit, e.g., the mean squared CCA correlation R 2 CCA "ř D i"1 ρ 2 i {D.We can reformulate the CCA objective in Eq. ( 21) asEQUATION)Given the singular-value decomposition H J G " UΣV J , the solution of Eq. ( 22) is p Â, Bq " ppHH J q ´1 2 U, pGG J q ´1 2 Vq, where pHH J q ´1 2 and pGG J q ´1 2 are whitening transforms of U and V. Assuming the data is whitened during pre-processing, CCA corresponds to linear alignment under an orthogonality constraint, equivalent to the orthogonal Procrustes problem; see also App. E.CCA Extensions. Projection-weighted CCA (PWCCA) [30] also finds alignment matrices with CCA but applies weighting to correlation values ρ i to report the goodness of fit. Given the canonical vectors Â, PWCCA reports ρPW " We then fit H piq to H pjq with an affine map and report the goodness of fit through the max error L2 norm, i.e., an approximation of dpH pjq , H piq q on row i and column j of the grid. Full results across GLUE tasks are shown in Figure 4 .ř D i"1 α i ρ i { ř i α i , where α i " ř j |x Â¨,i , H ¨,j y|. 21Non-Alignment Methods. While not explicitly (linearly) aligning representations, CKA [22] evaluates the kernel similarity between representations. CKA computes the normalized Hilbert-Schmidt independence [18] between centered kernel matrices K H and K G where K H ij " kpH i,¨, H j,¨q , and K G ij " kpG i,¨, G j,¨q for a kernel function k, i.e., trpK H K G q{ a ptrpK H JK H qtrpK G JK G qq. Linear CKA, where kpH i,¨, H j,¨q " H J i,¨H j,¨, is commonly used.VpV,∆q ph, gq ď cpλqd H AffpV,W q ph, gq.3. d AffpV q ph, gq " 0 ñ d H AffpV,W q ph, gq " 0 ñ d H VpV,∆q ph, gq " 0.Proof.1. Clearly,d H 8,∆ N ´1 psoftmax λ pψ ˝hq, V N pgqq ď cpλqd VpV,W q pψ ˝h, Aff V,W pgqq ď cpλq inf ψ 1 Pψ˝AffpV q }ψ ˝h ´ψ1 ˝g} 8,W " cpλq inf ψ 1 PAffpV q }ψph ´ψ1 ˝gq} 8,W" cpλq}ψ lin }d AffpV q ph, gq.34 close enough to hpB h q.where, the first inequality follows from the that softmax λ is cpλq-Lipschitz for some constant that depends on λ [16, Proposition 4].2. & 3. are are immediate consequences of 1. ■ Theorem 5.1 (ϵ-Intrinsic ñ Opϵq-Extrinsic). Let h, g P E V be two encoders. Then, d H VpV,∆q ph, gq ď cpλq d H AffpV q ph, gq.Proof. Let ψ P AffpV, W q. There exists a linear map A : V Ñ W and a ϕ V P GLpV q, such that ψ " A ˝ϕ and }A} " 1. Accordingly, Lem. 5.2 yieldsEQUATIONEQUATIONď cpλq supEQUATION" cpλq d H AffpV q ph, gq.Therefore d H VpV,∆q ph, gq ď cpλq d H AffpV q ph, gq. ■ 
measuring the alignment of langauge encoders: 
 We begin by introducing measures of affine alignment and hemi-metrics on E V .Language encoders compute representations for the infinitely many strings in Σ ˚. In general, these representations might diverge towards 8, making it necessary to talk about unbounded encoders, where it is convenient to allow distances and norms to take extended real numbers as values. 5Definition 3.1. An extended metric on a set X is a map d : X Ñ R `such that a. @x, y P X, dpx, yq " 0 iff x " y;(Identity) b. @x, y, z P X, dpx, yq ď dpx, zq `dpz, yq;(Triangle Inequality) c. @x, y P X, dpx, yq " dpy, xq.Similarly, an extended norm is a map } ¨} : X Ñ R `that satisfies the norm axioms. Moreover, we will consider maps d that do not satisfy the symmetry axiom. Lawvere [25] notes that symmetry is artificial and unnecessary for many of the main theorems involving metric spaces. In such situations, the quantity dpx, yq can be interpreted as the cost of going from x to y. Occasionally, we want d to capture that it costs more to go from x to y than to return, making asymmetry desirable.Definition 3.2. A hemi-metric6 or Lawvere-metric on a set X is a map d : X Ñ R `such that a. dpx, xq " 0, b. dpx, zq ď dpx, yq `dpy, zq for all x, y, z P X.One of our main contributions is a formalization of measuring how far a language encoder h is from the set of all possible transformations of another encoder g-for example, from all affine transformations of g. For this, we lift a hemi-metric over elements x P X to subsets of X, a crucial for the rest of the paper.Definition 3.3. Let pX, dq be a hemi-metric space. For non-empty E, E 1 Ă X, we defineEQUATIONThe map d H is called the Hausdorff-Hoare map and is a hemi-metric on PpXqztHu, the power set of X. When E is a singleton set txu, we will, with a slight abuse of notation, write d H px, E 1 q to mean d H ptxu, E 1 q, defined as " inf yPE 1 dpx, yq. 7We next introduce the hemi-metric recipe. It tells us how one can define a hemi-metric on a set X by embedding X into the power set of another space Y where a hemi-metric already exists. After X is embedded, one can use the Hausdorff-Hoare map based on the hemi-metric from Y to define a hemi-metric on X through the images of x P X.Remark 3.1 (Hemi-Metric Recipe). Let X be a set, pY, dq a hemi-metric space, and S : X Ñ PpY qztHu, x Þ Ñ E x a function that assigns an x P X a subset E x P PpY qztHu. Using Lem. D. Remark 3.1 introduces a general recipe for defining hemi-metric spaces on function spacestopological spaces whose elements are functions from a set to subsets of an extended-metric space. This naturally applies to the study of encoders and their transformations, which we call S-homotopy, i.e., two encoders are S-homotopic if one can be S-deformed into the other. In this case, the set E h for h P E V corresponds to the set of encoders that h can be transformed into with mappings in S. We could, for example, take S as the set of all continuous maps, smooth maps, or multi-layer perceptrons.Our following discussion of affine maps, i.e., where S " AffpV q, is extrinsically motivated but can be understood as a specific instance of the more general framework of S-homotopy.The hemi-metric recipe first requires us to define a (hemi-)metric on the individual elements. Given that all norms on the R-vector space V are equivalent [24, Proposition 2. where } ¨}8 is an extended norm on E V and pE V , d 8 q is a complete8 extended metric space. 9Let GLpV q be the set of invertible DˆD matrices. We write }¨} V : GLpV q Ñ R `for the subordinate matrix norm, i.e., }A} V " sup vPV zt0u |Av| V |v| V . By abuse of language, we can view V as an affine space 10 and set AffpV q for the group of affine transformations of V . An affine transformation ψ on V is a map v Þ Ñ Av `b, for some invertible A P GLpV q and b P V . We call ψ lin def " A the linear part of ψ and t ψ : v Þ Ñ v`b its translation part. We denote with T Ă AffpV q the subgroup of translations. Note that there is a natural left action of AffpV q on E V , i.e., AffpV q ˆEV Ñ E V , h Þ Ñ ψ ˝h. 11We now use the general recipe from Remark 3.1 for affine alignment of language encoders-affinely mapping from one encoder to another. For a subset S Ă AffpV q we can defineEQUATIONwhere S phq def " ts ˝h | s P Su. In the notation of the hemi-metric recipe from Remark 3.1, we set X " Y " E V (we align an encoder with another encoder) and d " d 8 , the uniform convergence distance (cf. §3.2). Further, we take S Ď AffpV q Ă V V and define S :E V Ñ P pE V q, h Þ Ñ S phqdef " ts ˝h | s P Su. In words, d S ph, gq captures the notion of how well the encoder g can be Stransformed into h. This is commonly called the alignment of g with h. d S ph, gq does not, however, necessarily tell us anything about how well h can be S-transformed into g, resulting in asymmetry. Remark 3.2. d AffpV q defined in Eq. (8a) is not a metric on E V .12 Further, when S " AffpV q, the map inf ψ,ψ 1 PAffpV q }ψ ˝h ´ψ1 ˝g} 8 is trivially zero by Cor. D.1.In the case of affine isometries IsopV q " tψ P AffpV q | ψ lin P OpV qu we show that the pair pE V , d IsopV q q constitutes an extended pseudo-metric space. Proposition 3.1. The pair pE V , d IsopV q q is an extended pseudo-metric space. 
intrinsic affine homotopy: 
 The notion of affine alignment allows us to introduce homotopic relations on E V . We first derive the affine intrinsic preorder Á Aff on the space of encoders. 13Lemma 4.1. Let pX, dq be a hemi-metric space. The relation px Á d y iff dpx, yq " 0q is a preorder14 and it will be called the specialization ordering of d.Proof. Goubault-Larrecq [17, Proposition 6.1.8] . ■ Definition 4.1 (Intrinsic Affine Preorder). For two encoders h, g P E V , we define the relationEQUATION)Lemma 4.2. The relation Á Aff is a preorder on E V .Proof. Follows from d AffpV q pψ ˝h, gq ď }ψ lin } V ¨dAffpV q ph, gq, see App. D.3. ■Intuitively, Á Aff captures the order of encoders such that higher-positioned encoders in the order can be S-transformed to the lower-positioned ones. To derive the implications of Á Aff we introduce the notion of an encoder rank. Definition 4.2 (Encoder Rank). For any h P E V let the encoder rank be rankphq def " dim R pV h q, where V h is the subvector space generated by the image of h. When rankphq " dim R pV q, h is a full rank encoder, else it is rank deficient. Theorem 4.1. For h, g P E V , we have h Á Aff g ô h " ψpπ h ˝gq for some ψ P AffpV q (10) where, π h is the orthogonal projection of V onto V h . In particular, if d AffpV q ph, gq " 0 then rankphq ď rankpgq. If in addtion, we know rankpgq " rankphq, then g must by an affine transformation of g, i.e., h " ψ ˝g for some ψ P AffpV q. This allows us to state our first notion of language encoder similarity: intrinsic affine homotopy. Definition 4.3 (Exact Intrinsic Affine Homotopy). We say that two encoders h, g P E V are exactly intrinsically affinely homotopic and write h » Aff g if d AffpV q ph, gq " 0 and rankphq " rankpgq.For any h, g P E V , one can easily show that h » Aff g ðñ pg Á Aff h and h Á Aff gq ðñ d H, sym AffpV q ph, gq " 0,which implies that » Aff is an equivalence relation on the set of language encoders E V . Intuitively, two encoders h and g are exactly intrinsically affinely homotopic, this means that both g can be affinely mapped to h, as well as the other way around. 
extrinsic homotopy: 
 In §4, we explore methods for assessing how similar two language encoders are without reference to any downstream tasks. Here, we extend our discussion to the extrinsic homotopy of language encoders. Since language encoders are primarily used to generate representations for downstream tasks-such as in transfer learning, illustrated by the sentiment analysis example in §1-we argue that the key criterion in the similarity of two encoders lies in how closely we can align predictions stemming from their representations. 15Principle 5.1 (Extrinsic Homotopy). Two language encoders h and g are extrinsically homotopic if we can guarantee a similar performance on any downstream task h and g might be used for.The rest of the section formalizes this intuitive notion and describes its relationship with intrinsic affine homotopy. Let W be the vector space R N and set AffpV, W q as the set of affine maps from V to W . 16 We define E ∆ def " MappΣ ˚, ∆ N ´1q and E W " MappΣ ˚, W q. Lastly, we formalize the notion of a transfer learning task as constructing a classifier that uses a language encoder's string representations. Particularly, we set V N to be the family of log-linear models as followsEQUATIONwhere Aff V,W is the mapEQUATIONand softmax λ : R N Ñ ∆ N ´1 is defined for λ P R `, x P R N , and n P rN s asEQUATION)Remark 5.1. Each p ψ " softmax λ ˝ψphpyqq can be seen as a "probability distribution" over rN sV N phq " tpp˝| yq : rN s Ñ r0, 1s, ˝Þ Ñ softmax λ ˝ψphpyqq ˝| ψ P AffpV, W qu.Through our standard recipe from Remark 3.1, we can define the following hemi-metrics on E V . Definition 5.1. For any two encoders h, g P E V , we define17 EQUATIONEQUATIONNotice that we use d H rather than d in Def. 5.1 since we are interested in how closely we can bring h and g when we affinely transform both of them-this corresponds to independently affinely transforming the encoders for the same transfer learning task. In particular, Eq. (17b) measures how different two encoders are on any transfer learning task, formalizing the notion of extrinsic homotopy (cf. Principle 5.1), captured by the following definition. Definition 5.2 (Extrinsic Affine Preorder). An encoder h P E V is exactly extrinsically homotopic to 18 g P E V if d H VpV,∆q ph, gq " 0.Analogously to Def. 4.1, we use d H VpV,∆q ph, gq to define a preorder. Definition 5.3 (Extrinsic Affine Preorder). For two encoders h, g P E V , we define the relationh Á Ext g iff d HVpV,∆q ph, gq " 0.Lemma 5.1. The relation h Á Ext g is a preorder on E V .We now relate d H AffpV,W q ph, gq and d H VpV,∆q ph, gq from Def. 5.1, and d AffpV q ph, gq from §4. Lemma 5.2. Let h, g P E V . We have 1. There exists a constant cpλq ą 0 such that for any ψ P AffpV, W q d H 8,∆ N ´1 psoftmax λ pψ ˝hq, V N pgqq ď cpλq}ψ lin }d AffpV q ph, gq. 
experiments: 
 We now explore the practical implications of our theoretical results. We conduct experiments on ELECTRA [6] , ROBERTA [28] , and the 25 MULTIBERT [35] encoders, which are architecturally identical to BERT-BASE [11] models pre-trained with different seeds. We report results on the training sets of two GLUE benchmark classification tasks: SST-2 [38] and MRPC [14] . When reporting d and dψ 1 from Eq. ( 19) and Eq. ( 20), we use the L 2 norm for simplicity and approximate d H VpV,∆q as dH VpV,∆q pH, Gq " supEQUATION)The experimental setup and compute resources are further described in App. F.The Intrinsic 'Preorder' of Encoders. We first investigate whether the asymmetry of d AffpV q is measurable in the finite alphabet encoder representations. Figure 1 shows distinct vertical lines for both tasks indicating that there are encoders that are consistently easier to affinely map to p Ñ Mq. This seems to be rather independent of which encoder we map from pM Ñ q. We further see that this trend is task-independent for early layers but diverges for later layers.The Influence of Encoder Rank Deficiency. As discussed in §4, the encoder rank plays a pivotal role in affine mappability; exact affine homotopy is only achievable between equal-rank encoders. 22With this in mind, we return to our findings from Figure 1 to evaluate whether the observed differences against intrinsic similarity ( dAffpV q ) across GLUE tasks. We group the points by how well we can map to each encoder ( Ñ M), and display the median, as well as the first and third quartiles as vertical and horizontal lines. We additionally show the linear regression from dAffpV q to dψ 1 .between encoders can be attributed to a difference in measurable rank. Due to the inaccuracies of computing the rank numerically, we approximate the encoder rank using the rank to precision ϵ as the number of representation matrix singular values larger than some ϵ P R. 23 We find statistically significant (p-value < 0.05) rank correlation with the median intrinsic distance dAffpV q when mapping to the corresponding encoder for RTE (ρ " 0.312), MRPC (ρ " 0.609), and QQP (ρ " 0.389). We find no statistically significant correlations with the median distance when mapping from the corresponding encoder. This difference in encoder ranks could, therefore, partially explain the previously observed differences in affine mappability as some encoders seem to learn lower-rank representations.A Linear Bound on Extrinsic Similarity. Lem. 5.2 derives a relationship between affine intrinsic and extrinsic similarity. To evaluate its strength in practice, we measure Spearman's Rank Correlation (ρ) and Pearson Correlation (PCC) between intrinsic measures introduced in §6 and the extrinsic measures dψ 1 and dH VpV,∆q . PCC measures the strength and direction of a linear relationship between two random variables, whereas Spearman's ρ additionally evaluates the variables' monotonic association. dψ 1 is computed by training a linear classifier ψ 1 P AffpV q on the final MULTIBERT layer for each task. Further, we report dHVpV,∆q as the maximum L 2 loss for a large number of randomly generated 24 classifiers ψ 1 on the final layer of each MULTIBERT encoder. We generate 100 such classifiers for a range of GLUE datasets. 25 Table 1 show significant, large linear correlation prevalent in all linear alignment methods, whereas CKA-a linear, non-alignment method-does not capture extrinsic behavior as faithfully. Further, Figure 2 visualizes the linear relationship explicitly for all considered GLUE datasets. 
discussion: 
 We set out to explore homotopic relationships between language encoders, augmenting existing work on the similarity of finite representation sets by holistically studying encoder functions. In particular, the general framework of S-homotopy allows us to study any functional relationship between encoders, enabling the exploration of many types of encoder relationships. As a first step in this direction and a concrete example, §4 explores affine homotopy, discussing what it means to be able to align two models with affine transformations. Here, Hausdorff-Hoare maps prove useful, as they allow us to measure a notion of (asymmetric) distance between a point-an encoder-and the set of all affine transformations of another encoder. Lem. 5.2 in §5 then connects the intrinsic, Intrinsic Measure dAffpV q Orth. Procrustes R task-independent, similarly to extrinsic similarity-the similarity of performance on downstream tasks. Concretely, it derives a linear relationship between the intrinsic and extrinsic dissimilarity for any fixed affine transformation ψ 1 (i.e., a fixed downstream task). Thm. 5.1 discusses a stronger bound, namely on the worst-case extrinsic dissimilarity among all downstream linear classifiers, i.e., among all possible tasks. Further, by accounting for the asymmetries of encoder relationships, we augment the work on similarity in proper metric spaces [3, 36, 42] .Although encoders may not be affinely related in practice, empirical evidence in §7 suggests that notions of affine order still surface (cf. Tab. 1, Fig. 2 ), particularly as differently initialized BERTs exhibit variations in downstream task performance [29] . While other similarity measures, such as those used in seed specificity tests [12] , are designed to remain invariant to initialization changes, our results indicate that intrinsic affine homotopy is appropriately sensitive to them. This sensitivity raises new questions about the landscape of pre-trained encoders; as seen in Fig. 1 , asymmetry in intrinsic affine similarity among similarly pre-trained encoders impacts downstream performance, as corroborated by Lem. 5.2 and empirical results in Tab. 1. Differences in representation ranks may partly explain this asymmetry-mapping between artificially generated rank-deficient encoders yields mostly symmetric affine distances (cf. Fig. 3 ). Another explanation might be that easy-to-learn encoders might be approximately linear combinations of others, making them easy to map to but not necessarily from. Overall, our findings highlight the need to account for directionality in encoder similarity measures to address the asymmetry inherent in this problem. 
conclusion: 
 We discuss the structure of the space of language encoder in the framework of S-homotopy-the notion of aligning encoders with a chosen set of functions. We formalize affine alignment between encoders and show that it provides upper bounds on the differences in performance on downstream tasks. Experiments show our notion of intrinsic affine homotopy to be consistently predictive of downstream task behavior while revealing an asymmetric order in the space of encoders. 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?Answer: [NA] Justification: The paper poses no such risks.Guidelines:• The answer NA means that the paper poses no such risks.• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters. • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images. • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.12. Licenses for existing assets Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?Answer: [Yes] Justification: We cite the original paper that produced each re-used code snippet and dataset. We provide licenses for all models and datasets used in App. F.Guidelines:• The answer NA means that the paper does not use existing assets.• The authors should cite the original paper that produced the code package or dataset.• The authors should state which version of the asset is used and, if possible, include a URL. • The name of the license (e.g., CC-BY 4.0) should be included for each asset.• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided. • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided. 
 
 Appendix: This paper presents foundational research about the similarity of language encoders. To the best of our knowledge, there are no ethical or negative societal implications to this work.IntroducedD Size of string representations. §1 V D-dimensional R-vector space. §2 R `R`Y t8u Def. 3.1 rN s Ă N The set t1, . . . , N u for N P N. §5 ∆ N ´1The N ´1-dimensional probability simplex. §1 E VThe vector space of language encoders. §2 E bThe subspace of bounded language encoders. §2 AffpV qThe set of (invertible) affine transformations on V .The group of all invertible linear maps on V to itself.The orthogonal group of V ; the group of norm-preserving linear maps on V §3.3d A general (hemi-)metric. Def. 3.2 d 8The 8 (uniform convergence) norm on E V .The Hausdorff-Hoare map of d.Def. 3.3 d H, symThe symmetrized Hausdorff-Hoare map.The Hausdorff-Hoare map where the sets in the arguments are computed by applying all transformations s P S to the two input elements.Eq. ( 8)d SOne-sided affine alignment measure over S.The S-homotopy norm of an encoder. Eq. (8a) Á A preorder.An equivalence relation. §4Table 2 : A summary of notation used in the paper.In this section, we address some of our work's limitations.Non-Linear Encoder Relationships. This work focuses on affine similarity between encoders.As we find and discuss in §4 with the example of MULTIBERTs, language encoder representations may generally not be exactly affinely related. Nevertheless, understanding the affine-homotopy relationships on E V still helps us to make conclusions about practical findings as in §7.Linear Classifiers. Our work provides precise theoretical guarantees on the performance of linear classifiers applied to affinely-related encoders. In practice, task fine-tuning can take the form of more complex models, such as re-training entire pre-trained models. This work does not cover such more complex fine-tuning techniques.Numerical Approximations. To bridge our theoretical findings on affine homotopy relationships in E V with their practical implementations in §7, we concede several approximations. For instance, while d H VpV,∆q is valuable in analysis, optimizing Eq. ( 23) directly is computationally challenging and requires costly approximations. Similarly, in computing intrinsic distances across all representation layers in Fig. 1 , we optimize for mean squared error (MSE) and evaluate the maximum loss instead of optimizing for it directly, which serves as an approximation of d that results in more stable optimization given computational constraints. Finally, we address numerical inaccuracies encountered during singular value decomposition (SVD) computations in §7, which we mitigate by tuning the rank according to precision ϵ.In this section, we complement our discussion in §6 and §8 with additional related work.Representational and Functional Similarity. Our work is related to the ongoing efforts to quantify the similarity between neural networks. Much related work discusses similarity measures in terms of the invariance properties of neural networks [12, 22, inter alia]; see Klabunde et al. [21] for a recent comprehensive survey. Notably, Klabunde et al. [21] compile various representational [19, 23, 27, 32, 39, inter alia] and functional ways to measure similarity, which are related to our notions of intrinsic and extrinsic homotopy, respectively. Whereas our notion of intrinsic affine homotopy fits into the class of linear alignment-based measures [12, 27, 42, inter alia] as described in §6, the notion of extrinsic similarity fits into the broader category of performance-based functional measures [1, 8, 26] . Most relevantly, Boix-Adsera et al. [3] propose the GULP metric that provides a bound on the expected prediction dissimilarity for norm-one-bounded ridge regression.Similarity Measures as Metrics. A line of work draws from statistical shape analysis [37] to motivate the development of similarity measures that are that conform to axioms of valid metrics [3, 36, 42] . Learning within proper metric spaces provides certain theoretical guarantees [2, 5, 10, 41, 43] . For example, Williams et al. [42] derive two families of generalized shape metrics, modifying existing dissimilarity measures to ensure they meet metric criteria. Notably, one of these generalized shape metrics is based on linear regression over the group of linear isometries, similar to the approach derived for encoder maps in Prop. 3.1.Understanding Similarity of Language Encoders. Finally, several previous works characterize the landscape of language encoders and their sensitivity to slight changes to the pre-training or fine-tuning procedure [9, 13, 44] . This prompted multi-seed releases of encoders such as BERT [35, 44] that are frequently used for robustness or sensitivity analysis [12, 33] , similar to the one presented in this work.In this section, we provide additional derivations and proofs complementing the discussion in §3- §5. Example D.1. An example of a specialization ordering is the prefix ordering of strings ď prefix 28 . More precisely, for any y, y 1 P Σ ˚, we define d Σ ˚py, y 1 q to be zero if y is a prefix of y 1 and 2 ´n otherwise, where n is the length of the longest prefix of y that is also a prefix of y 1 . Then pΣ ˚, d Σ ˚q is a hemi-metric space whose specialization ordering is ď prefix . // Lemma D.1. Let pX, dq be a hemi-metric space.1. The set tx P X | d H px, Eq " 0u is exactly the closure of E in the open ball topology.2. For any x, x 1 P X, we have the inequality d H px, Eq ď dpx, x 1 q `dH px 1 , Eq. If d is a metric, then d H p¨, Eq is 1-Lipschitz from pX, dq to R `.3. Let Z Ă PpXq be any space of non-empty subsets of X. The Hausdorff-Hoare map d H is hemi-metric on Z. Its specialization orderingÁ d H is given by E Á d H E 1 iff 29 E Ă clpE 1 q, iff clpEq Ă clpE 1 q.Proof. See Goubault-Larrecq [ defined in Eq. (8a) is not a metric on E V . 30 Further, when S " AffpV q, the map inf ψ,ψ 1 PAffpV q }ψ ˝h ´ψ1 ˝g} 8 is trivially zero by Cor. D.1.Proof. To see that d AffpV q is not a metric, consider the following two encoders: gpyq " |y| ¨e, where e P V is any fixed vector, and h be any map from Σ ˚to the ball Bp0 V , 1q of radius one. In such a case, we have d AffpV q ph, gq " 8. Even on the space of bounded encoders 31 d AffpV q is not a metric. We provide the following counter-example: Let h be any rank R encoder, e.g., h can be any map that sends the first R strings to the basis of V . Let A be a non-invertible linear map of V and set g " Aphq. Then clearly d AffpV q ph, gq " 0, but d AffpV q pg, hq can not be zero for dimensionality reasons (see Thm. 4.1).EQUATION)is an extended pseudo-metric on PpE V qztHu.Proof. pSphq, Spgqq is an extended pseudo-metric on E V . Lemma D.3. For any h, g P E V , any ψ P IsopV q and any non-empty S Ă E V , we haveItEQUATIONIn particular, d IsopV q pψ ˝h, gq " d IsopV q ph, gq. For any ψ P AffpV q and any h P E V , we then haveψ ˝h P E b ô h P E b ô }h} 8 ă 8.Lemma D.4.1. If h P E b , then }h} IsopV q " }h} T " r h , where r h denotes the radius of h, which we define as the radius of the minimum enclosing ball of the set hpΣ ˚q, and the } ¨}IsopV q norm is defined as in Eq. (8).2. For any ψ P AffpV q and a subset S Ă AffpV q normalized 32 by ψ and containing T . Then}ψ ˝h} S ď }ψ lin } V ¨}h} S ,where the } ¨}S norm is defined as in Eq. (8).Proof. 30 See App. D.2 for a derivation. 31 Recall E b def " th P EV | hpΣ ˚q is boundedu. 32 The set S is normalized by ψ if ψ ´1 ˝ϕ ˝ψ P S for all ϕ P S.1. Let t P T be the translation moving the center of the ball enclosing hpΣ ˚q to the center 0 V . Hence }h} IsopV q ď }h} T ď }t ˝h} 8 " r hNow observe that for any other isometry ψ ‰ t, then r ψ˝h " r h . The ball Bp0 V , }ψ ˝h} 8 q clearly contains all points in ψ ˝hpΣ ˚q, hence by definition of the radius r ψ˝h we must have }ψ ˝h} 8 ď r h , which finishes the proof of 1.2. Write ψ " ϕ lin ˝t, with t P T . We then have Proof. Since d AffpV q pψ ˝h, gq ď }ψ lin } V ¨dAffpV q ph, gq (see Lem. D.4), d AffpV q ph, gq " 0 ô d H AffpV q ph, gq " 0.}ψTherefore, the relation Á Aff is the specialization ordering of the hemi-metric d H AffpV q . ■ Theorem 4.1. For h, g P E V , we have h Á Aff g ô h " ψpπ h ˝gq for some ψ P AffpV q (10)where, π h is the orthogonal projection of V onto V h . In particular, if d AffpV q ph, gq " 0 then rankphq ď rankpgq. If in addtion, we know rankpgq " rankphq, then g must by an affine transformation of g, i.e., h " ψ ˝g for some ψ P AffpV q.Proof.1. Recall from §3.2 that E V is complete with respect to the metric d 8 . The condition dph, gq AffpV q " 0 simply means that there exists ϕ n P AffpV q such that lim nÑ8 ϕ n ˝g " h in E V , in other words h P Affpgq, i.e., h lies in the closure of Affpgq in E V .Let B h Ă Σ ˚such that h q is a basis for V h . Therefore, there exists ϵ ą 0 such that any family 34 pv y q y P ź yPB hBphpyq, ϵq has rank dim R pV h q. This shows that there exists N ě 1 such that for any n ě N one has }h ´ϕn ˝g} 8 ă ϵ, and rankptϕ n ˝gpyq : y P B h uq " rankphq.Which implies in particular dim R pV h q ď dim R pV g q i.e., rank h ď rank g.2. If rankpgq " rankphq " D, then lim nÑ8 ϕ n " ϕ, where ϕ is the affine map given by gpyq Þ Ñ hpyq for y P B h . Indeed, for any v " ř bPB h λ b b P V , we have }pϕ ´ϕn qpvq} ď }h ´ψn ˝g} 8ÿ bPhpB h q |λ b | ď c}h ´ψn ˝g} 8 }v} Vfor some constant c ą 0, since all norms on V are equivalent. Hence, lim nÑ8 }ϕ ´ϕn } V " 0, which shows the claim. Accordingly, we must have ϕ ˝g " h. Now we can prove Eq. ( 10):3 ñ. Given that }h ´πh ˝ϕn ˝g} 8 ď }h ´ϕn ˝g} 8 , we also have lim nÑ8 π h ˝ϕn ˝g " h.Write π K for the orthogonal projection on V K and set π h,n " π h '1 n}ϕn} π K h . Note that lim nÑ8 π h,n " π h . Accordingly, lim nÑ8 ψ n pπ ˝gq " h, where ψ n " π h,n ϕ n π ´1 h,n .From this, we deduce that d AffpV q ph, π h ˝gq " 0. Now applying 2. yields h " ϕpπ h ˝gq for some ϕ h P AffpV h q, or h " ϕpπ h ˝gq where ϕ " ϕ h ' π K h P AffpV q. 3 ð. Assume now that h " ϕpπ h ˝gq for some ϕ P AffpV q. Then h " lim nÑ8 ϕ ˝πh,n pgq, where π h,n " π h ' 1 n π K h , which shows the desired implication. ■ D.4 Proofs: Extrinsic Homotopy Lemma 5.2. Let h, g P E V . We have 1. There exists a constant cpλq ą 0 such that for any ψ P AffpV, W q d H 8,∆ N ´1 psoftmax λ pψ ˝hq, V N pgqq ď cpλq}ψ lin }d AffpV q ph, gq.Linear Regression A common way to evaluate the similarity of two representation matrices H P R N ˆD and G P R N ˆD is through linear regression. Linear regression finds the matrix Â P R DˆD that minimizes the least squares error:EQUATIONLet H " Q H R H and G " Q G R G be the QR-decomposition of H and G, respectively. The goodness of fit is commonly evaluated through the R-squared value R 2 LR , i.e., as the proportion of variance in G explained by the fit:EQUATIONTo derive Eq. ( 30), consider the fitted value ĜĜ " H Â " HpH J Hq ´1H J G (31a)EQUATIONThe residuals are thereforeEQUATION" trppG ´Ĝq J Gq (32b, residuals orthogonal to fitted values)EQUATIONWith this, we can compute the coefficient of determination asEQUATIONOrthogonal Procrustes Problem. Let G P R ˆD and H P R N ˆD representation matrices. In the orthogonal Procrustes problem, we seek to find the orthogonal matrix A that best maps H to G:EQUATIONSince }G ´HA} 2 F " trppG ´HAq J pG ´HAqq " trpG J Gq ´trpG J HAq ´trpA J H J Gq `trpA J H J HAq " }G} 2 F `}H} 2 F ´2trpA J H J Gq, an equivalent objective to Eq. ( 34) isEQUATIONwhere U J AV is a product of orthogonal matrices, and, therefore, orthogonal. Since Σ is diagonal, Eq. ( 35d) is maximized by U J ÂV " I, which means that Â " UV J .Canonical Correlation Analysis. We can rewrite the CCA objective from Eq. ( 21) asmax A,BtrpA J HG J Bq s.t. pA J HqpA J Hq J " pB J GqpB J Gq J " I,which, by definition of the Frobenius norm, is equivalent to Eq. (22) . Let M HG " HG J , M HH " HH J , M GG " GG J , and let UΣV J " M HG be the singular-value decomposition of M HG . One can show that the optimum of Eq. ( 22) is found at p Â, Bq " pM ´1 2 HH U, M ´1 2 GG Vq. Because A J H, B J G, U, and V are by definition orthogonal, we see that CCA first whitens the representations pH, Gq through pM ´1 2 HH , M ´1 2 GG q and then orthogonally transforms them. This provides the intuition behind a close relationship between CCA and the Orthogonal Procrustes problem: For pre-whitened representation matrices, CCA (Eq. ( 22)) is equivalent to solving the Orthogonal Procrustes problem (Eq. ( 34)). To see this, let W H and W G be whitening transforms for H and G, respectively. Then, Eq. ( 22) is equivalent to minEQUATION)such thatEQUATIONEQUATIONTherefore, we can derivemin A,BPOpV q }A J W H H ´BJ W G G} 2 F " min AB J POpV q }A J }}W H H ´AB J W G G} 2 F (39a, A P OpV q) " min CPOpV q }W H H ´CJ W G G}., (39b, C def " AB J P OpV q)which is equivalent to solving the Orthogonal Procrustes problem (Eq. ( 34)) on the whitened matrices W H H and W G G.In this section, we additional details about the setup and compute resources of the experiments in §7. To generate embeddings, we used the open-sourced code by Ren et al. [33] . Further, for Orthogonal Procrustes, CCA, PWCCA, and Linear CKA, we use the open source implementation by Ding et al. [12] . Our complete code is added as supplementary material.We first extract the D " 768 dimensional training set representations for SST-2, MRPC, RTE, CoLA, MNLI, and QQP across all 12 layers of ELECTRA [6] , ROBERTA [28] , and the 25 MULTIBERT [35] models from HuggingFace. 35 The models and the MRPC dataset are licensed under Apache License 2.0. The SST-2 dataset is licensed under the Creative Commons CC0: Public Domain license. The RTE dataset is licensed under the CC BY 3.0 license. The CoLA dataset is licensed under the CC BY-SA 4.0 license. The MNLI dataset is licensed under the General Public License (GPL). THE QQP dataset is licensed under a custom non-commercial license. 36 The dataset statistics are shown in Tab. 3 Hyperparameters. Each experiment was run using RiemannSGD 37 as an optimizer as it initially produced the best convergence when computing our affine similarity measures. Further, to account for convergence artifacts, we ran the intrinsic similarity computation optimizations in each experiment for learning rates r1E-4, 1E-3, 1E-2, 1E-1s and extrinsic computations for r1E-3, 1E-2, 2E-2s and report the best result. When training the task-specific linear probing classifier ψ 1 for dψ 1 , we use the crossentropy loss, RiemannSGD and optimize over the learning rates r1E-2, 1E-1, 2E-1, 4E-1s. For the computation of Hausdorff-Hoare map d H , we fixed a lr of 1E-3 to save compute resources, as this lr generally leads to the best convergence in previous experiments. We used a batch size 64 and let optimization run for 20 epochs, keeping other parameters at default. For reproducibility, we set the initial seed to 42 during training.Generating Random Affine Maps. For the last experiment, we generate random affine maps. To approximate d H we sample the matrix entries of the affine map from N p0, 1q. We then additionally normalize the transformed representation matrix as this leads to better convergence. To approximate dH VpV,∆q , we fit a linear probe on H to 100 sets of randomly generated class labels, for the embeddings of each task. The predictions of that probe then become what G affinely maps to. In both cases, the seeds are set ascendingly from 0.We compute the embeddings on a single A100-40GB GPU, which took around two hours. All other experiments were run on 8-32 CPU cores, each with 8 GB of memory. Computing extrinsic distances between 600 model combinations across both datasets usually takes 2-3 hours on 8 cores, whereas intrinsic computation is more costly, and can run up to 4 hours. Note our approximation of Hausdorff-Hoare maps (cf. Eq. ( 23)) across all models is significantly more costly due to our sampling approach and can take up to 72 hours to compute on 32 cores for large datasets such as SST-2, and up to 12 hours for MRPC. The resources needed for initially failed experiments do not significantly exceed the reported compute. The Influence of Encoder Rank Deficiency. In Thm. 4.1 we discuss how the relative rank of encoders influences their affine alignment and derive the equivalence relation » Aff conditioned on equal rank between encoders. To test the effect of unequal rank on affine alignment in an isolated setup, we artificially construct reduced-rank encoders through singular value decomposition (SVD) truncation. In Figure 3 we expectedly find a trend in how the encoder rank influences affine mappability. We additionally highlight that the computed distances are rather symmetric, with no clear differences when mapping to ( Ñ M), rather than from (M Ñ ) an encoder. Finally, we note the trend in the diagonal indicating that mapping between encoders of the same rank becomes easier between lower-rank encoders. We then fit H piq to H pjq with an affine map and report the goodness of fit through the max error L2 norm, i.e., an approximation of dpH pjq , H piq q on row i and column j of the grid. • If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics. • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction). 10. Broader Impacts Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed? Answer: [Yes] Justification: Discussed in the final, "Broader Impact", section in the main body. Guidelines:• The answer NA means that there is no societal impact of the work performed.• If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact. • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.• The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster. • The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology. • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).Homotopy, from the Greek ὁμός (homo; same) and τόπος (topos; place), refers to a continuous transformation between functions or shapes, showing they can be deformed into one another without breaking or tearing.We discuss related work in more detail in App. C.In principle, one could relax the replace R D with any finite dimensional vector space.In the following, we assume language model tightness to the effect that we can assume that LMs produce valid probability distributions over Σ ˚[15].R`is the set of non-negative real numbers along with the "value" 8, assumed to be above all reals. We adopt the following conventions: 8 ¨0 " 0 ¨8 " 0; 8 `r " r `8 " 8, 8 ¨r " Rą0 for every r P Rą0.A basic example of a hemi-metric space is the pair pR, d R q, where d R px, yq " maxpx ´y, 0q.Additional properties of d H are discussed in Lem. D.1.A metric space is complete if every Cauchy sequence (a sequence where the distance between terms eventually becomes arbitrarily small) converges to a point within the space.This follows immediately from the fact that | ¨|V is a norm and from the completeness of V .This amounts to "forgetting" the special role played by the zero vector.A left action of a group G on a set X is a map ¨: G ˆX Ñ X such that e ¨x " x for all x P X, where e is the identity element of G, and g1 ¨pg2 ¨xq " pg1g2q ¨x for all g1, g2 P G and x P X.See App. D.2 for a derivation.All left-out proofs can be found in App. D.2.A reflexive and transitive relation on X.The proofs of all claims in this section can be found in App. D.3.Given an affine map f : V Ñ W , there is a unique linear map A " flin P LpV, W q and b P W such that for every v P V we have f pvq " A ¨v `b.The subscript 8 in d8,∆ and d8,W is used to insist on that we are considering the supremum distance d8 in ∆ N ´1 and W , respectively.Exact extrinsic homotopy is asymmetric.For simplicity, we assume that h and g both map to R DSee App. E for the derivation.CCA extensions beyond PWCCA are dicussed in App. C.We provide additional experiments on the role of the encoder rank in App. G.Following Press et al.[31], we choose ϵ as n ¨σ1 ¨ϵp ¨maxpN, Dq for n " 5, where σ1 is the largest singular value of the N ˆD representation matrix and ϵp the float machine epsilon. We note that the rank to precision ϵ and the recovered correlation may depend on the chosen ϵ.The generation process is described in App. F.The computational expense of computing dH VpV,∆q restricts this analysis to a limited set of classifiers, depending on the alphabet size. See App. B for a discussion.This, by definition, is the topology generated by all open balls.A reflexive and transitive relation on X.Defined by y ďprefix y 1 if y is a prefix of y 1 .Here, the closure is with respect to the topology defined by d.This is, for example, the case if S is a group and there exists ϕ P S such that }ϕlin}V ă 1, e.g., S " AffpF q.https://huggingface.co/googlehttps://www.quora.com/about/toshttps://github.com/geoopt/geoopt 


Decision: This paper presents theoretical analysis on "intrinsic alignment" of two or more pretrained language encoders. As pointed out by the reviewers the theoretical analysis in the paper is very solid and well presented. This kind of work is very valuable for the community to understand the neural encoders and improve them further. A weakness that all the reviewers mentioned is a lack of thorough experiments. For the camera ready version of the paper, I highly encourage the authors to add more experiments to study other encoders as promised in the rebuttal. This will make the paper stronger.

Reviews: review: paper_summary: paper_summary: This paper presents theoretical analysis on "intrinsic alignment" of two or more pretrained language encoders (e.g. BERT trained with various seeds). The work proposes computing the intrinsic alignment between two encoders by first defining a algebraic metric space in which these two encoders exist, and then looking at the affine homotopic transformations that are possible in the given space. The primary motivation of the work is to set theoretical bounds on the similarity of two given encoders, and for the intrinsic alignment to have a strong (positive) correlation to extrinsic alignment (in simple terms, whether two encoders produce similar outputs for similar inputs). The work claims that this is important to have an "elementary understanding" of these encoders, and that having these theoretical guarantees can help derive a richer set of properties of the relationship between encoders.

The work first proposes the methodology to compute these alignments, and then conducts experiments on 25 multiBERT encoders, which are BERT models trained with varying seeds. Two GLUE classification tasks are used, SST-2 and MRPC. The results show that that such an alignment can indeed be computed, and that there is a positive correlation between the intrinsic and extrinsic alignments.
strength_weakness: strength_weakness: - While the paper makes some effort to depict the practical value of the underlying method, it falls short of giving actual examples. For instance, the paper mentions that deriving intrinsic alignment can help discover "richer" properties - but for a reader (that does not necessarily have theoretically expertise), it is difficult to see what these richer properties look like
- There is also very little discussion of practical aspects of running this analysis; The appendix mentions that intrinsic alignment is more expensive to compute than extrinsic alignment; given that the aim of the work is to set upper bounds, why not just compute the extrinsic scores? I was also unable to find any discussion on whether different kinds of encoders can be compared (which is easy to do for downstream tasks).
questions: questions: - What are some of these "richer" properties that intrinsic alignment can help discover?
- Can these be run across encoders with different architectures?
- The paper mentions that one advantage of intrinsic alignment is the possibility to define an order over the encoders. What does this imply?
- I am wondering if these alignment measures can somehow be used to improve pre-training; lets say if we can compute the similarity between a well trained model and one that is in the training loop, and make training decisions based on how close/far the alignment is. Do you envision any such use of the proposed metric?
- Is there a way to convert the alignment metric into a measure of "badness" for a given encoder? I envision it would be useful to weed out "bad" models than to just compare "good" ones.
limitations: limitations: Authors have addressed limitations adequately.
paper_summary: paper_summary: The paper aims to formally define, derive and then analyse similarity between pretrained language encoders, focusing on aspects of intrinsic (task-independent) similarity and extrinsic (task performance-oriented) similarity. The paper is mostly of theoretical nature, aiming to properly and formally define the studied aspects of similarity and then aiming to propose the idea of transformations in an (affine) homotopic framework. The work makes a step towards more formal studies of representation similarity within language encoders (and probably decoder-style LLMs in future work).

The main non-theoretical finding, based on experiments with MultiBERT models (i.e., BERT models trained from different random seeds) is that there exists (as expected) a correlation between the defined intrinsic and extrinsic notions of similarity.
strength_weakness: strength_weakness: - The work is heavily focused on theory and theoretical contributions; this means that its more practical findings are the weaker part of the work and the experimental setup and results are a bit underwhelming:
a) The only studied architecture is the BERT architecture, and the work just aims to quantify correlation between intrinsic and extrinsic similarity for MultiBERT models (which just use different random seeds). As far as I am concerned, a positive correlation between intrinsic and extrinsic similarity is very much expected for this group of models.
b) The work should ideally study other encoder architectures and aim to establish how the notion of similarity changes over the spectrum of 'expected model distance' and what implications it might have. Speaking of the 'expected model distance', what one could/should study here is:
-- models of the same architecture starting from the same seed where different checkpoints were taken
-- models of the same architecture with different random seeds (this is the only thing studied in the paper atm)
-- models of similar architecture but not completely the same (e.g., BERT vs RoBERTa)
-- completely different architectures (e.g., BERT vs tELECTRA)
c) The work also focuses on very basic GLUE tasks which also limits the generalisability of the main findings, and additional experiments over tasks of different complexity are required here to fully trust the core ideas (which would also increase the impact of the work substantially imo).

- While mathematical rigor in the paper is very useful, the paper would contribute from a short (sub)section aiming to properly 'distill' the key take-home messages in a plain(er) language so that it also becomes more obvious how future work could contribute from the more theoretical insights (e.g., can the derived measures be used for computing representation similarity in general)? That would be a very useful addition to the work.
questions: questions: - Beyond page limit, is there any other reason why only two tasks (and very simple ones) are targeted for the main experiments? 

- Have the authors considered running the similarity analyses also with BERT models having different hyper-parameters? Can we expect the affine homotopy properties to hold for such models? What implications might this finding have?

- I am missing the reason why certain encoders end up being more informative than others. How do you define 'being informative' in this context? Why is it important?

- Would it be possible to derive similar measures for decoder-only LMs in the future?
limitations: limitations: Limitations are (to most part) properly discussed in Appendix A. Some additional reflection on the current limitations of experiments (and practical aspects of the work) might be necessary and useful.
paper_summary: paper_summary: In this paper, the authors study a nature question "What does it mean for two encoders to be similar" and proposed an intrinsic measure of similarity that aligns with extrinsic performance on downstream tasks. It introduces the concept of affine alignment and explores its properties and implications for understanding encoder relationships.
The main contributions are as follows:
1. The authors first define an metric space on encoders.
2. The authors extend the definition to account for transformations in a broad framework of $S$-homotopy for a set of transformations $S$.
3. As a concrete application of the framework, the authors study affine homotopy—the similarity for affine transformations.
strength_weakness: strength_weakness: 1. The motivation for introducing affine Hemi-Metrics to measure the similarity of two encoders is not so clear to me.
2. The definition of Extrinsic Homotopy seems not like a mathematical definition since authors does not claim that how to quantify the performance.
3. More experiments are needed for supporting the claim in the paper.
4. Such method seems not practical.
questions: questions: 1. Please explain clearly the motivation why we need Hemi-metrics, I think maybe from both sides of topological view and machine learning view.
2. Please explain the connection between intrinsic homotopy and extrinsic homotopy. I think it can help us understand theorem 5.1 better.
limitations: limitations: See the weaknesses.
paper_summary: paper_summary: The paper introduces formal mathematical concepts of intrinsic and extrinsic homotopy between language encoders. The first concept compares the behavior of two encoders on a concrete dataset, while the second concept compares them independently from the concrete dataset. The paper also demonstrates how to apply these concepts to measure the difference between different versions of the pre-trained BERT model.

In more detail, chapter by chapter:

- The 1st chapter introduces the problem of comparison of text encoders.
- The 2nd chapter is devoted to the discussion of the formal definition of a language encoder. The authors define a language encoder $\mathbf{h}$ very generally: as a function from all possible strings of some alphabet $\Sigma$ to a $d$-dimensional vector space $V$. They mention some ways to train an encoder in practice; however, for the rest of the theoretical part of the paper, $\mathbf{h}$ remains general enough and is not required to be implemented through a neural network.
- The 3rd chapter discusses the formalism of hemi-metrics and introduces uniform convergence norms on the space of language encoders. The uniform convergence norm allows the authors to introduce an affine alignment measure that shows how aligned two encoders are with each other.
- The 4th and 5th chapters introduce the notion of Intrinsic and Extrinsic Affine Homotopy on encoders. It is based on notions of affine alignment measure from the previous chapter, and encoder rank.
- The 6th chapter is devoted to adapting the notions above to the real-life scenario, where we can't check the encoder performance on all possible strings of our alphabet. Finally, asymmetric extrinsic and intrinsic similarity measures, that are usable in practice, are derived.
- In the 7th chapter the authors measure an extrinsic and intrinsic similarity between pre-trained BERT models, all trained with similar hyper-parameters but differing in random weight initialization and shuffling of training data (see "The MultiBERTs: BERT Reproductions for Robustness Analysis" paper). They show that these pre-trained BERT models can be differentiated from each other by the methods, introduced in the paper. They also provide a table of the correlations between their notions of similarity and some previously introduced notions of similarity between encoders. All experiments were performed using SST-2 and MRPC datasets.
- Finally, in the 8th chapter they discuss relations between extrinsic and intrinsic dissimilarities, their asymmetry, and the finding that some BERTs are more similar to other BERTs by affine similarity in one direction, but not necessarily in another.
strength_weakness: strength_weakness: First of all, it looks like this paper is not a good fit for this venue by its very nature: 
- It is unclear what is the contribution of this work to the field of Neural Information Processing Systems. The paper introduced many novel concepts, but most of these concepts, starting from the definition of the language encoder itself, are very general, so their connection with neural networks looks far-fetched. The usefulness and purpose of the experiments are also unclear (see "Questions" section).
- 9-page format is too small for this type of scientific work; authors had to overuse the Appendices to fit their work into limited space. When I was reading the paper, I had to constantly go around in circles, moving between Appendix D ("Addenda on Affine Homotopy") and the main part of the paper.

Second, there are some general problems with the research and text:
- The experimental section in general is very limited. Only various versions of the BERT models are compared with each other, and only two datasets are considered. In line 235 there is a note that experiments show some task-independency, but how can we say anything about task-independency when we have only two tasks on hands?
- The conclusion and findings of the paper are also unclear (see "Questions" section).
- The paper is generally hard to read and understand. As was told above, this problem is partially connected with the unsuitable format; however, it is also connected with typos (see below) and lack of needed definitions (see "Questions" section).
questions: questions: Questions:

- Why is your mathematical tool of checking, whether two encoders are similar to each other (line 153), called "Affine homotopy"? What is the connection to the notion of homotopy that we know from algebraic geometry?
- You found that some BERTs are more similar to other BERTs by affine similarity in one direction, but not in another, and that this fact says something about the "universality" of BERTs, that are easier to map "from". Can you please elaborate on this conclusion about their universality?
- By which machine learning algorithm is $\mathbf{Ð}$ approximated and how?
- What was the point of defining a dataset-independent way to measure the difference between encoders, if, starting from section 6, everything, in essence, became dataset-dependent again? (and of course, all experiments were dataset-depended as well)
- What is the purpose of the Figure 2? What can it tell about MULTIBERT encoders number $1, ... , 25$?
- In general, your paper doesn't explain what is the exact difference between, let's say, MULTIBERT encoder number $1$ and number $2$ (except that they are both BERTs with different weights init, etc). So what's the point of caring about their comparison in the first place? What useful conclusion can we make from such a comparison?
- What is the purpose of Table 1? If I understand correctly, it shows a correlation between different similarity measures, but what conclusion should we make from it?
- The most torturing question: what are $E_x$ and $E_y$, introduced in line 103, but never explained? I had to assume that they were just some neighborhoods of $x$ and $y$ to somehow get through the rest of the paper, but I'm not sure it's true.

Suggestions:
- I would suggest experimentally measuring the similarity of BERT with encoders of different natures, e.g. AlBERT, ELECTRA, and maybe even some LSTM-based encoders. Maybe the encoders of similar architecture (or trained on similar data) will be more similar by your similarity measures, than the encoders of very different architecture (or trained on very different data)? Or maybe not?
- I would suggest using more datasets for any further experiments.
- You heavily cite the "Metrics, quasi-metrics, hemi-metrics" chapter from the book called "Non-Hausdorff Topology and Domain Theory". However, this book is not well-known outside of the professional mathematical community. So, I would suggest explaining the conceptions from the book in more detail and providing some examples of hemi-metrics that would show why one wants to use hemi-metric instead of symmetric metric.
- Finally, I would suggest turning this work into a **journal paper** (after a revision) and merging Appendices D and B ("Additional Related Work") with the main part of the paper to make it more readable.

---

Typos and presentation issues:

- In 1st page, footnote №4, typo: 
> In principle, one could relax the replace R^d with any finite-dimensional vector space
- In line 63, you wrote: 
> There are two common ways that language encoders are created. The first is through autoregressive language modeling.

And the second one? Did you mean Masked Language Modelling?
- In line 119: typo: 
> Let GL(V) We write
- In line 119, you introduced GL(V) without definition. I've supposed it's a General Linear Group for the rest of the paper.
limitations: limitations: The authors addressed the limitations of the theoretical part of their paper. I'd suggest adding the limitations of the experimental section (one architecture, a few datasets) as well (see above).

Comments: title: I appreciate the response...
Please respond to authors' rebuttal
Replying to Official Comment by Reviewer nK2G
Please respond to authors' rebuttals
comment: I thank the authors for the response, it has helped me understand some of the concepts better. I still feel like the practical aspects are still unclear to me (e.g. the tradeoff of runtime vs guarantees, the implications of "good"/"bad" encoders), however, this may be because I am not very well versed on the theoretical side of algebraic spaces. I have gone through the other reviews, and will maintain my score.
...and the clarifications provided. I would keep the current score, as my questions were mostly resolved 'theoretically' without providing additional empirical evidence on some of the claims from the responses.
Dear Reviewer sF8t,

Thanks for your review. The authors have replied to your comment. Please engage in the discussion. After reading their rebuttal and other reviewers' feedback. Are you keeping the score unchanged and would you like to change your score?

Thanks
AC
Thank you for your reply! Your explaination solves my concerns.
Thank you for taking the time to read our response and reply. 
- **"I am wondering if I understand it right that extrinsic homotopy is the upper bound of intrinsic homotopy?"**: No, Lemma 5.1.1 and Theorem 5.1 both provide a linear upper bound on **extrinsic** affine homotopy measures by **intrinsic** ones (not the other way around). More specifically, the notions of intrinsic homotopy provide an upper bound of specific extrinsic ones for a fixed task; Lemma 5.1.1 and the worst-case task; Thm. 5.1. Note that in this way (and not the other) we can make guarantees about (extrinsic) downstream task performance dissimilarity from intrinsic measures of similarity — which is what we aim to achieve.
---
- **"But the Hemi-Metric is symmetric, or a metric should be symmetric, right? I may not get your point, please explain it clearly?"** No, compared to metrics, hemi-metrics are, by definition, not symmetric (see Def. 3.2; "Hemi-Metrics", in contrast to Def. 3.1; "Extended Metrics"). Our point is that to derive the intrinsic similarity between encoders that is indicative (cf. Lemma 5.1.1, for instance) of their extrinsic similarity ( = the closeness with which another encoder’s task classfication probabilities can be matched affinely), we do not want symmetric measures, as this would not capture the directionality of the problem. The directionality in this context means that one encoder may be more powerful than another as you can affinely match another encoder’s output probabilities closely, whereas the inverse may not be possible (cf. experiments on rank-deficient encoders, Appendix G).

We hope this helped clarify your concerns!
Thank you for authors' reply which answer my part of questions. But it still makes me unclear the connection between intrinsic and extrinsic homotopy since you also mentioned the similarity between Lemma 5.1 and Def 4.2. I am wondering if I understand it right that extrinsic homotopy is the upper bound of intrinsic homotopy?

Also, for the motivation of Hemi-Metric,  you also mentioneed "a symmetric distance, therefore, is not practical as it does not capture this phenomenon. " But the Hemi-Metric is symmetric, or a metric should be symmetric, right? I may not get your point, please explain it clearly?
Dear Reviewers,

Thanks for writing your reviewers of the paper. Now the authors' rebuttals are in. Please go through them and see if they have addressed your questions. Please start discussions with the authors if you have further comments. 

Regards,
AC