SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.08097 · 2020

FinBERT: A Pretrained Language Model for Financial Communications

arXiv · PDF · Open in the Atlas

Code that ran

2 of 3 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 2 have no contract verdict; 0 failures of our instrument; 1 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/2006.08097.json · badge: /api/ran/2006.08097.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
yya518/FinBERT canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
FunctionStatusWhere it lives
train_model Ran
ran on a synthesized input
yya518/FinBERT/archive/train_bert.py
code served (permissive licence) · get_code("41ce57e84ab87874")
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 tuple, ndim 1, dtype family float; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:55:27Z. 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.

import torch
import torch.nn as nn
import torch.optim as optim
import os
import tempfile

torch.manual_seed(0)

# Create a minimal model that matches the function's usage
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)  # 4 input features, 3 output classes
    
    def forward(self, input_ids, token_type_ids, attention_mask):
        # The function expects outputs that can be passed through softmax and criterion
        # input_ids shape: (batch, seq_len) -> we'll flatten to (batch, 4)
        batch_size = input_ids.size(0)
        return self.linear(input_ids.float().view(batch_size, -1)[:, :4])

model = MinimalModel()

# Create a criterion (CrossEntropyLoss)
criterion = nn.CrossEntropyLoss()

# Create an optimizer
optimizer = optim.Adam(model.parameters(), lr=0.001)

# Create a scheduler
scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.1)

# Create device (CPU only)
device = torch.device('cpu')

# Create a temporary directory for logging
temp_dir = tempfile.mkdtemp()

# Create minimal dataloaders as lists of batches
# Each batch is (inputs_dict, sentiment_tensor)
def create_batch(batch_idx):
    batch_size = 2
    seq_len = 4
    num_classes = 3
    
    inputs = {
        'input_ids': torch.randint(0, 100, (batch_size, seq_len)),
        'token_type_ids': torch.zeros((batch_size, seq_len), dtype=torch.long),
        'attention_mask': torch.ones((batch_size, seq_len), dtype=torch.long)
    }
    
    # sentiment is one-hot encoded (batch_size, num_classes)
    sentiment = torch.zeros((batch_size, num_classes))
    for i in range(batch_size):
        sentiment[i, torch.randint(0, num_classes, (1,)).item()] = 1
    
    return (inputs, sentiment)

# Create train and val dataloaders
train_batches = [create_batch(i) for i in range(2)]
val_batches = [create_batch(i) for i in range(2)]

dataloaders_dict = {
    'train': train_batches,
    'val': val_batches
}

# Store dataset sizes globally so they're accessible in the function
dataset_sizes = {
    'train': sum(batch[1].size(0) for batch in train_batches),
    'val': sum(batch[1].size(0) for batch in val_batches)
}

# Make dataloaders_dict and dataset_sizes available globally
import builtins
builtins.dataloaders_dict = dataloaders_dict
builtins.dataset_sizes = dataset_sizes

ARGS = {
    'model': model,
    'model_type': 'test_model',
    'path': temp_dir,
    'criterion': criterion,
    'optimizer': optimizer,
    'scheduler': scheduler,
    'device': device,
    'num_epochs': 2,
    'early_stopping': 7
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
transform_labels Ran
ran on a synthesized input
yya518/FinBERT/archive/datasets.py
code served (permissive licence) · get_code("5e71e7eb04d90552")
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 tuple, ndim 2, 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.

import numpy as np

# Create sample data: list of [text/features, sentiment_label] pairs
x_y_list = [
    ["This is great", "positive"],
    ["This is okay", "neutral"],
    ["This is terrible", "negative"],
    ["Amazing product", "positive"],
]

ARGS = {
    "x_y_list": x_y_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple 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
financialPhraseBankDataset Not yet run
unverified (harvested, no recorded run)
yya518/FinBERT/archive/datasets.py
code served (permissive licence) · get_code("0d93d3da4d3fe9b8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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

Contextual pretrained language models, such as BERT (Devlin et al., 2019), have made significant breakthrough in various NLP tasks by training on large scale of unlabeled text re-sources.Financial sector also accumulates large amount of financial communication text.However, there is no pretrained finance specific language models available. In this work,we address the need by pretraining a financial domain specific BERT models, FinBERT, using a large scale of financial communication corpora. Experiments on three financial sentiment classification tasks confirm the advantage of FinBERT over generic domain BERT model. The code and pretrained models are available at https://github.com/yya518/FinBERT. We hope this will be useful for practitioners and researchers working on financial NLP tasks.

For agents

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

get_harvested_code_for_paper("2006.08097")
get_code_for_paper("2006.08097")
have("2006.08097")

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

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

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

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

Connect an agent — have() is free.