SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1902.04094 · 2019

BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 2 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 2 failures of our instrument; 0 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/1902.04094.json · badge: /api/ran/1902.04094.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
nyu-dl/bert-gen canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
seanrjohnson/protein_gibbs_sampler community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
swastishreya/BERT_as_a_conditional_generative_model reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
opqrstuvcut/BertMouth reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
apply_gap_threshold Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/pgen_msa_revised.py
code served (permissive licence) · get_code("101fc3696d659817")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.

# Setup code for apply_gap_threshold function

# The function takes:
# 1. msa: a list of strings (sequences in multiple sequence alignment)
# 2. gap_threshold: a float (percentage threshold)

# Create a simple MSA with sequences containing gaps
msa = [
    "ACGT-ACG",
    "AC-T-A-G",
    "A-GTAA-G",
    "ACGTACG-"
]

gap_threshold = 50.0

ARGS = {
    "msa": msa,
    "gap_threshold": gap_threshold
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
count_gaps_per_column Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/pgen_msa_revised.py
code served (permissive licence) · get_code("afbc573394ab876e")
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 list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.

# Setup code for count_gaps_per_column function

# The function expects a list of strings representing sequences in a multiple sequence alignment
# Each string should be the same length, with '-' representing gaps

ARGS = {
    "msa": [
        "ACGT-ACG",
        "AC-T-ACG",
        "ACGT-A-G",
        "A-GTAACG"
    ]
}
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 list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
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
delete_msa_cols Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/pgen_msa_revised.py
code served (permissive licence) · get_code("2fab4a1c479f4304")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.

# Setup code for delete_msa_cols function

# Define a small multiple sequence alignment (MSA) as a list of strings
msa = [
    "ACGTACGT",
    "ACGTACGT",
    "TGCATGCA"
]

# Define columns to delete as an iterable of integers
cols_to_delete = [1, 3, 5]

# Create the ARGS dictionary mapping all parameters
ARGS = {
    "msa": msa,
    "cols": cols_to_delete
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
detokenize Ran
ran; our contract draft was wrong, not the code
swastishreya/BERT_as_a_conditional_generative_model/bert-babble.py
pointer only (licence: NONE) · get_code("992ab7ae4b4bf55c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, swastishreya/BERT_as_a_conditional_generative_model 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.

generate_step Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/esm_sampler.py
code served (permissive licence) · get_code("596377a7c60ebe03")
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 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

torch.manual_seed(0)

# Create a small logits tensor: seq_len=5, vocab_size=8
out = torch.randn(5, 8)

# Index into the sequence for generation
gen_idx = 2

# Temperature for logit scaling
temperature = 0.8

# Top-k sampling parameter
top_k = 3

# Whether to sample from full distribution
sample = False

# List of valid token indices to consider
valid_idx = [0, 1, 2, 4, 6, 7]

ARGS = {
    "out": out,
    "gen_idx": gen_idx,
    "temperature": temperature,
    "top_k": top_k,
    "sample": sample,
    "valid_idx": valid_idx,
}
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 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
get_seed_sent Ran
ran; our contract draft was wrong, not the code
nyu-dl/bert-gen/generate.py
code served (permissive licence) · get_code("8c1bb7962bc49e93")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple. 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 torch

class MockTokenizer:
    def tokenize(self, text):
        # Simple whitespace tokenizer that preserves [MASK] tokens
        tokens = text.split()
        return tokens

torch.manual_seed(0)

seed_sentence = "The cat sat on the [MASK]"
tokenizer = MockTokenizer()
masking = "none"
n_append_mask = 0

ARGS = {
    "seed_sentence": seed_sentence,
    "tokenizer": tokenizer,
    "masking": masking,
    "n_append_mask": n_append_mask
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
initialization_text Ran
ran, honoured the contract we drafted
opqrstuvcut/BertMouth/bert_mouth.py
pointer only (licence: NONE) · get_code("013a68b0ac4716fe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, opqrstuvcut/BertMouth 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.

partition Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/esm_msa_sampler.py
code served (permissive licence) · get_code("1ecf520984f04d3a")
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 list. 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 torch

torch.manual_seed(0)

# Simple list to partition
input_list = [1, 2, 3, 4, 5, 6, 7, 8]
num_partitions = 3

ARGS = {
    "input_list": input_list,
    "num_partitions": num_partitions,
}
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 list — a list output has no array shape of its own; none is 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
preprocess Ran
ran, honoured the contract we drafted
nyu-dl/bert-gen/generate.py
code served (permissive licence) · get_code("2a890c3f8ff19f47")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family int, shape (1, 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)

class MockTokenizer:
    def convert_tokens_to_ids(self, tokens):
        # Simple mock: map each token to an integer based on a small vocabulary
        vocab = {"hello": 1, "world": 2, "test": 3, "token": 4, "[PAD]": 0}
        return [vocab.get(token, 0) for token in tokens]

tokens = ["hello", "world", "test"]
tokenizer = MockTokenizer()

ARGS = {
    "tokens": tokens,
    "tokenizer": tokenizer
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 2, dtype family int, shape (1, 3) — shape (1, 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
rawbatchlen Ran
ran on a synthesized input
seanrjohnson/protein_gibbs_sampler/src/pgen/models.py
code served (permissive licence) · get_code("4eee62223e0dfeb0")
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

# The function rawbatchlen takes a string parameter raw_batch
# It counts characters that are not inside angle brackets (< >)
# The counting starts as True, becomes False when '<' is encountered,
# and becomes True again when '>' is encountered

raw_batch_example = "hello<world>test<foo>bar"

ARGS = {
    "raw_batch": raw_batch_example
}
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

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, 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 10 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-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

We show that BERT (Devlin et al., 2018) is a Markov random field language model. This formulation gives way to a natural procedure to sample sentences from BERT. We generate from BERT and find that it can produce high-quality, fluent generations. Compared to the generations of a traditional left-to-right language model, BERT generates sentences that are more diverse but of slightly worse quality.

For agents

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

get_harvested_code_for_paper("1902.04094")
get_code_for_paper("1902.04094")
have("1902.04094")

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

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

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

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

Connect an agent — have() is free.