시퀀스 순서를 넘어서: 트랜스포머를 위한 구문 정보 기반 위치 임베딩
Beyond Sequence Order: Syntax-Informed Positional Embeddings for Transformers
August 6, 2026
저자: Haris Riaz, Hyungji Kim, Mihai Surdeanu
cs.AI
초록
트랜스포머의 위치 임베딩(PE)은 토큰 간 거리와 순서를 인코딩하지만, 통사 구조에 대해서는 대체로 무관하다. 우리는 통사 정보를 활용한 위치 임베딩(SiPE)을 제안한다. SiPE는 사전 학습 중 의존 구문 트리로부터 경량의 통사적 사전(prior)을 학습하고, 이를 절대, 상대, 회전의 세 가지 주요 PE 계열 전체에 주입하여 인코더와 디코더 모두에 적용한다. 이 과정에서 셀프 어텐션과 나머지 아키텍처는 변경하지 않는다. 우리는 사전이 모델에 어디서 어떻게 들어가야 하는지를 분리하여 분석했고, 그 답은 아키텍처에 따라 달라진다는 것을 발견했다. 상대 위치 PE를 사용하는 자기회귀 디코더의 경우, 사전은 어텐션 스코어의 상대 위치 항과 곱셈적으로 결합될 때 가장 강력한 효과를 낸다. 이는 입력 임베딩, 셀프 어텐션, 또는 위치 및 어텐션 항에 동시에 주입하는 방식보다 우수한 성능을 보였다. 반면 인코더의 경우, 사전을 입력 임베딩에 직접 더하는 것이 가장 좋았으며, 각 인코더의 고유 위치 메커니즘과 결합하여 작동한다. SiPE로 사전 학습한 모델은 통사적 지도가 없는 기본 모델에 비해 SyntaxGym 벤치마크에서 최대 10.3% 향상된 성능을 보였고, 동시에 혼란도(perplexity)를 9.0% 감소시켰다. 이 지표는 거의 모든 기존 통사 주입 방법이 오히려 악화시키는 것이다. 중요한 점은 이러한 성과가 통사적 일반화를 넘어 실제 언어 이해에서도 확인된다는 것이다. SiPE는 이를 사용하지 않고 학습한 모델보다 GLUE 벤치마크 점수를 최대 8.2% 향상시킨다. 추론 시 여러 구문 트리를 주변화하거나 런타임에 통사 정보를 버리는 기존의 통사 언어 모델과 달리, SiPE는 단일 구문 트리를 조건으로 사용하여 통사적 지도와 추론 비용 사이에 새로운 파레토 경계를 확립한다.
English
Positional embeddings (PE) in Transformers encode token distance and order but are largely agnostic to syntactic structure. We introduce Syntax-informed Positional Embeddings (SiPE), which learns a lightweight syntactic prior from dependency parses during pretraining and injects it across all three dominant PE families (absolute, relative, rotary), for both encoders and decoders, leaving self-attention and the rest of the architecture untouched. We isolate where and how the prior should enter the model, and find it depends on the architecture: for autoregressive decoders that use relative PE, the prior is strongest when coupled multiplicatively with the relative-position term of the attention score, outperforming injection into the input embeddings, into self-attention, or into the positional and attention terms jointly---while for encoders it is best added directly to the input embeddings, composing with each encoder's native positional mechanism. We find that models pre-trained with SiPE improve on the SyntaxGym benchmark by up to 10.3% while simultaneously reducing perplexity by 9.0% over a base model with no syntactic supervision---a metric nearly every existing syntax-injection method instead degrades. Crucially, these gains extend beyond syntactic generalization: SiPE also improves real-world language understanding, raising scores on the GLUE benchmark by up to 8.2% over a model trained without it. Unlike existing syntactic language models that marginalize over many parses at inference or discard syntax at runtime, SiPE conditions on a single parse, establishing a new Pareto frontier between syntactic supervision and inference cost.