Exploring Precision and Recall to assess the quality and diversity of LLM s (2024)

Abstract: We introduce a novel evaluation framework for Large Language Models (LLMs) such as Llama-2 and Mistral, focusing on importing Precision and Recall metrics from image generation to text generation. This approach allows for a nuanced assessment of the quality and diversity of generated text without the need for aligned corpora. By conducting a comprehensive evaluation of state-of-the-art language models, the study reveals new insights into their performance on open-ended generation tasks, which are not adequately captured by traditional benchmarks. The findings highlight a trade-off between the quality and diversity of generated samples, particularly when models are fine-tuned on instruction dataset or with human feedback. This work extends the toolkit for distribution-based NLP evaluation, offering insights into the practical capabilities and challenges that current LLMs face in generating diverse and high-quality text.

## introduction in recent years and months, there has been a rapid democratization of large language models (llms), exemplified by platforms such as chat-gpt @xcite and huggingchat (hugging @xcite . these models are now widely accessible for a diverse range of tasks, from composing emails and application letters to performing multi-document summarization, generating medical prescriptions, and even crafting poetry and novels @xcite . the expanding spectrum of applications underscores the ubiquity of llms in our daily lives, necessitating the development of novel evaluation frameworks to accommodate their growing relevance. until recently, benchmarks were designed to target specific tasks such as machine translation, summarization, and question answering, among others. however, llms now encompass a wide range of tasks, prompting the community to reconsider methods for comparing and assessing these models. one proposed solution is to gather a diverse set of tasks to better evaluate the versatility of modern generative models. for example, the open llm leaderboard @xcite presents a unified framework consisting of closed questions that focus on the model's ability to provide concise and accurate answers. however, it is important to note that these evaluations are sample-based, relying on generated samples from the model compared against aligned references, written by humans. in contrast, the recent line of work on distribution-based metrics greatly departs from the sampled based evaluation. by considering llms and datasets as empirical distributions, the new metrics attempt to quantify how they differ and how they overlap. this shift drastically changes the scope of the evaluation. beyond performance measures based on human references, the objective is to estimate the disparity between some data distribution (p ) exhibited by human-written texts and the distribution learned by a llm (q), eliminating the need for aligned corpora. as exemplified by the development of mauve @xcite , this kind of approach opens new perspectives for comparing llms in terms of their generative abilities rather than for some peculiar tasks. however, many factors take part in assessing open-ended text generation and focusing on a single measure may restrict the significance of the evaluation. this is well known in the field of information retrieval, for example, where precision and recall are at the core of evaluation. although the usage of precision and recall for generative models has been previously used in image generation by @xcite and @xcite , we propose to adapt them to llms. with an extensive set of experiments involving prominent llms such as llama-2 @xcite and mistral @xcite , we show that these two new metrics significantly improve the evaluation with a better understanding and characterization of the flaws in text generation. precision and recall allow us to clearly distinguish between samples quality or adequacy (for precision) and a lack of diversity in the model outputs (for recall). empirical results show that these two measures are necessary for a in-depth comparison of llms. for instance, we are able to quantify that fine-tuning models on instruction sets with human feedback significantly improves sample quality, albeit at the expense of sample diversity, as evidenced in figure 1 ## related works historically, assessing text generation tasks has been dependent on human resources, such as annotated texts or aligned corpora. this is particularly true in areas like machine translation and automatic summarization, where n-gram based metrics have been developed, notably bleu @xcite ) and rouge @xcite . these metrics perform a rough comparison between the generated text and human-produced and aligned reference texts. more recent developments have introduced model-based metrics, such as bertscore foot_0 @xcite , which aim to capture semantic similarities more effectively. however, these evaluations still largely depend on "aligned references," meaning human-provided examples that constrain the expected range of generated outputs. the challenge becomes significantly greater with open-ended generation tasks, where the range of acceptable responses is vast and cannot be encapsulated by a single reference. ## background on precision and recall nowadays generative models for images are capable of producing ultra-realistic samples, making classical metrics such as fréchet inception distance (fid) @xcite too coarse to assess the full distributional properties of the models. this jump of performance has motivated the definition of precision and diversity for generative models. this need for a finer evaluation is exemplified on figure 3 . q 1 represents a model that produces realistic images but lacks diversity in the generated people's appearance. conversely, q 2 depicts a model generating a broad range of people with lower quality. capturing this significant tradeoff is essential for comprehending generative model behavior. inspired by the precision and recall metrics of binary classifications, the pioneering work of @xcite proposed to redefine these two terms to assess the quality and diversity of generative models. these metrics are based on a discretized estimation of the reference and model's distribution. @xcite pointed out some limitations of those metrics and proposed a new way to compute precision and recall, leveraging more robust support estimation. this method is now widely adopted in the literature and is typically used along with the fid. still, these metrics have some limitations, like the sensibility to outliers @xcite . this motivates further ongoing work on this topic, including theoretical contributions @xcite @xcite @xcite or practical methods @xcite . precision and recall definition. given its importance in the field of image generation, we adopt the definition of precision and recall introduced by @xcite . alternative definitions and approaches are discussed in appendix a.1. definition 1. let p and q be two distributions over a space @xmath0. we denote supp(p ) and supp(q) their support. the precision and the recall of q with respect to p are defined as: precision and recall in practice. since precision and recall involve an estimation of the support, standard pipelines involve a projection of the samples into an latent space, using pre-trained models such as inception-v3 @xcite or vgg @xcite . supports of the distributions are then estimated using a knearest neighbors algorithm. we present this algorithm in more detail in section 4. ## precision and recall to assess text generation in this paper, we introduce a framework for calculating precision and recall between distributions on texts. these distributions characterize a dataset, or a model, and its generative capability. the extended version of precision and recall builds upon the notion of support of distributions, which is in our case challenging to define and estimate. ## practical use cases for llms equiped with our freshly introduced precision and recall we now present an analysis of the quality of generation of a broad range of llms. we focus on three different tasks to illustrate the versatility of our metrics and the new insights they can provide. ## conclusion we introduced precision and recall as automated metrics for comparing generative model outputs against a reference distribution. these metrics serve as independent indicators of the quality and diversity of the generated text. in challenging scenarios where evaluation protocols are scarce, such as tasks with high generation complexity, we demonstrate the efficacy of our metrics in assessing the quality and diversity of model output. furthermore, our metrics revealed nuanced model behaviors that lie beyond the scope of traditional evaluation benchmarks. we believe that our work contributes to advancing the evaluation of generative models, offering valuable insights to better understand their capabilities, and aiding in the development of more refined evaluation protocols within the community.