SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.03654 · 2020

DeBERTa: Decoding-enhanced BERT with Disentangled Attention

Jianfeng Gao, Microsoft Dynamics, Weizhu Chen, Xiaodong Liu, Pengcheng He

arXiv · PDF · Open in the Atlas

Code that ran

4 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 1 failure of our instrument; 9 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2006.03654.json · badge: /api/ran/2006.03654.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
huggingface/transformers named in the paper
Papers with Code archive
2 ran · 6 no recorded run
huberemanuel/DeBERTa community
Papers with Code archive
1 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
Jason-J-Choi/DeBERTa_TxtClassifier community
Papers with Code archive
0 ran · 2 no recorded run
FunctionStatusWhere it lives
build_relative_position Ran
ran, honoured the contract we drafted
huberemanuel/DeBERTa/DeBERTa/deberta/disentangled_attention.py
code served (permissive licence) · get_code("13eb8311c1ce7813")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family int, shape (1, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "query_size": 4,
    "key_size": 3,
    "device": torch.device("cpu")
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family int, shape (1, 4, 3) — shape (1, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
c2p_dynamic_expand Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from whu-zqh/panda
pointer only · get_code("ea37553c09194184")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

p2c_dynamic_expand Ran
ran, honoured the contract we drafted
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("ae6281c3878be6f2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 5, 3, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - c2p_pos: needs .expand() method, so it's a tensor
# - query_layer: needs .size(0) and .size(1), so it's a tensor
# - key_layer: needs .size(-2), so it's a tensor
# - The expand call uses: [query_layer.size(0), query_layer.size(1), key_layer.size(-2), key_layer.size(-2)]

# Let's construct tensors with distinct sizes to probe dimensions:
# query_layer: shape [batch, seq_q, ...] -> size(0)=2, size(1)=5
# key_layer: shape [..., seq_k, dim] -> size(-2)=3
# c2p_pos: shape that can expand to [2, 5, 3, 3]

query_layer = torch.randn(2, 5, 4)  # batch=2, seq_q=5, feature=4
key_layer = torch.randn(2, 3, 4)    # batch=2, seq_k=3, feature=4
c2p_pos = torch.randn(1, 1, 1, 1)   # broadcastable to [2, 5, 3, 3]

ARGS = {
    "c2p_pos": c2p_pos,
    "query_layer": query_layer,
    "key_layer": key_layer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 5, 3, 3) — shape (2, 5, 3, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
uneven_size_corrected Ran
ran, violated the contract we drafted
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("e2a1ad92582b1c32")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 5, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct tensors for the function
# The function checks if query_layer.size(-2) != key_layer.size(-2)
# If true, it accesses relative_pos[:, :, :, 0] and uses torch.gather on p2c_att
# p2c_att needs to be gathered along dim=2
# pos_index is unsqueezed to -1, then expanded to p2c_att.size()[:2] + (pos_index.size(-2), key_layer.size(-2))

# Let's make query and key have different seq lengths to trigger the if branch
batch_size = 2
num_heads = 3
query_seq_len = 5
key_seq_len = 4
hidden_dim = 8

query_layer = torch.randn(batch_size, num_heads, query_seq_len, hidden_dim)
key_layer = torch.randn(batch_size, num_heads, key_seq_len, hidden_dim)

# p2c_att should be gatherable along dim=2
# After gather, it should work with the expanded index
# p2c_att shape needs dim=2 to be large enough for gather with pos_index expansion
p2c_att = torch.randn(batch_size, num_heads, 10, key_seq_len)

# relative_pos[:, :, :, 0] should give shape (batch, heads, query_seq_len)
# After unsqueeze(-1), it becomes (batch, heads, query_seq_len, 1)
# After expand to p2c_att.size()[:2] + (pos_index.size(-2), key_layer.size(-2))
# which is (batch, heads) + (query_seq_len, key_seq_len) = (batch, heads, query_seq_len, key_seq_len)
relative_pos = torch.randint(0, 10, (batch_size, num_heads, query_seq_len, 1))

ARGS = {
    "p2c_att": p2c_att,
    "query_layer": query_layer,
    "key_layer": key_layer,
    "relative_pos": relative_pos,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 5, 4) — shape (2, 3, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DisentangledSelfAttention Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("19acc433093c6b7f")
How it ran

no invocation recorded.

DisentangledSelfAttention Not yet run
unverified (harvested, no recorded run)
huberemanuel/DeBERTa/DeBERTa/deberta/disentangled_attention.py
code served (permissive licence) · get_code("11b6e1335dfd930b")
How it ran

no invocation recorded.

DisentangledSelfAttention Not yet run
unverified (harvested, no recorded run)
Jason-J-Choi/DeBERTa_TxtClassifier/DeBERTa/DeBERTa/deberta/disentangled_attention.py
pointer only (licence: NONE) · get_code("d58dca4065cc811b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jason-J-Choi/DeBERTa_TxtClassifier when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

build_relative_position Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("329f69a2123fce0a")
How it ran

no invocation recorded.

build_relative_position Not yet run
unverified (harvested, no recorded run)
Jason-J-Choi/DeBERTa_TxtClassifier/DeBERTa/DeBERTa/deberta/disentangled_attention.py
pointer only (licence: NONE) · get_code("f786b01bf4a40368")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Jason-J-Choi/DeBERTa_TxtClassifier when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

build_rpos Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("ae7fe256df7fb4a0")
How it ran

no invocation recorded.

compute_attention_span Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("f396ca17c8d05eb5")
How it ran

no invocation recorded.

pos_dynamic_expand Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("39afa351a5c3eb0f")
How it ran

no invocation recorded.

scaled_size_sqrt Not yet run
unverified (harvested, no recorded run)
huggingface/transformers/src/transformers/models/deberta/modeling_deberta.py
code served (permissive licence) · get_code("3baad94f5c62f90f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
build_relative_position
brick of this paper's assembly: helper
6 other papers
6 later
2207.07087 (2022-07)
Parameter-Efficient Prompt Tuning Makes Generalized and Calibrated Neural Text Retrievers
2208.10160 (2022-08)
PANDA: Prompt Transfer Meets Knowledge Distillation for Efficient Model Adaptation
2210.12360 (2022-10)
Prompt-Tuning Can Be Much Better Than Fine-Tuning on Cross-lingual Understanding With Multilingual Language Models
and 3 more not named here
c2p_dynamic_expand
brick of this paper's assembly: helper
6 other papers
6 later
2207.07087 (2022-07)
Parameter-Efficient Prompt Tuning Makes Generalized and Calibrated Neural Text Retrievers
2208.10160 (2022-08)
PANDA: Prompt Transfer Meets Knowledge Distillation for Efficient Model Adaptation
2210.12360 (2022-10)
Prompt-Tuning Can Be Much Better Than Fine-Tuning on Cross-lingual Understanding With Multilingual Language Models
and 3 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recent progress in pre-trained neural language models has significantly improved the performance of many natural language processing (NLP) tasks. In this paper we propose a new model architecture DeBERTa (Decoding-enhanced BERT with disentangled attention) that improves the BERT and RoBERTa models using two novel techniques. The first is the disentangled attention mechanism, where each word is represented using two vectors that encode its content and position, respectively, and the attention weights among words are computed using disentangled matrices on their contents and relative positions, respectively. Second, an enhanced mask decoder is used to incorporate absolute positions in the decoding layer to predict the masked tokens in model pre-training. In addition, a new virtual adversarial training method is used for fine-tuning to improve models' generalization. We show that these techniques significantly improve the efficiency of model pre-training and the performance of both natural language understand (NLU) and natural langauge generation (NLG) downstream tasks. Compared to RoBERTa-Large, a DeBERTa model trained on half of the training data performs consistently better on a wide range of NLP tasks, achieving improvements on MNLI by +0.9% (90.2% vs. 91.1%), on SQuAD v2.0 by +2.3% (88.4% vs. 90.7%) and RACE by +3.6% (83.2% vs. 86.8%). Notably, we scale up DeBERTa by training a larger version that consists of 48 Transform layers with 1.5 billion parameters. The significant performance boost makes the single DeBERTa model surpass the human performance on the SuperGLUE benchmark (Wang et al., 2019a) for the first time in terms of macro-average score (89.9 versus 89.8), and the ensemble DeBERTa model sits atop the SuperGLUE leaderboard as of January 6, 2021, outperforming the human baseline by a decent margin (90.3 versus 89.8). The pre-trained DeBERTa models and the source code were released at: https://github.com/microsoft/DeBERTa 1 .

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2006.03654")
get_code_for_paper("2006.03654")
have("2006.03654")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2006.03654.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2006.03654.svg)](https://syntology.ai/paper/2006.03654)

Connect an agent — have() is free.