SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.10261 · ACL · 2022

FaiRR: Faithful and Robust Deductive Reasoning over Natural Language

Xiang Ren, Soumya Sanyal, Harman Singh

arXiv · PDF · Open in the Atlas

Code that ran

8 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; 0 honoured the contract we drafted, 0 violated it and 7 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/2203.10261.json · badge: /api/ran/2203.10261.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
INK-USC/FaiRR canonical (classifier label)
classifier basis not recorded on the link
8 ran · 1 no recorded run
FunctionStatusWhere it lives
generate_proof Ran
ran on a synthesized input
INK-USC/FaiRR/proof_inference.py
code served (permissive licence) · get_code("acb5d67c498916e4")
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 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 itertools

# The function expects:
# 1. last_fact: a string key into proof_dict
# 2. proof_dict: a dict mapping facts to lists of (facts_list, rule_string) tuples
# 3. last_rule: optional string or None

# Build a minimal proof_dict structure
# proof_dict[fact] = [(facts_list, rule_string), ...]
# where facts_list is a list of facts (strings) and rule_string is a rule name

proof_dict = {
    'fact_A': [
        (['fact_B'], 'rule_1'),
        (['fact_base'], ''),
    ],
    'fact_B': [
        (['fact_C'], 'rule_2'),
    ],
    'fact_C': [
        (['fact_base'], ''),
    ],
    'fact_base': [
        (['fact_base'], ''),
    ],
}

ARGS = {
    'last_fact': 'fact_A',
    'proof_dict': proof_dict,
    'last_rule': None,
}
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 2, 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
get_out_fname Ran
ran on a synthesized input
INK-USC/FaiRR/process_proofwriter.py
code served (permissive licence) · get_code("5b93abe97f863f44")
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 torch
import numpy as np

class Args:
    def __init__(self):
        self.dataset = "test_dataset"
        self.world_assump = "test_world"
        self.fairr_model = "test_model"
        self.arch = "test_arch"

args = Args()
split = "train"
key = "output"
is_staged = True
return_folder = False

ARGS = {
    "args": args,
    "split": split,
    "key": key,
    "is_staged": is_staged,
    "return_folder": return_folder
}
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 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
get_proof_graph Ran
ran; our contract draft was wrong, not the code
INK-USC/FaiRR/pw_helper.py
code served (permissive licence) · get_code("c13d0749a5472646")
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.

# Setup code to construct valid arguments for get_proof_graph function

# The function takes a single parameter: proof_str (a string representing a proof structure)
# Looking at the function body, it:
# - Replaces parentheses and splits the string
# - Processes tokens including '(', ')', '[', ']', '->', and node names
# - Builds a graph of nodes and edges

# Create a valid proof string that exercises the function logic
proof_str = "(node1 -> node2 (node3 -> node4))"

ARGS = {
    "proof_str": proof_str
}
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
get_pw_fname Ran
ran on a synthesized input
INK-USC/FaiRR/process_proofwriter.py
code served (permissive licence) · get_code("3e7f33019c4d669c")
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 torch

class Args:
    def __init__(self, world_assump, dataset):
        self.world_assump = world_assump
        self.dataset = dataset

ARGS = {
    'args': Args(world_assump='open_world', dataset='proofwriter_name'),
    'subdir': 'NatLang',
    'split': 'train',
    'is_staged': True,
    'equivalence': False
}
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 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
get_pw_subdir Ran
ran on a synthesized input
INK-USC/FaiRR/process_proofwriter.py
code served (permissive licence) · get_code("0d99b520cf1b8a9e")
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 torch
import numpy as np

# The function only uses the 'dataset' parameter as a string
# It checks for substring patterns like '_leq_', '_eq_', and 'pararules'
# It also uses string methods like split() and string formatting

# Test case 1: dataset with '_leq_' pattern
dataset_leq = "some_leq_5_other"

# Test case 2: dataset with '_eq_' pattern
dataset_eq = "some_eq_3_other"

# Test case 3: dataset with 'pararules' pattern
dataset_pararules = "pararules_test"

# We'll use the first one as the primary argument
ARGS = {
    "dataset": "test_leq_7_experiment"
}
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 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
get_verb Ran
ran on a synthesized input
INK-USC/FaiRR/proof_inference.py
code served (permissive licence) · get_code("3ec8128c84eac6fa")
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 torch

# The function get_verb takes a single parameter 'sent' which is a string
# It checks if various verb substrings are present in the string
# and returns the corresponding verb

sent = " The cat visits the dog "

ARGS = {
    "sent": sent
}
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 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
negate Ran
ran on a synthesized input
INK-USC/FaiRR/proof_inference.py
code served (permissive licence) · get_code("e3feb54ff6e72cfe")
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 torch

torch.manual_seed(0)

# The function 'negate' takes a single parameter 'sent' which is a string
# It processes the string by checking for various verbs and negation patterns
# and returns a modified string

# Create valid test sentences to demonstrate different code paths
sent_with_visits = "The cat visits the house"
sent_with_is_not = "The dog is not happy"
sent_with_is = "The bird is blue"
sent_with_does_not = "The fox does not run"
sent_with_verb = "The mouse loves the cheese"

# We can use any of these sentences as valid arguments
# Let's pick one that exercises the code path
ARGS = {
    "sent": "The cat loves the dog"
}
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 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
parse_proof_inference_unstaged Ran
ran on a synthesized input
INK-USC/FaiRR/pw_helper.py
code served (permissive licence) · get_code("46ffcd272c3bb67a")
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 torch
import torch.nn as nn

class Node:
    def __init__(self, head):
        self.head = head

    def __str__(self):
        return str(self.head)

def get_proof_graph(proof_str):
    stack = []
    last_open = 0
    last_open_index = 0
    pop_list = []
    all_edges = []
    all_nodes = []
    proof_str = proof_str.replace('(', ' ( ')
    proof_str = proof_str.replace(')', ' ) ')
    proof_str = proof_str.split()
    should_join = False
    for i in range(len(proof_str)):
        _s = proof_str[i]
        x = _s.strip()
        if len(x) == 0:
            continue
        if x == '(':
            stack.append((x, i))
            last_open = len(stack) - 1
            last_open_index = i
        elif x == ')':
            for j in range(last_open + 1, len(stack)):
                if isinstance(stack[j][0], Node):
                    pop_list.append((stack[j][1], stack[j][0]))
            stack = stack[:last_open]
            for j in range(len(stack)):
                if stack[j][0] == '(':
                    last_open = j
                    last_open_index = stack[j][1]
        elif x == '[' or x == ']':
            pass
        elif x == '->':
            should_join = True
        else:
            if x not in all_nodes:
                all_nodes.append(x)
            if should_join:
                new_pop_list = []
                for index, p in pop_list:
                    if index < last_open_index:
                        new_pop_list.append((index, p))
                    else:
                        all_edges.append((p.head, x))
                pop_list = new_pop_list
            stack.append((Node(x), i))
            should_join = False
    return (all_nodes, all_edges)

# Create test data for the function
inference_fail = {
    'proofs': ['FAIL']
}

inference_no_intermediates = {
    'proofs': ['None']
}

inference_with_intermediates = {
    'proofs': '[( triple1 -> rule1 ) -> triple2]',
    'proofsWithIntermediates': [
        [('fact1', 'fact2'), ('fact2', 'fact3')]
    ]
}

json_dict_fail = {
    'id': 'test_fail',
    'triples': {},
    'rules': {}
}

json_dict_birds = {
    'id': 'Birds_1',
    'triples': {
        'triple1': {'text': 'bird flies'},
        'triple2': {'text': 'flies high'}
    },
    'rules': {
        'rule1': {'text': 'if bird then flies'}
    }
}

json_dict_with_data = {
    'id': 'Electricity_1',
    'triples': {
        'triple1': {'text': 'battery charged'},
        'triple2': {'text': 'light on'}
    },
    'rules': {
        'rule1': {'text': 'if charged then light'}
    }
}

# Test case 1: FAIL case
ARGS = {
    'inference': inference_fail,
    'json_dict': json_dict_fail,
    'strategy': 'other_strategy',
    'inference_data': False,
    'lowercase': 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 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
parse_all_questions Not yet run
unverified (harvested, no recorded run)
INK-USC/FaiRR/pw_helper.py
code served (permissive licence) · get_code("28a533581e0c4cfe")
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, 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 8 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_proof_graph 3 other papers
2 dated earlier, 1 later
2010.02830 (2020-10)
PROVER: Proof Generation for Interpretable Reasoning over Rules
2106.01354 (2021-06)
MULTIPROVER: Generating Multiple Proofs for Improved Interpretability in Rule Reasoning
2310.14491 (2023-10)
Towards a Mechanistic Interpretation of Multi-Step Reasoning Capabilities of Language Models

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

Transformers have been shown to be able to perform deductive reasoning on a logical rulebase containing rules and statements written in natural language. Recent works show that such models can also produce the reasoning steps (i.e., the proof graph) that emulate the model's logical reasoning process. Currently, these black-box models generate both the proof graph and intermediate inferences within the same model and thus may be unfaithful. In this work, we frame the deductive logical reasoning task by defining three modular components: rule selection, fact selection, and knowledge composition. The rule and fact selection steps select the candidate rule and facts to be used and then the knowledge composition combines them to generate new inferences. This ensures model faithfulness by assured causal relation from the proof step to the inference reasoning. To test our framework, we propose FAIRR (Faithful and Robust Reasoner) where the above three components are independently modeled by transformers. We observe that FAIRR is robust to novel language perturbations, and is faster at inference than previous works on existing reasoning datasets. Additionally, in contrast to black-box generative models, the errors made by FAIRR are more interpretable due to the modular approach. 1 1 The source code of FAIRR has been made available at https://github.com/INK-USC/FaiRR. fact1: Charlie is blue. fact2: Charlie is round. fact3: Erin is kind. fact4: Dave is round. rule1: If someone is blue then they are kind. rule2: Round, kind people are white.

For agents

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

get_harvested_code_for_paper("2203.10261")
get_code_for_paper("2203.10261")
have("2203.10261")

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

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

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

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

Connect an agent — have() is free.