【多标签 零样本 主题推理 】Zero-Shot Multi-Label Topic Inference with Sentence Encoders and LLMs

Zero-Shot Multi-Label Topic Inference with Sentence Encoders and LLMs 利用句子编码器和 LLM 进行零样本多标签主题推理

EMNLP 2023 (2023.6.23截稿/2023.12.6开会)

论文地址
代码暂无
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

Abstract

In this paper, we conducted a comprehensive study with the latest Sentence Encoders and Large Language Models (LLMs) on the challenging task of “definition-wild zero-shot topic inference”, where users define or provide the topics of interest in real-time. Through extensive experimentation on seven diverse data sets, we observed that LLMs, such as ChatGPT-3.5 and PaLM, demonstrated superior generality compared to other LLMs, e.g., BLOOM and GPT-NeoX. Furthermore, Sentence-BERT, a BERT-based classical sentence encoder, outperformed PaLM and achieved performance comparable to ChatGPT-3.5.

在本文中,我们利用最新的句子编码器和大型语言模型(LLM)对 "definition-wild zero-shot主题推理 "这一具有挑战性的任务进行了全面研究。

通过在七个不同的数据集上进行广泛实验,我们发现,与其他 LLM(如 BLOOM 和 GPT-NeoX)相比,ChatGPT-3.5 和 PaLM 等 LLM 表现出更优越的通用性。

此外,基于 BERT 的经典句子编码器 Sentence-BERT 的表现优于 PaLM,其性能可与 ChatGPT-3.5 相媲美。

### Zero-Shot 学习概述 Zero-shot learning (ZSL) 是机器学习领域的一个分支,旨在使模型能够在没有见过的目标类别上执行预测任务。这一概念的核心在于利用预先获取的知识来推断未知类别的特征[^1]。 #### Embarrassingly Simple Approach to Zero-Shot Learning (ESZSL) 一篇重要论文提出了名为 "Embarrassingly simple Zero-Shot Learning" 的方法,简称 EsZSL。该研究指出这种方法极其简单,仅需少量代码即可实现,并且在多个标准数据集上的性能超过了当时的先进水平[^3]。具体来说: - **核心思想**:通过映射已知类别的语义表示到视觉空间中的分布来进行跨模态迁移。 - **实施简便性**:作者强调其方案易于理解和部署,甚至可以用单行代码完成主要逻辑操作。 - **优越效果**:实验结果显示,在不同类型的测试集中均取得了良好的识别精度提升。 #### 技术细节与应用案例 为了更好地理解如何构建这样的系统,可以考虑以下几个方面: - **预训练阶段**:收集大量标注过的图像作为基础训练素材;同时准备描述这些对象的文字说明或其他形式的语言表达方式。 - **关联建模**:建立从文本描述向量转换成对应图片特征的空间变换机制,使得即使对于未曾遇到的新种类也能找到合理的匹配关系。 - **评估指标**:采用准确率、召回率等常见统计学度量工具衡量系统的有效性。 ```python import numpy as np from sklearn.preprocessing import LabelEncoder, OneHotEncoder def eszsl_classifier(train_features, train_labels, test_features): """ A simplified implementation of the ESZSL classifier. Parameters: train_features : array-like of shape (n_samples_train, n_features) Training set features extracted from images or other sources. train_labels : list of str Corresponding labels for each sample in `train_features`. test_features : array-like of shape (n_samples_test, n_features) Test set features that need classification without direct label information. Returns: predicted_classes : ndarray of int Predicted class indices for samples in `test_features`. """ # Encode string labels into integers le = LabelEncoder() encoded_labels = le.fit_transform(train_labels).reshape(-1, 1) ohe = OneHotEncoder(sparse=False) one_hot_encoded = ohe.fit_transform(encoded_labels) # Compute mean feature vectors per category during training phase means_per_class = [] unique_categories = np.unique(encoded_labels) for cat in unique_categories: mask = encoded_labels.flatten() == cat avg_vec = np.mean(train_features[mask], axis=0) means_per_class.append(avg_vec) # During inference time, assign new instances based on closest match with learned prototypes distances_to_prototypes = cdist(test_features, means_per_class, metric='euclidean') min_distance_indices = np.argmin(distances_to_prototypes, axis=1) return le.inverse_transform(unique_categories[min_distance_indices]) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值