SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1808.09357 · 2018

Rational Recurrences

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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, 1 violated it and 5 have no contract verdict; 1 failure of our instrument; 5 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/1808.09357.json · badge: /api/ran/1808.09357.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
Noahs-ARK/rational-recurrences canonical (classifier label)
classifier basis: census
8 ran · 5 no recorded run
FunctionStatusWhere it lives
RRNN_Compute_CPU Ran
ran on a synthesized input
Noahs-ARK/rational-recurrences/rrnn.py
code served (permissive licence) · get_code("0872bd92b43d3638")
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 torch
from torch.autograd import Variable

torch.manual_seed(0)

# Define a minimal semiring class that supports both type 0 and type 1
class Semiring:
    def __init__(self, semiring_type=0):
        self.type = semiring_type
    
    def plus(self, a, b):
        return a + b
    
    def times(self, a, b):
        return a * b

# Create arguments
d = 4  # state dimension
k = 4  # input feature dimension (u1, u2, forget1, forget2)
semiring = Semiring(semiring_type=0)  # type 0 uses standard arithmetic
bidirectional = False

ARGS = {
    'd': d,
    'k': k,
    'semiring': semiring,
    'bidirectional': bidirectional,
}
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 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
clean_str Ran
ran; our contract draft was wrong, not the code
Noahs-ARK/rational-recurrences/classification/dataloader.py
code served (permissive licence) · get_code("e9b5db20aa3c2994")
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 clean_str(string, TREC=False):
    """
    Tokenization/string cleaning for all datasets except for SST.
    Every dataset is lower cased except for TREC
    """
    string = re.sub("[^A-Za-z0-9(),!?\\'\\`]", ' ', string)
    string = re.sub("\\'s", " 's", string)
    string = re.sub("\\'ve", " 've", string)
    string = re.sub("n\\'t", " n't", string)
    string = re.sub("\\'re", " 're", string)
    string = re.sub("\\'d", " 'd", string)
    string = re.sub("\\'ll", " 'll", string)
    string = re.sub(',', ' , ', string)
    string = re.sub('!', ' ! ', string)
    string = re.sub('\\(', ' \\( ', string)
    string = re.sub('\\)', ' \\) ', string)
    string = re.sub('\\?', ' \\? ', string)
    string = re.sub('\\s{2,}', ' ', string)
    return string.strip() if TREC else string.strip().lower()

ARGS = {
    "string": "Hello, World! This is a test string with punctuation.",
    "TREC": False
}
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
identity Ran
ran, honoured the contract we drafted
Noahs-ARK/rational-recurrences/semiring.py
pointer only (licence: MIT); the stored copy get_code serves, from dholzmueller/universal_double_descent, is pointer only (licence: NONE) · get_code("9910e2fc297f8665")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from dholzmueller/universal_double_descent, 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.

read_MR Ran
ran on a synthesized input
Noahs-ARK/rational-recurrences/classification/dataloader.py
code served (permissive licence) · get_code("26599e150bedbc60")
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 os
import re
import random
import tempfile

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'rt-polarity.all')

# Write sample data to the temporary file
with open(temp_file, 'w', encoding='latin-1') as f:
    f.write("1\tThis is a great movie!\n")
    f.write("0\tThis is a terrible film.\n")
    f.write("1\tI loved every minute of it.\n")
    f.write("0\tAbsolutely boring and pointless.\n")

ARGS = {
    'path': temp_dir,
    'seed': 1234,
}
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 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
read_corpus Ran
ran on a synthesized input
Noahs-ARK/rational-recurrences/language_model/train_lm.py
code served (permissive licence) · get_code("1855e1e72c54dfb0")
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.

import numpy as np
import tempfile
import os

# Create a temporary file with test data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("hello world test\n")
temp_file.write("foo bar baz\n")
temp_file.close()

ARGS = {
    'path': temp_file.name,
    'sos': '<s>',
    'eos': '</s>',
    'shuffle': False
}
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 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
read_corpus Ran
ran on a synthesized input
Noahs-ARK/rational-recurrences/classification/dataloader.py
code served (permissive licence) · get_code("bb9a0e505460a9eb")
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 tempfile
import os

# Create a temporary file with sample data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='ISO-8859-1')
temp_file.write("1\tThis is a great movie! I love it.\n")
temp_file.write("0\tThis film is absolutely terrible.\n")
temp_file.write("1\tWonderful performance by the actors (excellent)?\n")
temp_file.close()

ARGS = {
    'path': temp_file.name,
    'clean': True,
    'TREC': False,
    'encoding': 'ISO-8859-1'
}
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 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
repackage_hidden Ran
ran on a synthesized input
Noahs-ARK/rational-recurrences/language_model/train_lm.py
code served (permissive licence) · get_code("25b388c0d2d1ecab")
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 3, 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 torch
from torch.autograd import Variable

torch.manual_seed(0)

# Create a simple args object that has a 'model' attribute
class Args:
    def __init__(self, model):
        self.model = model

# Create hidden state for LSTM/RNN - tuple of (h, c) where both are tensors
hidden_h = torch.randn(2, 4)  # batch_size=2, hidden_dim=4
hidden_c = torch.randn(2, 4)  # batch_size=2, hidden_dim=4
hidden = (hidden_h, hidden_c)

# Test with 'lstm' model
args_lstm = Args(model='lstm')

ARGS = {
    'args': args_lstm,
    'hidden': hidden
}
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, ndim 3, 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
str2bool Ran
ran, violated the contract we drafted
Noahs-ARK/rational-recurrences/classification/train_classifier.py
code served (permissive licence) · get_code("f017532fc389cbfe")
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) 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 argparse

def str2bool(v):
    if v.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')

# Setup code to construct valid arguments
ARGS = {
    'v': 'true'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
create_batches Not yet run
unverified (harvested, no recorded run)
Noahs-ARK/rational-recurrences/language_model/train_lm.py
code served (permissive licence) · get_code("a44cd456a2bbbef2")
How it ran

no invocation recorded.

eval_model Not yet run
unverified (harvested, no recorded run)
Noahs-ARK/rational-recurrences/classification/train_classifier.py
code served (permissive licence) · get_code("ffb793bae7c75c69")
How it ran

no invocation recorded.

one Not yet run
unverified (harvested, no recorded run)
Noahs-ARK/rational-recurrences/semiring.py
code served (permissive licence) · get_code("52a2958712db2837")
How it ran

no invocation recorded.

train_model Not yet run
unverified (harvested, no recorded run)
Noahs-ARK/rational-recurrences/classification/train_classifier.py
code served (permissive licence) · get_code("9b454a14330f8001")
How it ran

no invocation recorded.

zero Not yet run
unverified (harvested, no recorded run)
Noahs-ARK/rational-recurrences/semiring.py
code served (permissive licence) · get_code("43b57409cd1e6b6f")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
str2bool 82 other papers
5 dated earlier, 77 later
1510.03055 (2015-10)
A Diversity-Promoting Objective Function for Neural Conversation Models
1703.06490 (2017-03)
Generating Multi-label Discrete Patient Records using Generative Adversarial Networks
1710.10467 (2017-10)
Generalized End-to-End Loss for Speaker Verification
and 79 more not named here
identity 69 other papers
3 dated earlier, 66 later · 5 only as an assembly brick
1706.07296 (2017-06)
A Minimal Developmental Model Can Increase Evolvability in Soft Robots
1802.09419 (2018-02)
Stochastic Hyperparameter Optimization through Hypernetworks
1804.06055 (2018-04)
Co-occurrence Feature Learning from Skeleton Data for Action Recognition and Detection with Hierarchical Aggregation
and 66 more not named here
clean_str 1 other paper
1 later
2023.findings-emnlp.384 (2023 (year only))
Sparse Black-Box Multimodal Attack for Vision-Language Adversary Generation

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

Despite the tremendous empirical success of neural models in natural language processing, many of them lack the strong intuitions that accompany classical machine learning approaches. Recently, connections have been shown between convolutional neural networks (CNNs) and weighted finite state automata (WFSAs), leading to new interpretations and insights. In this work, we show that some recurrent neural networks also share this connection to WFSAs. We characterize this connection formally, defining rational recurrences to be recurrent hidden state update functions that can be written as the Forward calculation of a finite set of WFSAs. We show that several recent neural models use rational recurrences. Our analysis provides a fresh view of these models and facilitates devising new neural architectures that draw inspiration from WFSAs. We present one such model, which performs better than two recent baselines on language modeling and text classification. Our results demonstrate that transferring intuitions from classical models like WFSAs can be an effective approach to designing and understanding neural models.

For agents

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

get_harvested_code_for_paper("1808.09357")
get_code_for_paper("1808.09357")
have("1808.09357")

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

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

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

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

Connect an agent — have() is free.