SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.02373 · 2023

nanoT5: A PyTorch Framework for Pre-training and Fine-tuning T5-style Models with Limited Resources

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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; 5 failures of our instrument; 3 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/2309.02373.json · badge: /api/ran/2309.02373.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
piotrnawrot/nanot5 canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
compute_input_and_target_lengths Ran
ran, honoured the contract we drafted
piotrnawrot/nanot5/nanoT5/utils/copied_utils.py
code served (permissive licence) · get_code("d8c4822a9c1aff8b")
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 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.

import torch
import numpy as np

torch.manual_seed(0)

# The function takes three numeric parameters
# inputs_length: desired length of tokenized inputs sequence (int)
# noise_density: float between 0 and 1
# mean_noise_span_length: float representing average noise span length

ARGS = {
    "inputs_length": 512,
    "noise_density": 0.15,
    "mean_noise_span_length": 3.0,
}
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 tuple, ndim 1, dtype family int — 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
extra_stats Ran
ran; our contract draft was wrong, not the code
piotrnawrot/nanot5/nanoT5/utils/train_utils.py
code served (permissive licence) · get_code("16e2ea40e8110ef0")
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 dict. 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
import torch.nn as nn
from torch.optim import SGD
import time

torch.manual_seed(0)

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.01)

# Create a minimal logging config
class LoggingConfig:
    def __init__(self):
        self.weights_l2 = True
        self.every_steps = 5

# Create args object with required attributes
class Args:
    def __init__(self):
        self.logging = LoggingConfig()
        self.last_log = time.time() - 0.5  # Simulate time elapsed

args = Args()

ARGS = {
    'args': args,
    'model': model,
    'optimizer': optimizer
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
forward Ran
ran; our contract draft was wrong, not the code
piotrnawrot/nanot5/nanoT5/utils/train_utils.py
code served (permissive licence) · get_code("d354eb40c8df3017")
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. 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
import torch.nn as nn

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, input_ids, labels=None):
        logits = self.linear(input_ids)
        loss = None
        if labels is not None:
            loss_fn = nn.CrossEntropyLoss()
            loss = loss_fn(logits, labels)
        
        class Outputs:
            pass
        
        outputs = Outputs()
        outputs.logits = logits
        outputs.loss = loss
        return outputs

model = MockModel()

batch = {
    'input_ids': torch.randn(2, 4),
    'labels': torch.tensor([0, 2])
}

ARGS = {
    'model': model,
    'batch': batch,
    'calc_acc': True
}
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 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
get_tokenizer Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
piotrnawrot/nanot5/nanoT5/utils/model_utils.py
code served (permissive licence) · get_code("094eae8c1e901338")
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 MockTokenizer. 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
from unittest.mock import MagicMock, patch

torch.manual_seed(0)

# Create a minimal mock args object
class MockArgs:
    def __init__(self):
        self.model = MockModel()

class MockModel:
    def __init__(self):
        self.name = "t5-small"

# Create a mock tokenizer that will be returned by AutoTokenizer.from_pretrained
class MockTokenizer:
    def __init__(self):
        self.model_max_length = 512
    
    def __call__(self, *args, **kwargs):
        return {}

mock_args = MockArgs()

# Patch AutoTokenizer.from_pretrained to return our mock tokenizer
def mock_from_pretrained(model_name, use_fast=True):
    tokenizer = MockTokenizer()
    return tokenizer

# Store the original and patch it
import transformers
original_from_pretrained = transformers.AutoTokenizer.from_pretrained
transformers.AutoTokenizer.from_pretrained = mock_from_pretrained

ARGS = {
    "args": mock_args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockTokenizer — a MockTokenizer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockTokenizer 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
maybe_grad_clip_and_grad_calc Ran
ran; our contract draft was wrong, not the code
piotrnawrot/nanot5/nanoT5/utils/train_utils.py
code served (permissive licence) · get_code("921498087b42cca7")
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 dict. 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
import torch.nn as nn
from unittest.mock import MagicMock

torch.manual_seed(0)

# Build a minimal model with parameters that have gradients
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))

model = TinyModel()

# Create dummy gradients for all parameters
for param in model.parameters():
    param.grad = torch.randn_like(param)

# Build a minimal accelerator mock with clip_grad_norm_ method
accelerator = MagicMock()
accelerator.clip_grad_norm_ = MagicMock(return_value=1.5)

# Build args with nested structure for optim and logging
class OptimConfig:
    def __init__(self, grad_clip):
        self.grad_clip = grad_clip

class LoggingConfig:
    def __init__(self, grad_l2):
        self.grad_l2 = grad_l2

class ArgsConfig:
    def __init__(self, grad_clip, log_grad_l2):
        self.optim = OptimConfig(grad_clip=grad_clip)
        self.logging = LoggingConfig(grad_l2=log_grad_l2)

# Test case 1: with grad clipping and grad_l2 logging
args = ArgsConfig(grad_clip=1.0, log_grad_l2=True)

ARGS = {
    'accelerator': accelerator,
    'model': model,
    'args': args
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
tokenize_function Ran
ran; our contract draft was wrong, not the code
piotrnawrot/nanot5/nanoT5/utils/copied_utils.py
code served (permissive licence) · get_code("8a721263c3f886fd")
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 dict. 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 numpy as np

class MockTokenizer:
    def __call__(self, text, return_attention_mask=False):
        # Simulate tokenizer output
        # Return a dict with 'input_ids' containing a list of token sequences
        # Create two sequences of different lengths to test concatenation
        input_ids = [
            np.array([1, 2, 3, 4, 5], dtype=np.int64),
            np.array([6, 7, 8, 9], dtype=np.int64)
        ]
        return {'input_ids': input_ids}

# Create mock examples dict with text field
examples = {
    'text': ['sample text 1', 'sample text 2']
}

# Create tokenizer instance
tokenizer = MockTokenizer()

# Set in_length to divide the concatenated tokens evenly
# Total tokens from tokenizer: 5 + 4 = 9
# With in_length=3, we get 9 // 3 * 3 = 9, which reshapes to (3, 3)
in_length = 3

ARGS = {
    'examples': examples,
    'tokenizer': tokenizer,
    'in_length': in_length
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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_config Not yet run
unverified (harvested, no recorded run)
piotrnawrot/nanot5/nanoT5/utils/model_utils.py
code served (permissive licence) · get_code("4e33c46bf6be0ea0")
How it ran

no invocation recorded.

get_model Not yet run
unverified (harvested, no recorded run)
piotrnawrot/nanot5/nanoT5/utils/model_utils.py
code served (permissive licence) · get_code("78d65b12d42b0968")
How it ran

no invocation recorded.

setup_basics Not yet run
unverified (harvested, no recorded run)
piotrnawrot/nanot5/nanoT5/utils/gen_utils.py
code served (permissive licence) · get_code("e079a044476cfb25")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
compute_input_and_target_lengths 4 other papers
2 dated earlier, 2 later
2109.10686 (2021-09)
Scale Efficiently: Insights from Pre-training and Fine-tuning Transformers
2304.06248 (2023-04)
LasUIE: Unifying Information Extraction with Latent Adaptive Structure-aware Generative Language Model
2310.14709 (2023-10)
Once Upon a $\textit{Time}$ in $\textit{Graph}$: Relative-Time Pretraining for Complex Temporal Reasoning
and 1 more not named here
setup_basics 1 other paper
1 later
2406.05797 (2024-06)
3D-MolT5: Leveraging Discrete Structural Information for Molecule-Text Modeling
tokenize_function 1 other paper
1 later
2406.05797 (2024-06)
3D-MolT5: Leveraging Discrete Structural Information for Molecule-Text Modeling

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

State-of-the-art language models like T5 have revolutionized the NLP landscape, but their computational demands hinder a large portion of the research community. To address this challenge, we present nanoT5, a specially-optimized PyTorch framework for efficient pre-training and fine-tuning of T5 models. Drawing on insights from optimizer differences and prioritizing efficiency, nanoT5 allows a T5-Base model to be pre-trained on a single GPU in just 16 hours, without any loss in performance. With the introduction of this open-source framework, we hope to widen the accessibility to language modelling research and cater to the community's demand for more user-friendly T5 (Encoder-Decoder) implementations. We make our contributions, including configurations, codebase, pre-training insights, and pre-trained models, available to the public.

For agents

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

get_harvested_code_for_paper("2309.02373")
get_code_for_paper("2309.02373")
have("2309.02373")

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

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

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

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

Connect an agent — have() is free.