Papers › Open Sesame: Getting Inside BERT's Linguistic Knowledge

Open Sesame: Getting Inside BERT's Linguistic Knowledge

4 Jun 2019WS 2019 8arXiv:1906.01698archive 2025-07-28

Yongjie Lin, Yi Chern Tan, Robert Frank

How and to what extent does BERT encode syntactically-sensitive hierarchical information or positionally-sensitive linear information? Recent work has shown that contextual representations like BERT perform well on tasks that require sensitivity to linguistic structure. We present here two studies which aim to provide a better understanding of the nature of BERT's representations. The first of these focuses on the identification of structurally-defined elements using diagnostic classifiers, while the second explores BERT's representation of subject-verb agreement and anaphor-antecedent dependencies through a quantitative assessment of self-attention vectors. In both cases, we find that BERT encodes positional information about word tokens well on its lower layers, but switches to a hierarchically-oriented encoding on higher layers. We conclude then that BERT's representations do indeed model linguistically relevant aspects of hierarchical structure, though they do not appear to show the sharp sensitivity to hierarchical structure that is found in human processing of reflexive anaphora.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1906.01698")

Code

Syntology Ran 7 of 18 code samples harvested from 1 repository linked to this paper; 11 have no recorded run. Of those that ran: 4 ran · honoured contract; 3 ran · our draft was wrong.

By repository: official repository: 18 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

yongjie-lin/bert-opensesame officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

18 samples harvested; 7 ran; 4 honoured the contract we drafted; 11 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

4ran · honoured contract
3ran · our draft was wrong
11unverified

Licence: 0 of the 18 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from yongjie-lin/bert-opensesame. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

swish yongjie-lin/bert-opensesame/pytorch_pretrained_bert/modeling.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 0f786c407fb1ee4c · report
gelu yongjie-lin/bert-opensesame/bertviz/bertviz/pytorch_pretrained_bert/modeling_gpt2.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 8d23fbe2b99b840b · report
gelu yongjie-lin/bert-opensesame/bertviz/bertviz/pytorch_pretrained_bert/modeling.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · fdc64f4c72036ae4 · report
gelu yongjie-lin/bert-opensesame/pytorch_pretrained_bert/modeling.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · 40e9fee2e0b7e278 · report
url_to_filename yongjie-lin/bert-opensesame/pytorch_pretrained_bert/file_utils.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · af64ec220e8bcdbc · report
warmup_constant yongjie-lin/bert-opensesame/pytorch_pretrained_bert/optimization.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · e7d542062316094a · report
warmup_linear yongjie-lin/bert-opensesame/pytorch_pretrained_bert/optimization.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · c58d57224530d17e · report
augment_data_JJ yongjie-lin/bert-opensesame/pytorch_pretrained_bert/dd_utils.py official repository unverified Apache-2.0 (permissive) · 776ea2acae7131ec · report
cached_path yongjie-lin/bert-opensesame/pytorch_pretrained_bert/file_utils.py official repository unverified Apache-2.0 (permissive) · 349d780dd4a89a37 · report
filename_to_url yongjie-lin/bert-opensesame/pytorch_pretrained_bert/file_utils.py official repository unverified Apache-2.0 (permissive) · db0ac56aaf6e35e6 · report
load_tf_weights_in_bert yongjie-lin/bert-opensesame/bertviz/bertviz/pytorch_pretrained_bert/modeling.py official repository unverified Apache-2.0 (permissive) · baa5766f4566aafc · report
load_tf_weights_in_gpt2 yongjie-lin/bert-opensesame/bertviz/bertviz/pytorch_pretrained_bert/modeling_gpt2.py official repository unverified Apache-2.0 (permissive) · a62604f618a8cc82 · report
load_tf_weights_in_openai_gpt yongjie-lin/bert-opensesame/bertviz/bertviz/pytorch_pretrained_bert/modeling_openai.py official repository unverified Apache-2.0 (permissive) · 46f305675277e757 · report
load_vocab yongjie-lin/bert-opensesame/pytorch_pretrained_bert/tokenization.py official repository unverified Apache-2.0 (permissive) · fb95c4b13cdf89a2 · report
normalize_string yongjie-lin/bert-opensesame/pytorch_pretrained_bert/dd_utils.py official repository unverified Apache-2.0 (permissive) · 5c1d1e5a7edda4cd · report
prep_batch yongjie-lin/bert-opensesame/pytorch_pretrained_bert/dd_utils.py official repository unverified Apache-2.0 (permissive) · 83145131533aa4db · report
warmup_cosine yongjie-lin/bert-opensesame/pytorch_pretrained_bert/optimization.py official repository unverified Apache-2.0 (permissive) · 35f7cddf90dd05d4 · report
whitespace_tokenize yongjie-lin/bert-opensesame/pytorch_pretrained_bert/tokenization.py official repository unverified Apache-2.0 (permissive) · da7295883cd7da14 · report

Tasks

DiagnosticSensitivity

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AdamAttentionAttention DropoutBERTDense ConnectionsDropoutLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionResidual ConnectionSoftmaxWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections