Skip to main content

reasoning-benchmarks

The reasoning-benchmarks library can be used to dynamically generate reasoning tasks based on formal argumentation to evaluate reasoning capabilities.

Reasoning puzzles

The following types of reasoning puzzles can be generated:

The following is a reasoning puzzle. Witnesses should always be believed
unless there is believable testimony that they are lying. Now consider the
following facts:

Witness Livia says that the employee arrived on time
Witness Aniyah says that Livia is lying
Witness Tatum says that Aniyah is lying

Final question: can we believe that the employee arrived on time??
End your answer with: "Answer: yes or no".

In addition to the binary reasoning task, we also provide multi-label tasks, where the solution requires the identification of all believable arguments:

The following is a reasoning puzzle. Witnesses should always be believed
unless there is believable testimony that they are not credible. Now consider the
following facts:

Witness Grace says that the password was changed
Witness Amelia says that Grace is not credible
Witness Micah says that Amelia is not credible

Final question: which witnesses can be believed?
End your answer with: "Answer: list of names that can be believed".
E.g. Answer: ['Alice', 'Bob']

Installation

pip install reasoning-benchmarks

Quickstart

from reasoning_benchmarks import generate_benchmark

# Quickly generate a benchmark
benchmark = generate_benchmark()

# Generate a benchmarks with optional parameters:
benchmark = generate_benchmark(
	chain_range=(1, 15), # Generates all unique chain graphs with 1 to 15 arguments 
	star_range=(3, 10), # Generates all unique 'star' graphs with 3 to 10 arguments
	shuffled=True, # Whether the arguments in the prompt should be shuffled or presented in order
	percentage_irrelevant=0.1, # The ratio of prompts that contain irrelevant argument chains
    irrelevant_len_range=(1,5), # A tuple (min_length, max_length) to determine the length of irrelevant chains, where (1, 5) would include irrelevant chains of length 1 to 5.
    irrelevant_num_range=(1,3), # A tuple (min_num, max_num) to determine the number of irrelevant chains, where (1, 3) would include 1 to 3 irrelevant chains.
	attack_words=["not credible", "unreliable", "lying"], # Which attack words are used in the prompt (randomly sampled from the provided list)
	num_variations_per_graph=(1, 1), # The number of variations per chain graph and star graph
	seed=95, # A fixed seed for reproducibility
    output_file='benchmark.csv', #save the benchmark DataFrame to this CSV file.
)

print(benchmark.head())

This allows for the dynamic generation of reasoning puzzles of scaling complexity, ranging from simple to complex.

Argumentation backend

The puzzles are based on argument attack graphs, that can be created using the library as follows:

from reasoning_benchmarks import ArgumentGraph, Argument, plot_argument_graph

# Initialize the graph
graph = ArgumentGraph()

# Create two arguments
a = Argument(0, 'Alice says that the train is late.')
b = Argument(1, 'Bob says that Alice is lying.')

# Add the arguments to the graph
graph.add_argument(a)
graph.add_argument(b)

# Add the attack between argument b and a
graph.add_attack(b, a)

# Determine the values of the arguments 
graph.solve()

# Display the resulting argument graph visually
plot_argument_graph(graph)

Based on this graph, you can generate a prompt using the create_prompt function:

from reasoning_benchmarks import create_prompt

prompt = create_prompt(graph)

Functions are included to quickly generate one, or multiple graphs:

from reasoning_benchmarks import generate_chain, generate_star_graph, generate_all_chains, generate_all_star_graphs

# Generate a chain graph with 3 arguments
chain = generate_chain(3)

# Generate a star graph with one center arguments, with chains of 3, 1, and 4 arguments attacking it
star = generate_star_graph([3, 1, 4])

# Generate all unique chain graphs with between 1 and 25 total number of arguments
chains = generate_all_chains(min_n=1, max_n=25)

# Generate all unique star graphs between 3 and 6 total number of arguments
stars = generate_all_star_graphs(min_n=3, max_n=6)

Development Build

python -m build

The package includes CSV resources under reasoning_benchmarks/src and accesses them via importlib.resources. These contain lists of names and statements used to generate the prompts and can be customized.

Metadata

Release files for reasoning-benchmarks 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reasoning-benchmarks 1.0.2
File Size Uploaded Provenance Actions
reasoning_benchmarks-1.0.2.tar.gz 24.4 kB Without provenance Details for reasoning_benchmarks-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reasoning-benchmarks 1.0.2
File Interpreter ABI Platform Actions
reasoning_benchmarks-1.0.2-py3-none-any.whl Python 3 none any Details for reasoning_benchmarks-1.0.2-py3-none-any.whl

Total release size: 49.1 kB

Release files / reasoning_benchmarks-1.0.2.tar.gz

Download URL reasoning_benchmarks-1.0.2.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c95716a7e9abfd0f7ab383c13cdeaa18d84704d79772d198d09fd379a259da86
BLAKE2b-256 checksum
How to use checksums
7b7589190de209962e6265deba17ca78544ff65b284e55b29eedfb29f7be3c97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / reasoning_benchmarks-1.0.2-py3-none-any.whl

Download URL reasoning_benchmarks-1.0.2-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cbe3d425db80436fae8f7e356aa9e4b69095c2e5250352d829a2a3d659aef33
BLAKE2b-256 checksum
How to use checksums
1826e13e23958008a848d1cf6c7ff7fd44c3951662dd4badf4abff2f1c0b39f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for reasoning-benchmarks 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page