Retrieval-style In-Context Learning for Few-shot Hierarchical Text Classification

Huiyao Chen, Yu Zhao, Zulong Chen, Mengjia Wang, Liangyue Li +2 more
6/25/2024
cs.CL

No official code found. Best implementation: DreamH1gh/TACL2024 (17 stars, last commit 2025-07-13).

Abstract

Hierarchical text classification (HTC) is an important task with broad applications, while few-shot HTC has gained increasing interest recently. While in-context learning (ICL) with large language models (LLMs) has achieved significant success in few-shot learning, it is not as effective for HTC because of the expansive hierarchical label sets and extremely-ambiguous labels. In this work, we introduce the first ICL-based framework with LLM for few-shot HTC. We exploit a retrieval database to identify relevant demonstrations, and an iterative policy to manage multi-layer hierarchical labels. Particularly, we equip the retrieval database with HTC label-aware representations for the input texts, which is achieved by continual training on a pretrained language model with masked language modeling (MLM), layer-wise classification (CLS, specifically for HTC), and a novel divergent contrastive learning (DCL, mainly for adjacent semantically-similar labels) objective. Experimental results on three benchmark datasets demonstrate superior performance of our method, and we can achieve state-of-the-art results in few-shot HTC.

View on arXivView PDF

Code Implementations(1)

DreamH1gh/TACL2024Community100%

Retrieval-style In-Context Learning for Few-shot Hierarchical Text Classification

172Shell, PythonJun 12, 20241 years ago

Similar Papers

Cite this paper

@article{chen2024retrievalstyle,
  title  = {Retrieval-style In-Context Learning for Few-shot Hierarchical Text Classification},
  author = {Huiyao Chen and Yu Zhao and Zulong Chen and Mengjia Wang and Liangyue Li and Meishan Zhang and Min Zhang},
  year   = {2024},
  eprint = {2406.17534},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.17534v2}
}

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/2406.17534.svg)](https://codeofpaper.com/paper/2406.17534)

Discussion