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

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.

## introduction the fluency of texts generated by large language models (llms) is reaching the level of humanwritten texts. however, the texts generated by llms still contain various types of errors such as incorrect claims, claims not grounded in the input, or irrelevant statements. for precise and fine-grained evaluation of model outputs, it is necessary to identify these errors on the level of word spans. there are two major ways to collect the span annotations: using either human @xcite or llm-based annotators @xcite . none of the existing nlp error annotation platforms are suitable for gathering and visualizing word-level annotations from both human and llmbased annotators. some platforms are limited to specific tasks like machine translation @xcite and retrieval-augmented generation @xcite . other platforms are more flexible but allow either only human @xcite or only llm @xcite annotations. systems supporting both annotation modalities typically include humans as post-editors only @xcite and existing 1 code is available at https://github.com/kasnerz/ factgenie/ . system demonstration video: https://youtu. be/csvccgvozpy . hpa holt (gb) 0.12 0.12 0.12 0.19 0.19 0.19 0.14 0.14 0.14 00 08 16 00 08 16 00 08 16 00 08 16 00 08 thu jan 4 fri jan 5 sat jan 6 sun jan 7 mon jan 8 -2°0 °2°4 °6°8 °10°1 2°9 75 1000 1025 (a) custom visualization of the input data. evaluation or visualization platforms require externally pre-annotated data @xcite @xcite . the lack of suitable tools for span-based error annotation motivated us to develop factgenie, a lightweight and customizable framework that enables collecting annotations from both humans and llms. specifically, factgenie can be used both to (a) collect annotations from human workers through crowdsourcing services and (b) collect annotations by prompting an llm through an api. besides that, factgenie can be used for visualizing the input data and the corresponding model outputs. input is table or rdf adjust file paths yes adapt data loaders no browse the dataset done done annotate using: prepare span categoriex prompt results as expected? run llm eval improve prepare span categoriex instructions results as expected? run crowdsourcing researching data with text outputs? yes! analyze the annotated dataset improve llm human yes yes it for individual experiments. the benefits of factgenie include: ## framework software-wise, factgenie is a combination of a flask backend and an html-based frontend. the frontend is powered by boostrap 5.3 and jquery, additionally using the ypet library for collecting span annotations. for visualizing the example input data, we use tinyhtml and highcharts.js. foot_0 figure 1 shows an example with weather data and the corresponding model-generated weather forecast. the model output was annotated for errors through factgenie. note that the colors and labels of text span annotation categories can be customized for each set of annotations. the framework can be used as-is or customized to cover a wide range of tasks and needs with minimal effort. to load and preview a new dataset, researchers first need to write a data loader class. existing data loaders include various visualizations of tabular, rdf, and json data. as shown in figure 2 , loading a dataset in a supported format can be as easy as changing a path to the data on the file system. to add a custom dataset type, the researcher must extend the dataset class. once the dataset is loaded, factgenie allows data inspection and rapid prototyping of llm annotations and crowdsourcing campaigns. ## human annotations to collect error annotation from human crowdworkers, researchers typically build custom web interfaces. with factgenie, researchers can easily build an annotation interface in four steps: the interface can be previewed for internal testing throughout the process. as shown in figure 2 , factgenie provides the feedback necessary for debugging and improving the evaluation campaign by an immediate visualization of the collected annotations. ## llm annotations it is useful to obtain annotations from llms in the same format as from human annotators. for that, factgenie provides a lightweight wrapper for model apis. 3 the process of collecting annotations from llms consists of the following steps: similarly to human annotations (section 3), the evaluation progress can be monitored and immediately visualized. ## roadmap the development of factgenie is ongoing and open to external developers. we are currently working on facilitating the management of evaluation campaigns by adding an option to set-up the evaluation campaign from the web interface in addition to configuration files. in the future, we plan to add more ready-made classes for data loaders, model apis, and crowdsourcing services.