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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

folbench-0.1.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

folbench-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file folbench-0.1.2.tar.gz.

File metadata

  • Download URL: folbench-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for folbench-0.1.2.tar.gz
Algorithm Hash digest
SHA256 516b4708b371391b746715da33b4f0f2fb993d9aec76b8cd04525c62e278186e
MD5 2eeca883fed8df33671cea443bb0236d
BLAKE2b-256 5fb6a9ada3db885ff8eb464777956a3043a130cfdf776ff39370db0638be7cd2

See more details on using hashes here.

File details

Details for the file folbench-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: folbench-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for folbench-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2126616ab7f70ed4568e8e40d440b015e1c4a69e29ce20abd422d3b737c975
MD5 b4fa904ece983c2e947c5a719af1f351
BLAKE2b-256 28dee414bf61ecaeac86bea3c7ca6c63813d9359856973b5051981a2b795f6db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page