factgenie: A Framework for Span-based Evaluation of Generated Texts

Zdenek Kasner, Ondrej Plátek, Patrícia Schmidtová, Simone Balloccu, Ondrej Dusek

Abstract

We present factgenie, an open-source framework designed for annotating and visualizing word spans in textual model outputs. Annotations within the framework capture various span-based phenomena, such as semantic inaccuracies or irrelevant text, moving beyond coarse sentence-level metrics. factgenie enables annotation collection from both human crowdworkers and large language models (LLMs) through a unified web interface and an easily extensible codebase.

Introduction

While Large Language Models (LLMs) have become increasingly fluent, they remain prone to "hallucinations"—generating facts that are incorrect, misleading, or entirely ungrounded in the source data. Standard evaluation metrics like BLEU or ROUGE often fail to capture these nuances, as they focus on surface-level similarity rather than factual precision. Even sentence-level human evaluation can be too broad to identify exactly where a model went wrong.

Existing NLP annotation platforms often suffer from being restricted to specific tasks, supporting only one type of annotator (human or LLM), or requiring complex pre-processing. factgenie addresses this gap by providing a lightweight, customizable tool that allows researchers to visualize input data alongside model outputs and collect fine-grained, word-level error labels from multiple sources.

The factgenie Framework

Built on a Flask backend and a Bootstrap/jQuery frontend, factgenie is designed around three primary pillars:

1. Custom Visualization

To evaluate if a model output is grounded, an annotator must be able to see the source data clearly. factgenie utilizes libraries like Highcharts.js and TinyHTML to render complex input data—such as weather charts, RDF triples, or data tables—directly adjacent to the generated text. This ensures that the "ground truth" is as accessible as the text being evaluated.

2. Span-based Annotation

Using the YPet library, the framework allows users to highlight specific word spans and assign them to custom categories. Researchers can define their own error taxonomies, such as "incorrect fact," "misleading," or "uncheckable," allowing for a granular analysis of model performance.

3. Dual-Modality Workflow

factgenie supports a hybrid approach to evaluation:

  • Human Pipeline: Researchers can host the tool on a public URL to direct crowdworkers to a dedicated interface with specific instructions and custom categories.
  • LLM Pipeline: The framework includes a wrapper for model APIs (supporting OpenAI and Ollama for self-hosted models). It prompts the LLM to generate annotations in the same JSON format as human spans, enabling direct comparison or "LLM-as-a-judge" workflows.

Key Insights and Applications

One of the framework's core strengths is the realization that grounding is visual. By allowing for custom data loaders, researchers working on niche tasks (e.g., code generation from schemas) can build visualizers that represent the truth more effectively than raw JSON.

Furthermore, the unified format for both human and LLM annotators enables a seamless "hybrid" evaluation. Humans can audit LLM-generated labels, or LLMs can be used to provide a first pass of evaluation that humans then refine. This encourages an iterative debugging loop where researchers can run small batches of LLM evaluations, visualize the spans to verify prompt efficacy, and refine their approach before full-scale deployment.

Conclusion and Future Work

As an open-source system, factgenie provides a ready-made alternative to building custom annotation websites from scratch. It currently supports diverse data types including weather forecast data, tabular data, and RDF triples, with built-in loaders for common structured formats.

Future development will focus on reducing configuration overhead by moving setup tasks entirely into the web interface. The authors also plan to integrate more directly with popular crowdsourcing platforms and expand the library of ready-made classes for diverse data types and additional model APIs, further lowering the barrier to entry for fine-grained LLM evaluation.

Summary updated

Abstract

We present factgenie: a framework for annotating and visualizing word spans in textual model outputs. Annotations can capture various span-based phenomena such as semantic inaccuracies or irrelevant text. With factgenie, the annotations can be collected both from human crowdworkers and large language models. Our framework consists of a web interface for data visualization and gathering text annotations, powered by an easily extensible codebase.
BibTeX
@inproceedings{kasner2024factgenie,
  author = {Zdenek Kasner and Ondrej Plátek and Patrícia Schmidtová and Simone Balloccu and Ondrej Dusek},
  title = {{factgenie: A Framework for Span-based Evaluation of Generated Texts}},
  booktitle = {INLG (System Demonstrations)},
  year = {2024},
  url = {https://openreview.net/forum?id=Ww4dCg8ZjO},
}
Figure