SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2005.00697 · ACL · 2020

DeFormer: Decomposing Pre-trained Transformers for Faster Question Answering

Niranjan Balasubramanian, Harsh Trivedi, Qingqing Cao, Aruna Balasubramanian

arXiv · PDF · Open in the Atlas

Code that ran

3 of 6 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 3 no recorded run), measured 2026-11-21; 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/2005.00697.json · badge: /api/ran/2005.00697.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
StonyBrookNLP/deformer marked official in Papers with Code
Papers with Code archive
3 ran · 3 no recorded run
FunctionStatusWhere it lives
gelu Ran
ran, honoured the contract we drafted
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("aa3f814034078dc9")
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 EagerTensor, ndim 2, dtype family float, shape (2, 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 tensorflow as tf
import numpy as np

# The function takes a single parameter: x, which is a float tensor
# The function applies GELU activation by performing element-wise operations on the tensor

# Create a small float tensor to pass to the function
x = tf.constant([[1.0, 2.0, 3.0, 4.0],
                 [-1.0, -2.0, 0.5, -0.5]], dtype=tf.float32)

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
get_activation Ran
ran; our contract draft was wrong, not the code
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("cda2eae6b468a58a")
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 function. The image it ran in was not recorded. If your copy returns the same type 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 tensorflow as tf

# Set seed for reproducibility
tf.random.set_seed(0)

# Test case 1: String activation name
activation_string_1 = "relu"

# Test case 2: Empty string (should return None)
activation_string_2 = ""

# Test case 3: Linear activation (should return None)
activation_string_3 = "linear"

# Test case 4: GELU activation
activation_string_4 = "gelu"

# Test case 5: Tanh activation
activation_string_5 = "tanh"

# Test case 6: Non-string input (function object)
activation_string_6 = tf.nn.relu

# Test case 7: None input
activation_string_7 = None

# Create ARGS dict with all test cases
ARGS = {
    "activation_string": "relu"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
get_initializer Ran
ran; our contract draft was wrong, not the code
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("4f59e68b4035cf8a")
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 TruncatedNormal. The image it ran in was not recorded. If your copy returns the same type 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 tensorflow as tf

class ConfigStandIn:
    def __init__(self, initializer_range=None):
        self.initializer_range = initializer_range

ARGS = {
    "config": ConfigStandIn(initializer_range=0.02)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TruncatedNormal — a TruncatedNormal output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TruncatedNormal output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
BertEncoder Not yet run
unverified (harvested, no recorded run)
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("fe2a344ff9027718")
How it ran

no invocation recorded.

MultiHeadAttention Not yet run
unverified (harvested, no recorded run)
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("17837c6365878a53")
How it ran

no invocation recorded.

TransformerLayer Not yet run
unverified (harvested, no recorded run)
StonyBrookNLP/deformer/models/layers/transformer.py
code served (permissive licence) · get_code("28514670ab26db66")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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-21.

Repositories linked to this paper

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

Abstract

Transformer-based QA models use input-wide self-attention -i.e. across both the question and the input passage -at all layers, causing them to be slow and memory-intensive. It turns out that we can get by without inputwide self-attention at all layers, especially in the lower layers. We introduce DeFormer, a decomposed transformer, which substitutes the full self-attention with question-wide and passage-wide self-attentions in the lower layers. This allows for question-independent processing of the input text representations, which in turn enables pre-computing passage representations reducing runtime compute drastically. Furthermore, because DeFormer is largely similar to the original model, we can initialize DeFormer with the pre-training weights of a standard transformer, and directly fine-tune on the target QA dataset. We show DeFormer versions of BERT and XLNet can be used to speed up QA by over 4.3x and with simple distillation-based losses they incur only a 1% drop in accuracy. We open source the code at https://github.com/ StonyBrookNLP/deformer.

For agents

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

get_harvested_code_for_paper("2005.00697")
get_code_for_paper("2005.00697")
have("2005.00697")

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

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

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

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

Connect an agent — have() is free.