Hierarchical Text Classification Using Black Box Large Language Models

2508.04219v1 cs.CL, cs.LG 2025-08-09
Авторы:

Kosuke Yoshimura, Hisashi Kashima

Резюме на русском

**Резюме** В статье рассматривается задача хиерархической классификации текстов (HTC), связанная с проблемами нехватки данных и высокой сложности моделей. Предлагается использовать блэк-боксные Large Language Models (LLMs), доступные через API, в качестве альтернативы стандартным методам машинного обучения, требующим больших объемов меток и вычислительных ресурсов. Авторы экспериментировали с тремя стратегиями подсказок (prompting): Direct Leaf Label Prediction (DL), Direct Hierarchical Label Prediction (DH) и Top-down Multi-step Hierarchical Label Prediction (TMH) в zero-shot и few-shot режимах. Результаты на двух наборах данных показали, что few-shot повышает точность классификации по сравнению с zero-shot. Хотя традиционные методы классификации показали высокую точность на данных с широкой легкодоступной иерархией, LLMs, особенно с DH, показали лучшие результаты на глубокой иерархии. Однако API-затраты на DH высоки из-за большого количества токенов. Таким образом, авторы выделяют торговление между улучшением точности и трудоемкостью выполнения. Наблюдается перспектива LLMs в HTC, но требуется оптимальный выбор стратегий для баланса точности и затрат.

Abstract

Hierarchical Text Classification (HTC) aims to assign texts to structured label hierarchies; however, it faces challenges due to data scarcity and model complexity. This study explores the feasibility of using black box Large Language Models (LLMs) accessed via APIs for HTC, as an alternative to traditional machine learning methods that require extensive labeled data and computational resources. We evaluate three prompting strategies -- Direct Leaf Label Prediction (DL), Direct Hierarchical Label Prediction (DH), and Top-down Multi-step Hierarchical Label Prediction (TMH) -- in both zero-shot and few-shot settings, comparing the accuracy and cost-effectiveness of these strategies. Experiments on two datasets show that a few-shot setting consistently improves classification accuracy compared to a zero-shot setting. While a traditional machine learning model achieves high accuracy on a dataset with a shallow hierarchy, LLMs, especially DH strategy, tend to outperform the machine learning model on a dataset with a deeper hierarchy. API costs increase significantly due to the higher input tokens required for deeper label hierarchies on DH strategy. These results emphasize the trade-off between accuracy improvement and the computational cost of prompt strategy. These findings highlight the potential of black box LLMs for HTC while underscoring the need to carefully select a prompt strategy to balance performance and cost.

Ссылки и действия