Table of Contents
Fetching ...

Semantic Consistency for Assuring Reliability of Large Language Models

Harsh Raj, Vipul Gupta, Domenic Rosati, Subhabrata Majumdar

TL;DR

The paper tackles the problem of semantic consistency in large language models by introducing a general semantic-consistency metric, Cons_sem(Y), that extends beyond lexical overlap to entire generated sequences. It formulates two instantiations—pairwise semantic similarity and semantic clustering entropy—and leverages in-context paraphrasing and varied decoding to generate candidate outputs for evaluation. A novel prompting strategy, Ask-to-Choose (A2C), ranks multiple candidate responses to improve both accuracy and semantic consistency, with substantial gains on TruthfulQA for several models. The work demonstrates that semantic-consistency metrics align closely with human judgments, offering a robust framework for reliable open-ended generation and potential extension to multimodal domains.

Abstract

Large Language Models (LLMs) exhibit remarkable fluency and competence across various natural language tasks. However, recent research has highlighted their sensitivity to variations in input prompts. To deploy LLMs in a safe and reliable manner, it is crucial for their outputs to be consistent when prompted with expressions that carry the same meaning or intent. While some existing work has explored how state-of-the-art LLMs address this issue, their evaluations have been confined to assessing lexical equality of single- or multi-word answers, overlooking the consistency of generative text sequences. For a more comprehensive understanding of the consistency of LLMs in open-ended text generation scenarios, we introduce a general measure of semantic consistency, and formulate multiple versions of this metric to evaluate the performance of various LLMs. Our proposal demonstrates significantly higher consistency and stronger correlation with human evaluations of output consistency than traditional metrics based on lexical consistency. Finally, we propose a novel prompting strategy, called Ask-to-Choose (A2C), to enhance semantic consistency. When evaluated for closed-book question answering based on answer variations from the TruthfulQA benchmark, A2C increases accuracy metrics for pretrained and finetuned LLMs by up to 47%, and semantic consistency metrics for instruction-tuned models by up to 7-fold.

Semantic Consistency for Assuring Reliability of Large Language Models

TL;DR

The paper tackles the problem of semantic consistency in large language models by introducing a general semantic-consistency metric, Cons_sem(Y), that extends beyond lexical overlap to entire generated sequences. It formulates two instantiations—pairwise semantic similarity and semantic clustering entropy—and leverages in-context paraphrasing and varied decoding to generate candidate outputs for evaluation. A novel prompting strategy, Ask-to-Choose (A2C), ranks multiple candidate responses to improve both accuracy and semantic consistency, with substantial gains on TruthfulQA for several models. The work demonstrates that semantic-consistency metrics align closely with human judgments, offering a robust framework for reliable open-ended generation and potential extension to multimodal domains.

Abstract

Large Language Models (LLMs) exhibit remarkable fluency and competence across various natural language tasks. However, recent research has highlighted their sensitivity to variations in input prompts. To deploy LLMs in a safe and reliable manner, it is crucial for their outputs to be consistent when prompted with expressions that carry the same meaning or intent. While some existing work has explored how state-of-the-art LLMs address this issue, their evaluations have been confined to assessing lexical equality of single- or multi-word answers, overlooking the consistency of generative text sequences. For a more comprehensive understanding of the consistency of LLMs in open-ended text generation scenarios, we introduce a general measure of semantic consistency, and formulate multiple versions of this metric to evaluate the performance of various LLMs. Our proposal demonstrates significantly higher consistency and stronger correlation with human evaluations of output consistency than traditional metrics based on lexical consistency. Finally, we propose a novel prompting strategy, called Ask-to-Choose (A2C), to enhance semantic consistency. When evaluated for closed-book question answering based on answer variations from the TruthfulQA benchmark, A2C increases accuracy metrics for pretrained and finetuned LLMs by up to 47%, and semantic consistency metrics for instruction-tuned models by up to 7-fold.
Paper Structure (23 sections, 5 equations, 5 figures, 8 tables, 1 algorithm)

This paper contains 23 sections, 5 equations, 5 figures, 8 tables, 1 algorithm.

Figures (5)

  • Figure 1: Illustration of the in-context learning pipeline for paraphrase generation and semantic similarity scoring.
  • Figure 2: Examples of the two methods of paraphrasing and answer generation.
  • Figure 3: The rankPrompt Template for A2C
  • Figure 4: Accuracy and consistency of all models on TruthfulQA.
  • Figure 5: Pairwise correlations between all metrics and consistency annotations, for outputs from text-davinci-003 obtained using in-context paraphrasing.