Skip to main content

FOLBench: A Logic-Grounded Evaluation Suite for Evaluating Open-Ended Responses using Graph-Based Semantic Metrics on First-Order Logic form of Natural Language

FOLBench is an evaluation suite for assessing the quality of Logical Coherence and Correctness by feeding First-Order Logic (FOL) of the corresponding Natural Language. It provides a deterministic, reproducible, and multi-faceted framework for measuring how well logically aligned are they in graph structures.

🎯 Key Features

  • Multi-Metric Evaluation: Uses 6 core metrics to evaluate different aspects of logical coherence and correctness quality:

    • PAAS: Predicate-Argument Alignment Score (Semantic matching)
    • QSS: Quantifier Scope Similarity (Structural accuracy)
    • VBC: Variable Binding Consistency (Binding accuracy)
    • CLE: Canonicalized Logical Equivalence (Identity testing)
    • TED: Tree Edit Distance (Structural Edits)
    • HS: Hungarian Similarity (Structural Matching)
  • Composite Score: Combines individual metrics into a single FOLBench Score (0–1).

  • Visualization Tools: Built-in functions to visualize FOL graphs and debug translations.

📚 Metrics Overview

Metric Description Range Use Case
PAAS Measures alignment between predicate arguments 0–1.0 Semantic correctness
QSS Measures quantifier scope structure 0–1.0 Structural accuracy
VBC Measures variable binding consistency 0–1.0 Binding accuracy
CLE Checks logical equivalence of graphs 0–1.0 Equivalence testing
TED Checks structural edits needed for logical equivalence of graphs 0–1.0 Equivalence testing
HS Checks matching cost for logical equivalence of graphs 0–1.0 Equivalence testing
FOLBench Score Composite metric (0–1) 0–1 Comprehensive logical coherence and correctness score

🚀 Installation

pip install folbench

🔧 Usage

Basic Evaluation

from FOLBench.metrics import folbench_score, predicate_argument_alignment_score, quantifier_scope_similarity, variable_binding_consistency, equivalence_score, ted_structural_similarity, predicate_alignment_hungarian_similarity, visualize_fol_graph

graph_pred = ...  # Your predicted First-Order Logic formula
graph_gold = ...  # The gold standard First-Order Logic formula

# Calculate composite score
score = folbench_score(graph_pred, graph_gold)
print(f"FOLBench Score: {score:.2f}")

# Individual metrics
paas = predicate_argument_alignment_score(graph_pred, graph_gold)
qss = quantifier_scope_similarity(graph_pred, graph_gold)
vbc = variable_binding_consistency(graph_pred, graph_gold)
cle = equivalence_score(graph_pred, graph_gold)
ted_score = ted(graph_pred, graph_gold)

# Visualize graphs
visualize_fol_graph(graph_pred, title="Predicted Graph")
visualize_fol_graph(graph_gold, title="Gold Graph")

📊 Composite Score Calculation

The final score is a weighted average of the individual metrics:

FOLBench Score = (w1*PAAS + w2*QSS + w3*VBC + w4*CLE + w5*TED + w6*HS)

By default, all metrics have equal weight (0.16) but are customizable.

Release files for folbench 0.1.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 folbench 0.1.2
File Size Uploaded
folbench-0.1.2.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for folbench 0.1.2
File Interpreter ABI Platform
folbench-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / folbench-0.1.2.tar.gz

Download URL folbench-0.1.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
516b4708b371391b746715da33b4f0f2fb993d9aec76b8cd04525c62e278186e
BLAKE2b-256 checksum
How to use checksums
5fb6a9ada3db885ff8eb464777956a3043a130cfdf776ff39370db0638be7cd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / folbench-0.1.2-py3-none-any.whl

Download URL folbench-0.1.2-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d2126616ab7f70ed4568e8e40d440b015e1c4a69e29ce20abd422d3b737c975
BLAKE2b-256 checksum
How to use checksums
28dee414bf61ecaeac86bea3c7ca6c63813d9359856973b5051981a2b795f6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

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