Evaluating German Transformer Language Models with Syntactic Agreement Tests

Karolina Zaczynska, Nils Feldhus, Robert Schwarzenberg, Aleksandra Gabryszak, Sebastian Möller

TL;DR

While German Transformer Language Models (TLMs) excel at handling complex local grammar and flexible word orders, they hit a major roadblock when dealing with long-distance verb phrase coordinations. By introducing a new German syntactic evaluation dataset, this paper exposes the linguistic boundaries of models like GBERT and demonstrates that English-centric syntax findings don't always translate to other languages.

What Problem Does This Paper Address?

Most "BERTology"—the study of what pretrained transformer models actually learn about language—has been overwhelmingly English-centric. However, languages like German present entirely different structural hurdles: a highly complex inflection system, case markings (nominative, accusative, dative, genitive), and a notoriously flexible word order where objects can freely swap places with subjects.

Do German language models truly grasp these intricate structural rules, or do they just rely on statistical surface patterns? To find out, the authors adapt English syntactic agreement tests and design new ones tailored specifically to the quirks of German grammar.

Methods

The authors evaluate two models: GBERTlarge and distilGBERT.

The standard way to test syntactic knowledge is to present the model with a minimal pair: one grammatical sentence and one ungrammatical sentence that differ by just a single word (the locus of ungrammaticality).

  • Grammatical: "Der Autor lacht." (The author laughs.)
  • Ungrammatical: "Der Autor lachen." (The author laugh.)

Previous English studies often masked the target word and checked which variant the model assigned a higher probability. However, this breaks down in German because tokenizers often split inflected German words into multiple sub-words (e.g., lachen $\rightarrow$ [lach, ##en]), making mask-probability comparisons mathematically unfair.

To solve this, the authors score whole sentences without masks by calculating the total cross-entropy loss of the forward pass. The model "passes" the test if the grammatical sentence achieves a lower loss than its ungrammatical counterpart.

Datasets

The authors created a new benchmark dataset containing 13,002 sentences generated using hand-crafted Context-Free Grammars (CFGs). This allowed them to tightly control sentence structures and systematically inject "distractors" (nouns with a different grammatical number placed between the subject and the verb).

The dataset spans 14 distinct test cases, split into two main categories:

  1. Translated English Tests: Subject-verb agreement across prepositions, relative clauses, and verb phrase (VP) coordinations.
  2. Novel German-Specific Tests:
  3. Extended Modifiers: Sentences where long descriptive phrases are wedged between the article and the noun (e.g., "Die die Pflanze liebenden Autoren lachen").
  4. Pre-field Shifting: Sentences where the direct object is scrambled to the very front of the sentence, pushing the subject to the middle.

Key Insights and Ideas

  • The VP Coordination Trap: In English, BERT models handle long verb phrase coordinations easily. In German, they fail spectacularly. When a sentence has two verbs connected by "and" ("Der Autor redet... und lacht"), the models frequently forget the singular subject by the time they reach the second verb, especially if plural distractor nouns are mixed in.
  • Scrambling is Not a Problem: German models are surprisingly robust against flexible word order. Even when an object is moved to the front of the sentence (Pre-field), the models successfully use German case suffixes to correctly identify the true subject.
  • Scale Matters for Syntax: GBERTlarge consistently outperforms distilGBERT across almost all tasks. This implies that compressing models via distillation disproportionately damages their ability to track long-range syntactic dependencies and complex features like reflexive anaphora person/number agreement.

Key Results

As shown in the performance summary below, both models achieve near-perfect accuracy (>94%) on simple sentences and local agreements. However, performance plummets on VP coordinations:

Model performance (accuracy) across different syntactic tasks. Underlined scores highlight the weakest areas.
  • Medium VP Coordination: distilGBERT drops to an accuracy of 0.4813 (worse than a random guess), while GBERTlarge only manages 0.6188.
  • Pre-field Shifting: Both models handle this well, scoring 0.7300 (distilGBERT) and 0.7987 (GBERTlarge), proving they aren't just assuming the first noun is always the subject.

Limitations and Future Work

The primary limitation is the use of synthetic data. Because the sentences were generated via CFGs, they feature low lexical variance and can sound unnatural. The authors note that future work should validate these findings using diverse, real-world language samples. Furthermore, a deeper, mechanistic look inside the attention heads is required to understand exactly why German VP coordination poses such a unique challenge to the Transformer architecture.

Summary updated

BibTeX
@inproceedings{zaczynska2020evaluating,
  author = {Karolina Zaczynska and Nils Feldhus and Robert Schwarzenberg and Aleksandra Gabryszak and Sebastian Möller},
  title = {{Evaluating German Transformer Language Models with Syntactic Agreement Tests}},
  booktitle = {SwissText/KONVENS},
  year = {2020},
  url = {https://openreview.net/forum?id=-8sV85ZF33U},
}
Figure