LLM Evaluation Using k-NN Retrieval to Correct Zero-Shot Bias

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for evaluating large language models, particularly in zero or few shot scenarios, suffer from prediction biases due to pre-training data and context ordering, leading to inconsistent performance and lack of interpretability.

Innovation Solution

A method combining a debiased output probability distribution of a large language model with a k-Nearest Neighbor search result, using interpolation to enhance interpretability and accuracy in downstream tasks without fine-tuning.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If zero or few shot evaluation is used to evaluate large language models without fine-tuning, then the intrinsic performance metric is obtained, but prediction bias occurs due to pre-training data or context ordering

Engineering Contradiction:
Improveintrinsic performance metricVSAvoidprediction accuracy
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

The patent introduces k-Nearest Neighbor search as an intermediary mechanism between the language model and the final prediction. The kNN search retrieves similar training instances and uses their labels to correct the biased predictions from the language model, effectively mediating the evaluation process to eliminate ordering effects while preserving intrinsic performance measurement

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent changes the evaluation parameter from direct language model predictions to interpolated predictions that combine language model outputs with kNN-based corrections. By adjusting the interpolation weight and selecting different k values, the system optimizes prediction accuracy while maintaining the zero-shot evaluation framework

Inventive Principle:
Principle #35Parameter changes

2Measurement precision

If calibration parameters are fitted to suppress large language model biasing behavior, then prediction uniformity across answers is improved, but interpretability decreases

Engineering Contradiction:
Improveprediction uniformityVSAvoidinterpretability
Core Design Contradiction:
Measurement precisionVSLoss of information

Solution Approach 1:

The patent uses k-Nearest Neighbor search to copy and retrieve similar training instances from the training set. These retrieved instances serve as interpretable evidence for the final prediction, allowing users to understand which training examples influenced the prediction while maintaining prediction uniformity through the kNN correction mechanism

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent implements a feedback mechanism where the kNN search results provide corrective information back to the language model predictions. The retrieved similar instances and their labels form a feedback loop that adjusts biased predictions while providing interpretable reasoning for the corrected output

Inventive Principle:
Principle #23Feedback

3Measurement precision

If the order of training instances in a prompt is changed, then prediction bias is affected, but evaluation consistency deteriorates

Engineering Contradiction:
Improveprediction bias controlVSAvoidevaluation consistency
Core Design Contradiction:
Measurement precisionVSStability of the object's composition

Solution Approach 1:

The patent extracts the ordering effect from the evaluation process by using kNN search to retrieve training instances based on similarity rather than position. This extraction removes the harmful influence of instance ordering while maintaining evaluation consistency, as the kNN retrieval is independent of the original prompt sequence

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentUS12572750B2Large language model evaluation with enhanced interpretability by k-nearest neighbor search
Publication Date: 2026.03.10 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US12572750B2 patent drawing
  • US12572750B2 patent drawing
  • US12572750B2 patent drawing

AI summary

Techniques for fine-tuning free evaluation of large language models with enhanced interpretability using a debiased output probability distribution of a large language model and a probability distribution of a k-Nearest Neighbor search result are provided. In one aspect, a method for performing a downstream task with a language model includes: constructing a datastore by applying the language model to a training set; applying the language model to a prompt-applied sentence from a testing set to obtain a language model feature vector; performing a k-Nearest Neighbor search of the datastore using the language model feature vector as a query vector; and interpolating a probability distribution of results from the k-Nearest Neighbor search and an output probability distribution of the language model to obtain a prediction for the downstream task.