논문 해설
Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage
트랜스포머의 구성적 일반화 평가: 구성 동치성과 모듈 커버리지의 역할
- 연구 문제 트랜스포머의 조합 일반화 성능 변동을 구성 동치와 모듈 커버리지라는 벤치마크 설계 요인으로 설명합니다.
- 연구 방법 서로 다른 모듈 순서가 같은 종단 간 함수가 되는 구성 동치의 공유 비율과 위치별 모듈 분포 이동을 통제해 훈련-테스트 분할을 만들고, 직접 모델과 단계별 모델을 비교합니다.
- 주요 결과 직접 모델의 정확도는 공유 구성 동치 비율에 따라 급격히 높아지며, 위치별 모듈 커버리지 이동이 커질수록 두 모델 계열 모두 정확도가 떨어집니다. LiveCodeBench 사례에서도 동치 누출이 Llama3-8B의 전체 정확도를 높였습니다.
조합 일반화 평가의 문제
트랜스포머의 순차 조합 일반화(task-based compositional generalization)는 훈련에서 본 적 없는 모듈 순서를 테스트에서 처리하는 능력입니다. 기존 연구들은 임의로 만든 소수의 훈련-테스트 분할에서 평가해 왔고, 그 결과 직접 모델(final output만으로 학습)의 성능이 설정마다 크게 달라 일관되지 않았습니다. 이 논문은 이 변동을 모델 구조 대신 벤치마크 설계의 두 요인, 즉 구성 동치(composition equivalence)와 모듈 커버리지(module coverage)로 설명하려 합니다. 구성 동치는 서로 다른 모듈 순서가 같은 종단 간 함수로 환원되는 성질이고, 모듈 커버리지는 테스트가 훈련과 다른 위치나 문맥에서 모듈을 얼마나 자주 등장시키는지를 나타냅니다.
구성 동치와 모듈 커버리지의 정의
구성 동치는 두 순차 구성 F와 F′가 입력 부분공간 S에서 F(x)=F′(x)를 모든 x∈S에 대해 만족할 때 동치라고 정의됩니다. 이 정의에 따라 동치류 [F]_S는 같은 입력-출력 매핑을 공유하는 구성들의 집합입니다. 테스트 구성 중 훈련 구성과 적어도 하나의 동치류를 공유하는 비율을 δ_equiv로 정의하며, 1−δ_equiv는 훈련 중 보지 못한 종단 간 동작을 보이는 테스트 구성의 비율로 읽습니다. 모듈 커버리지는 위치별 분포와 쌍별 인접 분포의 KL 발산으로 측정합니다. 위치별 발산은 테스트 분포가 훈련 분포에 대해 얼마나 벗어나는지를 위치 전체에 걸쳐 평균한 값입니다.

Figure 1 : (a) A sequential composition task combines “atomic” functions (e.g., sort, mode, filter). Task-basedcompositional generalization is the ability to generalize to unseen sequences after training on a subset. (b)Composition equivalence:Different sequences are composition equivalent if they reduce to the same end-to-end function. For example, one equivalence class consisting of the first four sequences reduces to returning the most frequently occurring vowel in a set of strings; direct models succeed on the test sequence (mode◦filter◦sort ) from this class but fail on the remaining two test sequences from a different composition equivalence class. (c)Module coverage:Examples of coverage failures includeposition-wise(e.g., function 2 never appearing in the first position, shown with dashed lines) andpair-wise(e.g., missing pair (2,1) in the training set, shown with solid lines).
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.통제된 훈련-테스트 분할 구성
Uniform 데이터셋은 여섯 개의 무작위 bijection 함수로 구성되며, 구성 동치를 기본적으로 제거하는 통제 설정입니다. Diverse 데이터셋은 sort, concatenate, filter, shift, union, mode 여섯 함수로 구성되며 필터와 최빈값처럼 다대일 매핑이 있어 구성 동치가 많이 나타납니다. 동치류는 구성 쌍의 출력 일치 점수가 임계값 0.01 이상이면 간선을 그린 그래프의 연결 성분으로 학습됩니다. 그 뒤 공유 비율을 조절하려고 각 테스트 동치류의 구성 절반 정도를 훈련 동치류의 구성과 맞바꿉니다. 모듈 커버리지는 편향 강도 α로 훈련과 테스트의 위치별 샘플링 확률을 서로 반대 방향으로 치우쳐 조절합니다.
모델과 평가 설정
직접 모델과 단계별 모델을 각각 절대 위치 임베딩과 상대 위치 임베딩으로 학습하며, 구현은 nanoGPT 구조(3층, 6헤드)입니다. 이 작은 구조는 많은 분할을 효율적으로 평가하기 위해 선택되었고, 더 큰 구조(12층, 12헤드)에서도 비슷한 경향이 보고됩니다. 평가에서는 테스트 샘플 10k개에 대해 정확 일치 채점으로 미지 입력의 정확도를 측정하고 다섯 개의 랜덤 시드를 평균합니다. within-k 설정은 같은 길이 k의 훈련과 테스트를 분할하며, cross-k 설정은 다른 k에서 평가하면서 항등 모듈로 길이를 맞춥니다.

Figure 3 :Cross- k evaluation:For the diverse benchmark (a–b), direct models perform well near training k as equivalences persist across nearbyk values. Direct models fail on the uniform benchmark (c–d) regardless of identity tokens, since identity-based equivalences in the uniform benchmark are k-specific. Step-by-step models are more robust but still exhibit significant variability.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.
Figure 9 :Generalization performance of bigger transformer architecture: We observe that the performance of the bigger architecture shows similar performance trends as seen for the smaller architecture (N_heads = 6, N_layers = 3) in Figures 2(b) and (d).
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 18쪽에서 그림 영역을 추출했습니다.구성 동치 공유와 직접 모델의 정확도
Diverse 벤치마크의 k=6 설정에서 직접 모델의 정확도는 테스트 시퀀스의 공유 구성 동치 비율이 0%에서 약 80%까지 커질 때 급격히 높아지는 것으로 보고됩니다. 완전 공유에서도 정확도가 100%에 도달하지 않는데, 일부 동치가 입력에 따라 근사적이고 일부 동치류는 구성원이 4~6개뿐이어서 훈련 부분집합이 완전한 일반화를 보장하지 못하기 때문입니다. 저자들은 이 결과를 공유 동치류가 직접 모델의 일반화에 필요하지만 충분하지는 않다는 근거로 해석합니다. 임계값을 0.01에서 0.95까지 바꾼 민감도 분석에서는 높은 임계값이 실제 공유를 과소평가해 0% 공유 조건의 정확도를 부풀리는 경향이 보고됩니다.

Figure 4 :Isolating the effect of composition equivalence in the diverse benchmark ( k= 6 ):(a) Generalization performance increases with the degree of shared composition equivalence classes between train and test. (b) The direct model generalizes primarily to test sequences that share equivalence classes and fails on classes exhibiting novel end-to-end behavior.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.
Table 1 :Sensitivity of direct-model accuracy to the equivalence threshold:We report accuracy on train/test splits with 0% and 100% shared composition equivalences, where equivalence classes are learned at different thresholds. At low thresholds, weak equivalences are captured, so the 0% shared split contains no equivalences of any strength and generalization is poor. At high thresholds, some equivalences go undetected and remain in the 0% shared split, which inflates generalization performance.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.
Figure 8 :Diverse benchmark, N_heads = 6, N_layers = 3, Direct (Relative): We observe non-trivial compositional generalization, as the models perform well on training and validation compositions, the test performance also increases. We observe better generalization for K= 6 than for K= 2 due to more training diversity and shared equivalences.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.
Figure 10 :Equivalence class necessity and training requirements:(a) Generalization performance to unseen sequences is strongly correlated with the degree of shared composition equivalence classes between train and test. (b) Models need to see at least 4–5 composition equivalences (per class) in training to generalize to the corresponding test equivalences.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 19쪽에서 그림 영역을 추출했습니다.
Figure 12 :Size distribution of learned equivalence classes(K= 6)
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 21쪽에서 그림 영역을 추출했습니다.위치별 모듈 커버리지 이동의 효과
위치별 KL 발산 α가 커질수록 직접 모델과 단계별 모델의 일반화 정확도는 단조롭게 떨어집니다. Diverse 벤치마크에서는 구성 동치가 있을 때 이 감소가 모든 모델에서 더 빨라지는데, 저자들은 이를 동치가 만드는 지름길 학습이 커버리지 실패와 겹친 결과로 해석합니다. 절대 위치 임베딩을 쓴 단계별 모델은 상대 위치 임베딩보다 위치별 이동에 더 민감하다고 보고됩니다. 쌍별 이동에서도 Diverse 벤치마크에서 민감도가 더 크며, Uniform 벤치마크는 극단적인 지지집합 위반을 제외하면 대체로 견고합니다.

Figure 5 :Effect of position-wise distribution shift:As the position-wise KL divergence in- creases, the compositional generalization perfor- mance of both direct and step-by-step models de- creases.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.
Figure 19 :Effect of pairwise-wise distribution shift:(a) As the pairwise-wise KL divergence increases, the compositional generalization performance of both direct and step-by-step models decreases in the diverse benchmark. (b) For the uniform benchmark, the effect of divergence is primarily observed at the extreme right end for support violations.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 25쪽에서 그림 영역을 추출했습니다.
Figure 20 :Combined effect of position-wise shift and reduced diversity:Shows (1- accuracyKL) to demonstrate accuracy degradation as in Figure 5, revealing combined effects of coverage shift and reduced compositional diversity due to biased sampling. Here, accuracyKL is the performance with biased sampling.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 26쪽에서 그림 영역을 추출했습니다.통제 실험과 절제 대조
Uniform 벤치마크에서 항등 모듈 없이 within-k로 평가하면 직접 모델은 k∈{2,…,6} 전 범위에서 정확도가 정확히 0으로 떨어집니다. 이 설정에는 구성 동치가 구조적으로 없기 때문입니다. 반면 항등 모듈을 넣으면 정확한 항등 기반 동치가 생겨 정확도가 높아집니다. Diverse 벤치마크에서는 항등 모듈이 없어도 sort와 mode 같은 함수 성질에서 생긴 동치가 직접 모델의 성능을 만들어 냅니다. 이 결과들은 구성 동치의 존재가 직접 모델 성능의 주요 조건임을 보여 주지만, 항등 모듈 자체가 일반화를 보장한다는 뜻은 아닙니다.

Figure 2 :Within- k evaluation:Direct models fail completely (0% accuracy) on uniform bijections without identity tokens (Figure (d)), while step-by-step models maintain near-perfect performance across all conditions. We observe that including identity tokens or diverse function types seems crucial for the generalization performance of direct models.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.
Figure 7 :Uniform benchmark (without identity), N_heads = 6, N_layers = 3, Direct (Relative): We observe that the models learn to predict the outputs of training compositions for both K=2 and for K=6, while the test accuracy on unseen compositions remains 0% throughout. We report two metrics: (1)sharp accuracy, where a prediction scores 1.0 only if the entire output sequence is correct and 0.0 otherwise; and (2)mean token accuracy, average accuracy of predictions in the output sequence, with both metrics averaged across compositions from each split. For reference, 100 epochs correspond to roughly 20k iterations (batch size 512, 100k training samples, 195 iterations per epoch).
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.Llama3-8B 사례 연구
LiveCodeBench의 코드 출력 예측 과제에서 Llama3-8B를 LoRA로 미세조정한 사례 연구에서는, 같은 함수 이름으로 정의된 동치류를 훈련에 누출한 비율 h를 0, 0.5, 1.0으로 바꿉니다. 훈련 샘플 수는 조건 간 일정하게 유지합니다. 결과에서 동치를 누출하면 전체 정확도가 크게 높아지는 반면, 누출되지 않은 held-out 함수의 정확도는 최소한으로만 올라갑니다. 저자들은 이 결과를 실제 코드 과제에서도 구성 동치가 조합 일반화 성능에 영향을 준다는 근거로 제시합니다. 다만 이 사례는 특정 체크포인트와 특정 데이터 구성에 한정된 것이며, 일부 함수가 누출 없이도 개선되는 점은 명시되지 않은 동치의 영향으로 해석됩니다.

Figure 6 : (a)Code output prediction performance of Llama3-8b on LiveCodeBench benchmark: We show the accuracy of the base model (No LoRA) and three LoRA fine-tuned models on splits with varying ratios of shared equivalence classes (defined by the same function names) (held out h=0, 0.5, 1.0). As splits share composition equivalences, accuracy improves substantially. (b)Performance grouped by equivalence classes:We observe that performance onmostfunctions only improves when equivalences are leaked into the fine-tuning set.
원문 · CC BY 4.0 · Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen · Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage · 원문 그림 인용 · 원본 PDF 10쪽에서 그림 영역을 추출했습니다.범위와 한계
저자들은 연구 결과가 주로 순차 구성 과제에서 얻어졌으며, 계층적이거나 그래프 기반의 복잡한 구성으로 일반화되는지는 열린 질문이라고 밝힙니다. LiveCodeBench에서는 구현들이 서로 다른 라이브러리를 사용해 구조가 크게 다르며, 실제 데이터에서는 모듈 커버리지·길이·순서를 통제할 수 없습니다. 따라서 저자들은 구성 동치가 관찰된 성능 향상의 유일한 메커니즘이라고 주장하지 않습니다. 두 요인을 정확히 분리하려면 통제된 합성 설정이나 명시적으로 통제된 실제 데이터가 필요하다고 제안합니다.
논문 정보
- 저자
- Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen
- 학회·저널
- arXiv · 프리프린트
- 최초 공개일
- 2026년 11월 10일
- 등록일
- 2026년 11월 11일
- 수정일
- 2026년 11월 10일
- 버전
- v1
- arXiv
- 2611.13498
- 분류
- cs.LG · cs.CL
- 원문 이용 조건
- CC BY 4.0
- 제공 범위
- 논문 정보, 해설, 허용된 원문 그림
AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.
초록
Compositional generalization is an important form of out-of-distribution generalization, defined as the ability to train on some combinations of modules (e.g., functions such as sort, filter) and then generalize to unseen combinations. Despite substantial empirical work evaluating compositional generalization in transformers, findings have been inconsistent because evaluations were often conducted on a limited set of train-test splits, defined in an ad hoc manner. Through a systematic evaluation, we identify two key aspects of the train-test distribution that strongly affect performance: composition equivalence and module coverage. We show that the apparent performance of direct models (trained only on final outputs) results primarily from exploiting composition equivalences, meaning different sequences of modules that reduce to identical end-to-end functions. When benchmarks eliminate these equivalences, performance drops significantly, showing their inability to generalize to compositions of known modules that produce novel end-to-end functions. We further demonstrate that performance degrades monotonically as module coverage shifts increase (when modules appear in different contexts between train and test), affecting both direct and step-by-step models (trained on intermediate and final outputs). These findings have concrete implications for benchmark design: benchmarks that include compositional equivalences can lead to significant overestimation of the generalization abilities of direct models, and benchmarks that include both module coverage violations and compositional equivalences can exacerbate shortcut learning. As a case study, we demonstrate the role of compositional equivalence on the generalization performance of the pre-trained model Llama3-8B on the code-output prediction task in the coding benchmark LiveCodeBench.
원문 인용
Purva Pruthi, Andrew Yuan, Alexander D'Amour, David Jensen (2026). Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage. arXiv:2611.13498v1. https://arxiv.org/abs/2611.13498v1
BibTeX
@misc{pruthi2026evaluating,
title = {{Evaluating Compositional Generalization in Transformers: The Role of Composition Equivalence and Module Coverage}},
author = {Purva Pruthi and Andrew Yuan and Alexander D'Amour and David Jensen},
year = {2026},
eprint = {2611.13498},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.13498v1}
}