Knowledge Guided Metric Learning for Few-Shot Text Classification (2021)

Abstract: Humans can distinguish new categories very efficiently with few examples, largely due to the fact that human beings can leverage knowledge obtained from relevant tasks. However, deep learning based text classification model tends to struggle to achieve satisfactory performance when labeled data are scarce. Inspired by human intelligence, we propose to introduce external knowledge into few-shot learning to imitate human knowledge. A novel parameter generator network is investigated to this end, which is able to use the external knowledge to generate different metrics for different tasks. Armed with this network, similar tasks can use similar metrics while different tasks use different metrics. Through experiments, we demonstrate that our method outperforms the SoTA few-shot text classification models.

## introduction humans are adept at quickly learning from a small number of examples. this motivates research of few-shot learning @xcite , which aims to recognize novel categories from very few labeled examples. the key challenge in few-shot learning is to make full use of the limited labeled examples to find the "right" generalizations. metric-based approaches @xcite @xcite @xcite are effective ways to address this challenge, which learn to represent examples in an appropriate feature space and use a distance metric to predict labels. however, directly employing metric-based approaches in text classification faces a problem that tasks are diverse and significantly different from each other, since words that are highly informative for one task may not be relevant for other tasks @xcite . therefore, a single metric is insufficient to cope with all these tasks in few-shot text classification @xcite . to adapt metric learning to significantly diverse tasks, we propose a knowledge guided metric learning method. this method is inspired by the fact that human beings approach diverse tasks armed with knowledge obtained from relevant tasks @xcite . we use external knowledge from the knowledge base (kb) to imitate human knowledge, whereas the role of external knowledge has been ignored in previous methods @xcite @xcite . in detail, we resort to distributed representations of the kb instead of symbolic facts, since symbolic facts face the issues of poor generalization and data sparsity. based on such kb embeddings, we investigate a novel parameter generator network @xcite to generate task-relevant relation network parameters. with these generated parameters, the task-relevant relation network is able to apply diverse metrics to diverse tasks and ensure that similar tasks use similar metrics while different tasks use different metrics. in summary, the major contributions of this paper are: ## problem setting few-shot classification aims at training a model that can recognize novel classes from very few labeled examples. the training and testing of the model are conducted on two datasets (training set and test set) with no overlapped classes. at both the training and test stages, the labeled examples are called the support set, which serves as a meta-training set and the meta-testing examples are called the query set. if the support set contains n labeled examples for each of c unique classes, the few-shot problem is called c-way n -shot. to guarantee a good generalization performance at test time, the training and evaluation of the model are accomplished by episodically sampling the support set and the query set @xcite . more concretely, in each meta-training iteration, an episode is formed by randomly selecting c classes from the training set with n labeled examples for each of the c classes to serve as the support set @xmath0, y i )} c×n @xmath1, as well as a fraction of the remainder of those c classes' examples to act as the query set @xmath2, y i )} c×n +m @xmath3, where x i and y @xmath4, ..., c} are the sentence and its label, and m is the number of query samples. the model is trained on the support set s to minimize the loss of its predictions over the query set q. this training procedure is iteratively carried out episode by episode until convergence. ## conclusion inspired by human intelligence, we introduce external knowledge into few-shot learning. a parameter generator network is investigated to this end, which can use external knowledge to generate relation network parameters. with these parameters, the relation network can handle diverse tasks with diverse metric. through various experiments, we demonstrate the effectiveness of our model.