Beware of Words: Evaluating the Lexical Diversity of Conversational LLMs using ChatGPT as Case Study

Gonzalo Martínez, José Alberto Hernández, Javier Conde, Pedro Reviriego, Elena MerinoarXiv 2024 · DOI

TL;DR

This paper introduces "Cave Verba," a framework designed to evaluate how hyperparameters and persona prompts affect the lexical diversity (vocabulary richness) of LLM-generated text. Using ChatGPT as a case study, the authors demonstrate that while extreme temperature settings degrade text into gibberish, adjusting the presence_penalty parameter linearly increases vocabulary richness, and prompting the model with a "child" persona significantly reduces it.

What Problem Does This Paper Address?

While the AI community heavily benchmarks Large Language Models (LLMs) on functional capabilities like mathematical reasoning, coding, and factual accuracy, the linguistic properties of the text they generate are largely overlooked.

This paper addresses this gap by focusing on lexical diversity—a measure of how varied and rich a model's vocabulary usage is. Because LLMs are increasingly used to generate public-facing content (from textbooks to web articles), their vocabulary choices will inevitably shape human language learning and future AI training loops. If LLMs consistently underutilize certain words, those words risk falling into disuse. Understanding how model configurations affect vocabulary richness is the first step toward preventing linguistic homogenization.

Methods

The authors propose a systematic evaluation methodology called Cave Verba (Latin for "beware of words"). Instead of evaluating text in a single default state, they analyze how lexical diversity shifts across three axes:

  1. Tasks and Topics: Differentiating between open-ended essay writing and factual question answering.
  2. System Roles (Personas): Testing 11 different sociolinguistic personas based on age, gender, social class, and education (e.g., "five-year-old child," "erudite," "lower-class adult male").
  3. Hyperparameters: Systematically sweeping four core API parameters: Temperature, Top_p (nucleus sampling), Frequency penalty, and Presence penalty.

To quantify vocabulary richness, they leverage the standard LexicalRichness Python module to calculate both local per-prompt metrics—Moving Average Type-Token Ratio (MATTR) and Measure of Lexical Diversity (MTLD)—and global corpus-level metrics (Root Type-Token Ratio and the Maas metric).

Datasets

The evaluation suite utilizes over 500 prompts drawn from established benchmarks to ensure representative text generation:

  • TOEFL Essays: 126 prompts for standard argumentative writing.
  • New York Times (NYT): 57 argumentative and 118 narrative writing prompts.
  • Human ChatGPT Comparison Corpus (HC3): 40 prompts randomly selected across five domains: open, finance, medicine, Reddit, and computing.

The distribution of these evaluation tasks is summarized below:

Table 1. Tasks testing data

Key Insights and Ideas

  • The Temperature "Breaking Point": Raising the temperature is traditionally thought to make models more "creative." However, the authors discovered a sharp threshold ($\ge 1.4$) where the text does not become more diverse, but completely breaks down into non-valid words and repetitive letter strings (e.g., "fulfilievedg bent structure ballo").
  • Presence Penalty is the Real Knob for Diversity: Unlike temperature or top_p, the presence_penalty parameter exhibits a clean, predictable, and linear relationship with lexical diversity without compromising the structural validity of the text.
  • Sociolinguistic Roles are Mostly Flat, Except for Children: Prompting the model to act as a specific gender or social class yielded negligible differences in vocabulary richness. However, the "child" persona drastically reduced lexical diversity across all metrics, likely due to the influence of datasets like ELI5 ("Explain Like I'm 5") in the models' alignment tuning.
  • Generational Richness: Under identical hyperparameter configurations, ChatGPT-4 consistently generates text with higher lexical diversity than ChatGPT-3.5.

Key Results

  • Hyperparameter Impact: Within the valid text generation range, temperature and frequency penalties only marginally increase diversity. top_p has virtually no impact until it approaches 1.0.
  • Invalid Text Zones: The authors explicitly mapped out hyperparameter zones that yield corrupted text, marking them in red in their analysis. As shown in the temperature sweep, metrics like MATTR and MTLD artificially spike in these zones due to the generation of fragmented, non-valid words.
Fig. 1. Lexical diversity per prompt metrics (MATTR, MTLD) average across all prompts versus Temperature, range values that produce incorrect results are marked in red.
  • Task-Based Variations: Lexical diversity was consistently higher in essay-writing tasks (TOEFL and NYT) than in domain-specific question answering (HC3), indicating that the nature of the prompt strongly dictates vocabulary constraints.

Limitations and Future Work

Because commercial models like ChatGPT are proprietary black boxes, the authors could not definitively link their findings to specific training data distributions or Reinforcement Learning from Human Feedback (RLHF) strategies.

To address this, the authors performed preliminary tests on open-source models (Mistral-7B and LLaMa3-8B), noting that Mistral did not show a drop in diversity for the child role, whereas LLaMa3 did. They suggest that future work should focus on a broader evaluation of open-source models where training data is documented, as well as expanding the linguistic analysis to non-English languages where LLM performance is known to degrade.

Summary updated

BibTeX
@misc{martinez2024beware,
  author = {Gonzalo Martínez and José Alberto Hernández and Javier Conde and Pedro Reviriego and Elena Merino},
  title = {{Beware of Words: Evaluating the Lexical Diversity of Conversational LLMs using ChatGPT as Case Study}},
  year = {2024},
  eprint = {2402.15518},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.15518},
}
Figure