LLM Classification Is Feature Engineering
LLM-as-classifiers often perform well, but they lack calibration and threshold control. Unlike traditional classifiers, LLMs do not provide well-calibrated probabilities or confidence levels, making it difficult to balance precision and recall. Additionally, LLMs do not effectively incorporate structured data or prior information, leading to potential loss of signal.
However, by treating the LLM's output as a feature in a logistic regression model, we can harness the power of LLMs while benefiting from traditional ML algorithms. This approach allows for calibration, threshold control, and the incorporation of additional information such as structured data or covariates. By adding more features, such as log probabilities from the LLM, we can improve the model's performance and achieve better calibration and threshold control.
One key advantage of this approach is that it enables us to adapt the model to different baselines and distributions by adjusting training data or reweighting examples. The interpretability of the model improves as well, as we can better understand the contribution of the LLM verdict and other features to the final decision. This approach offers the flexibility to experiment with various model architectures, such as xgboost or neural networks, depending on the specific problem at hand.
When working with LLMs-as-classifiers, collecting more training data and enhancing feature quality are crucial steps. While it may seem inconvenient to gather additional data, it is still preferable to this approach compared to the traditional "training-free" nature of LLM classification. Furthermore, refining features by screening and debugging them, treating features as secondary targets, and generating new features based on residuals or log probabilities can further improve the model's performance.
In summary, LLMs-as-classifiers may lack certain desirable features of traditional classifiers, but by treating their output as a feature in a logistic regression model, we can overcome these limitations and harness the power of LLMs while benefiting from the conveniences of standard ML algorithms.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.