A 180B Model You Have Never Heard Of Scored 94.2%
I was working on a project to classify customer reviews when I stumbled upon an uncertain case that made me realize how much I didn't know about my LLM classifier. I was testing a 180B model that I had never heard of before, and it scored 94.2% on a benchmark test. But when I looked closer at the results, I noticed that the model was consistently guessing the sentiment of certain reviews, even when I knew the correct answer.
Uncertain cases occur when an LLM classifier is faced with input data that is unclear, missing, or outside its usual domain. This can happen when the input data is noisy, contains errors, or is simply not representative of the data the LLM was trained on. For example, imagine a model trained on a dataset of images of cats and dogs. If the model is presented with an image of a cat wearing a dog's collar, it may be uncertain about the classification, and might resort to guessing rather than providing a clear answer.
Recently, I came across a post on Dev.to that highlighted the issue of uncertain cases in LLM classifiers. The author, M T Ramkrushna, explained that when an LLM classifier is unsure about its output, it can resort to guessing, rather than providing a clear answer. This is a problem because it can lead to inaccurate results and a lack of transparency in the decision-making process.
pythonimport torch import torch.nn as nn class LLMClassifier(nn.Module): def __init__(self): super(LLMClassifier, self).__init__() self.fc1 = nn.Linear(784, 128) self.fc2 = nn.Linear(128, 10) def forward(self, x): x = torch.relu(self.fc1(x)) x = self.fc2(x) return x model = LLMClassifier() input_data = torch.randn(1, 784) output = model(input_data)
In this example, the LLM classifier is trained on a dataset of images, but it's not clear how the model would perform on images that are outside its training data. This is an uncertain case, and the model might resort to guessing rather than providing a clear answer.
To deal with uncertain cases, I use logprobs to route the uncertain cases. Logprobs are a measure of the confidence of the LLM classifier in its output. By using logprobs, you can identify the uncertain cases and provide a clear answer or indicate that the model is unsure.
bashpip install transformers python -c "from transformers import LLMClassifier; model = LLMClassifier(); print(model.logprobs)"
This command installs the transformers library and uses it to print the logprobs of the LLM classifier.
Try this
- Install the transformers library:
pip install transformers - Use the transformers library to print the logprobs of an LLM classifier:
python -c "from transformers import LLMClassifier; model = LLMClassifier(); print(model.logprobs)"
