SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1906.02762 · 2019

Understanding and Improving Transformer From a Multi-Particle Dynamic System Point of View

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; 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/1906.02762.json · badge: /api/ran/1906.02762.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
zhuohan123/macaron-net canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
check_concat Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/filter_and_cleanup_lines.py
code served (permissive licence) · get_code("9aa5761a12454e61")
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 bool, ndim 0, dtype family float, shape () 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 string

pending_tail = string.ascii_letters + string.digits + ','

def check_concat(line1, line2):
    global pending_tail
    if len(line1) == 0 or len(line2) == 0:
        return False
    return line1[-1] in pending_tail and line2[0] in string.ascii_lowercase

# Construct valid arguments
line1 = "hello,"
line2 = "apple"

ARGS = {
    "line1": line1,
    "line2": line2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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_tasks Ran
ran; our contract draft was wrong, not the code
zhuohan123/macaron-net/bert/macaron-scripts/glue/download_glue_data.py
pointer only (licence: BSD-3-Clause); the stored copy get_code serves, from dinghanshen/Cutoff, is pointer only (licence: NONE) · get_code("18962b43885bc12f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (BSD-3-Clause), but get_code serves the stored copy, first harvested from dinghanshen/Cutoff, and GitHub detected no licence in that repository 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. A run is recorded.

get_url Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/WikiExtractor.py
code served (permissive licence) · get_code("8294a226aac1a8d4")
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 str. 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.

from types import SimpleNamespace

options = SimpleNamespace(
    knownNamespaces={'Template': 10},
    templateNamespace='',
    templatePrefix='',
    moduleNamespace='',
    acceptedNamespaces=['w', 'wiktionary', 'wikt'],
    urlbase='https://en.wikipedia.org/w/index.php',
    filter_disambig_pages=False,
    keep_tables=False,
    keepLinks=False,
    keepSections=True,
    keepLists=False,
    toHTML=False,
    write_json=False,
    expand_templates=True,
    escape_doc=False,
    print_revision=False,
    min_text_length=0,
    templates={},
    redirects={},
    templateCache={},
    ignored_tag_patterns=[],
    discardElements=['gallery', 'timeline', 'noinclude', 'pre', 'table', 'tr', 'td', 'th', 'caption', 'div', 'form', 'input', 'select', 'option', 'textarea', 'ul', 'li', 'ol', 'dl', 'dt', 'dd', 'menu', 'dir', 'ref', 'references', 'img', 'imagemap', 'source', 'small', 'sub', 'sup', 'indicator']
)

def get_url(uid):
    return '%s?curid=%s' % (options.urlbase, uid)

ARGS = {
    'uid': 12345
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
is_valid Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/filter_and_cleanup_lines.py
code served (permissive licence) · get_code("0c501fb9b58d4e36")
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 bool, ndim 0, dtype family float, shape () 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 string
from collections import Counter

def is_valid(line):
    l = len(line)
    if l > 1000000 or l < 50:
        return False
    count = Counter(line)
    alpha_cnt = sum((count[ch] for ch in string.ascii_letters))
    if alpha_cnt < 50 or alpha_cnt / l < 0.7:
        return False
    if count['/'] / l > 0.05:
        return False
    if count['\\'] / l > 0.05:
        return False
    if count['|'] / l > 0.05 or line[0] == '|':
        return False
    return True

# Construct a valid line that passes all checks
# Length between 50 and 1000000
# At least 50 alphabetic characters
# Alphabetic characters >= 70% of length
# '/' count <= 5% of length
# '\\' count <= 5% of length
# '|' count <= 5% of length and first character is not '|'

# Create a line with 100 characters, mostly letters
valid_line = "a" * 80 + "b" * 20  # 100 chars, all letters (100% alpha)

ARGS = {
    "line": valid_line
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
keepPage Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/WikiExtractor.py
code served (permissive licence) · get_code("4438ef34a9207866")
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 bool, ndim 0, dtype family float, shape () 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 re
from types import SimpleNamespace

options = SimpleNamespace(
    knownNamespaces={'Template': 10},
    templateNamespace='',
    templatePrefix='',
    moduleNamespace='',
    acceptedNamespaces=['w', 'wiktionary', 'wikt'],
    urlbase='',
    filter_disambig_pages=False,
    keep_tables=False,
    keepLinks=False,
    keepSections=True,
    keepLists=False,
    toHTML=False,
    write_json=False,
    expand_templates=True,
    escape_doc=False,
    print_revision=False,
    min_text_length=0,
    templates={},
    redirects={},
    templateCache={},
    ignored_tag_patterns=[],
    discardElements=['gallery', 'timeline', 'noinclude', 'pre', 'table', 'tr', 'td', 'th', 'caption', 'div', 'form', 'input', 'select', 'option', 'textarea', 'ul', 'li', 'ol', 'dl', 'dt', 'dd', 'menu', 'dir', 'ref', 'references', 'img', 'imagemap', 'source', 'small', 'sub', 'sup', 'indicator']
)

filter_disambig_page_pattern = re.compile('{{disambig(uation)?(\\|[^}]*)?}}')

def keepPage(ns, page):
    if ns != '0':
        return False
    if options.filter_disambig_pages:
        for line in page:
            if filter_disambig_page_pattern.match(line):
                return False
    return True

ns_value = '0'
page_value = ['Some text here', 'More content', 'Additional lines']

ARGS = {
    'ns': ns_value,
    'page': page_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
normalizeTitle Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/WikiExtractor.py
code served (permissive licence) · get_code("049c25d034196deb")
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 str. 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 re
from types import SimpleNamespace

options = SimpleNamespace(knownNamespaces={'Template': 10}, templateNamespace='', templatePrefix='', moduleNamespace='', acceptedNamespaces=['w', 'wiktionary', 'wikt'], urlbase='', filter_disambig_pages=False, keep_tables=False, keepLinks=False, keepSections=True, keepLists=False, toHTML=False, write_json=False, expand_templates=True, escape_doc=False, print_revision=False, min_text_length=0, templates={}, redirects={}, templateCache={}, ignored_tag_patterns=[], discardElements=['gallery', 'timeline', 'noinclude', 'pre', 'table', 'tr', 'td', 'th', 'caption', 'div', 'form', 'input', 'select', 'option', 'textarea', 'ul', 'li', 'ol', 'dl', 'dt', 'dd', 'menu', 'dir', 'ref', 'references', 'img', 'imagemap', 'source', 'small', 'sub', 'sup', 'indicator'])

def ucfirst(string):
    """:return: a string with just its first character uppercase
    We can't use title() since it coverts all words.
    """
    if string:
        return string[0].upper() + string[1:]
    else:
        return ''

def normalizeNamespace(ns):
    return ucfirst(ns)

def normalizeTitle(title):
    """Normalize title"""
    title = title.strip(' _')
    title = re.sub('[\\s_]+', ' ', title)
    m = re.match('([^:]*):(\\s*)(\\S(?:.*))', title)
    if m:
        prefix = m.group(1)
        if m.group(2):
            optionalWhitespace = ' '
        else:
            optionalWhitespace = ''
        rest = m.group(3)
        ns = normalizeNamespace(prefix)
        if ns in options.knownNamespaces:
            title = ns + ':' + ucfirst(rest)
        else:
            title = ucfirst(prefix) + ':' + optionalWhitespace + ucfirst(rest)
    else:
        title = ucfirst(title)
    return title

ARGS = {
    'title': 'template: my page title'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
post_cleanup Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/filter_and_cleanup_lines.py
code served (permissive licence) · get_code("c74c1eb334214a99")
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 str. 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 re

def post_cleanup(line):
    line = re.sub('\\\\', ' ', line)
    return ' '.join(line.strip().split())

ARGS = {
    'line': 'hello\\world\\test  string'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
pre_cleanup Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/common/precleanup_english.py
code served (permissive licence) · get_code("092fa7f46a1a6f34")
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 str. 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 re

def pre_cleanup(line):
    line = line.replace('\t', ' ')
    line = ' '.join(line.strip().split())
    line = re.sub('\\.{4,}', '...', line)
    line = line.replace('<<', '«').replace('>>', '»')
    line = re.sub(' (,:\\.\\)\\]»)', '\\1', line)
    line = re.sub('(\\[\\(«) ', '\\1', line)
    line = line.replace(',,', ',').replace(',.', '.')
    line = re.sub(' \\*([^\\s])', ' \\1', line)
    return ' '.join(line.strip().split())

ARGS = {
    'line': 'Hello\tworld....  <<test>>,, value  *special'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
score Ran
ran on a synthesized input
zhuohan123/macaron-net/bert/macaron-scripts/bert/concat_short_sentences.py
code served (permissive licence) · get_code("43404249e690d259")
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 int, ndim 0, dtype family int, shape () 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
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - line1 and line2 are used with len() and indexing (line1[-1])
# - They need to be sequences (strings are ideal based on the checks for '.', '"', '!', '?')

line1 = "Hello world."
line2 = "This is a test"

ARGS = {
    "line1": line1,
    "line2": line2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
segment Not yet run
unverified (harvested, no recorded run)
zhuohan123/macaron-net/bert/macaron-scripts/bert/segment_sentence.py
code served (permissive licence) · get_code("434459caeb5fdaf7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 9 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
get_tasks 13 other papers
3 dated earlier, 10 later
1711.05225 (2017-11)
CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning
1804.07461 (2018-04)
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 10 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-22.

Repositories linked to this paper

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

Abstract

The Transformer architecture is widely used in natural language processing. Despite its success, the design principle of the Transformer remains elusive. In this paper, we provide a novel perspective towards understanding the architecture: we show that the Transformer can be mathematically interpreted as a numerical Ordinary Differential Equation (ODE) solver for a convection-diffusion equation in a multi-particle dynamic system. In particular, how words in a sentence are abstracted into contexts by passing through the layers of the Transformer can be interpreted as approximating multiple particles' movement in the space using the Lie-Trotter splitting scheme and the Euler's method. Given this ODE's perspective, the rich literature of numerical analysis can be brought to guide us in designing effective structures beyond the Transformer. As an example, we propose to replace the Lie-Trotter splitting scheme by the Strang-Marchuk splitting scheme, a scheme that is more commonly used and with much lower local truncation errors. The Strang-Marchuk splitting scheme suggests that the self-attention and position-wise feed-forward network (FFN) sub-layers should not be treated equally. Instead, in each layer, two position-wise FFN sub-layers should be used, and the self-attention sub-layer is placed in between. This leads to a brand new architecture. Such an FFN-attention-FFN layer is "Macaron-like", and thus we call the network with this new architecture the Macaron Net. Through extensive experiments, we show that the Macaron Net is superior to the Transformer on both supervised and unsupervised learning tasks. The reproducible codes and pretrained models can be found at https://github.com/zhuohan123/macaron-net

For agents

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

get_harvested_code_for_paper("1906.02762")
get_code_for_paper("1906.02762")
have("1906.02762")

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

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

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

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

Connect an agent — have() is free.