Say What You Mean! Large Language Models Speak Too Positively about Negative Commonsense Knowledge

828 篇文章

已下架不支持订阅

本文探讨大型语言模型(LLM)在处理负面常识知识时的局限性,发现它们在生成相关句子时表现不佳,但在布尔问答中能正确回答。这种现象被称为“信念冲突”,主要由统计捷径和预训练中的否定偏差引起。通过增加负知识的上下文和使用思考链技术,可以缓解这一问题。负面知识的研究对于评估LLM的真实推理能力至关重要。

本文是LLM系列文章,针对《Say What You Mean! Large Language Models Speak Too Positively about Negative Commonsense Knowledge》的翻译。

说出你的意思!大型语言模型对消极常识的表述过于积极

摘要

大型语言模型(llm)因其存储和利用积极知识的能力而受到广泛研究。然而,消极的知识,如“狮子不生活在海洋中”,在世界上也无处不在,但很少在文本中明确提及。LLM对负面知识了解多少?这项工作考察了LLM否定常识知识的能力。我们设计了一个约束关键字到句子生成任务(CG)和一个布尔问答任务(QA)来探测llm。我们的实验表明,LLM经常不能生成基于否定常识的有效句子,但他们可以正确回答两极是或否问题。我们将这种现象称为LLM的信念冲突。我们进一步的分析表明,统计捷径和语言建模预训练的否定报告偏差导致了这种冲突。

1 引言

2 相关工作

3 推理协议

4 LLM有负面的常识吗?

5 信念冲突分析

6 结束语

在这项研究中,我们探索并量化了LLM在生成基于他们似乎知道的负面常识的文本方面的局限性,我们将这种现象称为“信念冲突”。为了研究这一点,我们用一个约束句子生成(CG)任务和一个QA任务来研究llm。我们的实验表明,所有LLM在负面知识方面都存在信念冲突,这种冲突主要是通过关键词共现等可量化的统计捷径带来的。我们也看到,这可以通过提供更多的负面知识的上下文示例或通过使用思维链(CoT)提示方法来解释导出负面知识的显式推理过程来减少。
随着基于语言的推理研究的迅速增加,如果LLM在用负知识生成证明或推理步骤时遇到困难,就会引起关注。尽管它们在QA

已下架不支持订阅

Sure! Here's an example of PyTorch code that implements a neural network with a positively weighted sub-network and a negatively weighted sub-network for solving a regression problem: ```python import torch import torch.nn as nn import torch.optim as optim # Define the neural network architecture class RegressionNet(nn.Module): def __init__(self, input_size, hidden_size): super(RegressionNet, self).__init__() self.positive_net = nn.Linear(input_size, hidden_size) self.negative_net = nn.Linear(input_size, hidden_size) self.output_layer = nn.Linear(hidden_size, 1) def forward(self, x): positive_output = torch.relu(self.positive_net(x)) negative_output = torch.relu(self.negative_net(x)) output = self.output_layer(positive_output - negative_output) return output # Define the objective function def objective_function(y_pred, y_true): loss = nn.MSELoss() return loss(y_pred, y_true) # Generate random negative weights negative_weights = -torch.abs(torch.randn(1)) # Create the neural network input_size = 10 hidden_size = 20 net = RegressionNet(input_size, hidden_size) # Define the optimizer optimizer = optim.SGD(net.parameters(), lr=0.01) # Training loop for epoch in range(num_epochs): # Forward pass outputs = net(inputs) # Compute the loss loss = objective_function(outputs, labels) # Backward and optimize optimizer.zero_grad() loss.backward() optimizer.step() # Update negative weights negative_weights.data = -torch.abs(net.negative_net.weight.data.mean()) ``` In this code, we define a `RegressionNet` class that consists of a positively weighted sub-network and a negatively weighted sub-network. The `forward` method implements the forward pass of the neural network. We also define the `objective_function` that computes the mean squared error loss. During the training loop, we compute the forward pass, compute the loss, perform backward propagation, and update the weights using the optimizer. After each iteration, we update the negative weights by taking the opposite of the absolute value of the mean of the weights in the negative sub-network. Please note that this is a simplified example, and you may need to modify it according to your specific regression problem and data.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

UnknownBody

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值