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.0.tar.gz (20.7 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.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for folbench-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53d7460d48e4e6705641299d4ee2f7735e884a388a09359100e047ea357948af
MD5 015219c5d3f03a1c00bdad73fefe0db6
BLAKE2b-256 ae35c4029a33c5239d34fdcb2caabc5ee90777e7b37e50982d670428566ef22c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for folbench-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95be08a25361b6587600eefc8731ad22d6dda81ee35885747f04008f2ae85863
MD5 599e7c031d3dbbc1bf1f41a6f5d5ff74
BLAKE2b-256 80490ad3b56594332cf118f214fe9662a4e9e3f568506045458b75a3c483bf53

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