Metamorphic Testing of Large Language Models for Natural Language Processing

Steven Cho, Stefano Ruberto, Valerio Terragni
11/3/2025
cs.SEcs.AI

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Using large language models (LLMs) to perform natural language processing (NLP) tasks has become increasingly pervasive in recent times. The versatile nature of LLMs makes them applicable to a wide range of such tasks. While the performance of recent LLMs is generally outstanding, several studies have shown that they can often produce incorrect results. Automatically identifying these faulty behaviors is extremely useful for improving the effectiveness of LLMs. One obstacle to this is the limited availability of labeled datasets, which necessitates an oracle to determine the correctness of LLM behaviors. Metamorphic testing (MT) is a popular testing approach that alleviates this oracle problem. At the core of MT are metamorphic relations (MRs), which define relationships between the outputs of related inputs. MT can expose faulty behaviors without the need for explicit oracles (e.g., labeled datasets). This paper presents the most comprehensive study of MT for LLMs to date. We conducted a literature review and collected 191 MRs for NLP tasks. We implemented a representative subset (36 MRs) to conduct a series of experiments with three popular LLMs, running approximately 560,000 metamorphic tests. The results shed light on the capabilities and opportunities of MT for LLMs, as well as its limitations.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cho2025metamorphic,
  title  = {Metamorphic Testing of Large Language Models for Natural Language Processing},
  author = {Steven Cho and Stefano Ruberto and Valerio Terragni},
  year   = {2025},
  eprint = {2511.02108},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2511.02108v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2511.02108.svg)](https://codeofpaper.com/paper/2511.02108)

Discussion