Retrieval-based Evaluation for LLM s: A Case Study in K orean Legal QA (2023)

Abstract: While large language models (LLMs) have demonstrated significant capabilities in text generation, their utilization in areas requiring domain-specific expertise, such as law, must be approached cautiously. This caution is warranted due to the inherent challenges associated with LLM-generated texts, including the potential presence of factual errors. Motivated by this issue, we propose Eval-RAG, a new evaluation method for LLM-generated texts. Unlike existing methods, Eval-RAG evaluates the validity of generated texts based on the related document that are collected by the retriever. In other words, Eval-RAG adopts the idea of retrieval augmented generation (RAG) for the purpose of evaluation. Our experimental results on Korean Legal Question-Answering (QA) tasks show that conventional LLM-based evaluation methods can be better aligned with Lawyers’ evaluations, by combining with Eval-RAG. In addition, our qualitative analysis show that Eval-RAG successfully finds the factual errors in LLM-generated texts, while existing evaluation methods cannot.

## introduction recent advances of large language models (llms) are remarkable, in various natural language generative tasks such as translation or summarization. however, llms are prone to generating hallucinated text @xcite , i.e., the texts generated by llms are sometimes having factual errors, which implies the unreliability of the llm-generated text. consequently, it is necessary to develop a proper system of evaluating llmgenerated text, for using llms in real-world applications. various methods are proposed for evaluating natural language generation (nlg) @xcite @xcite . however, it is known that such classical evaluation methods have room for improvement compared with the human evaluation, especially for evaluating question answering (qa) tasks @xcite . ## method here we introduce the proposed eval-rag framework depicted in fig. 1 , which has two main components: the retriever r and the evaluator e. once an llm generates answer a for the query q, eval-rag evaluates whether answer a is proper or not for the query q. first, the retriever r finds legal documents d that are relevant to the query q. second, the evaluator e evaluates the validity of answer based on the related document d. retriever fig. 2 illustrates how retriever r retrieves the documents d related with the query q. this process contains three steps: data collection, sentence embedding, and query processing. in step 1, we collect three different types of publicly available legal documents: (1) legal question-answer pairs, (2) legal provisions and (3) legal cases (precedents). since our focus is given to qa tasks, we convert these documents into (question, document containing the answer) format, denoted by (q, d), in the following manner. given the legal questionanswer (q, a) pairs, we extract related document d from the answer a. for other documents d (legal provisions and legal cases), we use llms to generate relevant questions q. ## experiments we tested the performances of eval-rag and baselines for korean legal qa tasks, specifically focused on the questions related to divorce. ## related work qa and llm question answering (qa) is a task of providing answers to a given question, which is explored in last decades @xcite @xcite . recently, there are studies on qa for specific domains such as law @xcite @xcite , and studies on long-form question answering (lfqa) which involves searching external documents relevant to a given query, and then generating paragraph-length answers @xcite @xcite . the area of qa is greatly advanced using large language models (llms) @xcite . however, llms have several limitations, such as the generation of hallucinated text @xcite . one way of overcoming the limitations of llms is to us the retrieval augmented generation (rag) method, which integrates the retrieval module (which retrieves information from some data source) and the text generation module (which generates texts based on the retrieved information) in a unified framework @xcite . rag methods have recently demonstrated strong performance in qa @xcite @xcite . ## conclusion in this paper, we proposed eval-rag, a new method of evaluating llm-generated texts, with the aid of retrieved documents that are related with the target task. our experiments on korean legal qa tasks show that existing llm-based evaluations can be better aligned with ground-truth human evaluation, when combined with eval-rag.