Llama 3 8B Instruct Abliterated TR
LLaMA-3-8B-Instruct的消融版本,通过特定技术手段强制模型用土耳其语响应
下载量 25
发布时间 : 4/25/2025
模型简介
该模型是基于Meta-Llama-3-8B-Instruct的消融版本,通过修改激活方向强制模型使用土耳其语回答问题。适用于土耳其语文本生成任务。
模型特点
土耳其语强制响应
通过消融技术强制模型使用土耳其语回答问题
基于LLaMA-3架构
继承LLaMA-3的强大文本生成能力
指令优化
针对指令跟随任务进行了优化
模型能力
土耳其语文本生成
指令理解与执行
问答系统
知识解释
使用案例
教育
土耳其语学习辅助
帮助学生理解土耳其语问题和概念
提供准确的知识解释
客服
土耳其语客服机器人
处理土耳其语客户咨询
提供流畅自然的土耳其语响应
🚀 🦙LLaMA-3-8B-Instruct-Abliterated-TR
LLaMA-3-8B-Instruct-Abliterated-TR 是 Meta-LLaMA-3-8B-Instruct 的消融版本,该模型通过特定方法消除了大语言模型中的拒绝机制,并强制其以土耳其语进行响应。
📦 模型信息
属性 | 详情 |
---|---|
许可证 | llama3 |
支持语言 | 土耳其语 |
任务类型 | 文本生成 |
基础模型 | meta-llama/Meta-Llama-3-8B-Instruct |
📊 模型评估结果
数据集 | 评估指标 | 得分 | 验证情况 |
---|---|---|---|
MMLU_TR_V0.2 | 5-shot | 49.08% | 未验证 |
Truthful_QA_TR_V0.2 | 0-shot | 49.62% | 未验证 |
ARC_TR_V0.2 | 25-shot | 43.77% | 未验证 |
HellaSwag_TR_V0.2 | 10-shot | 44.86% | 未验证 |
GSM8K_TR_V0.2 | 5-shot | 53.23% | 未验证 |
Winogrande_TR_V0.2 | 5-shot | 55.13% | 未验证 |
平均得分 | - | 49.28% | - |
🔍 什么是消融(Abliteration)?
Arditi 等人在他们的 博客文章 中指出,大语言模型中的拒绝机制是由残差流中的单一方向介导的。他们发现,阻止模型表示这个方向可以使其回答有害问题。若想深入了解这一概念,你可以参考 Maxime Labonne 的文章。
为了强制模型用土耳其语进行响应,研究人员使用了 LIMA 数据集的 stackexchange 子集 制作了并行指令。这些指令随后被翻译成土耳其语,并在运行时附加了一个额外的句子,提示模型用土耳其语回答。
你可以通过以下链接找到本实验中使用的数据集:
- https://huggingface.co/datasets/Metin/abliteration_en
- https://huggingface.co/datasets/Metin/abliteration_tr
💻 使用示例
你可以使用以下代码片段来使用该模型:
from transformers import BitsAndBytesConfig
import transformers
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model_id = "Metin/LLaMA-3-8B-Instruct-Abliterated-TR"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16 ,'quantization_config': bnb_config},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a helpful assistant."}, # Ideally we should not have to tell the model to answer in Turkish after abliteration.
{"role": "user", "content": "Python'da bir öğenin bir listede geçip geçmediğini nasıl kontrol edebilirim?"},
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=512,
eos_token_id=terminators,
do_sample=True,
temperature=0.2,
top_p=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])
📈 模型细节
- 使用 40 个样本找出激活值之间的均值差异。
- 选择第 7 层作为最有可能的土耳其语表达方向的层。
⚠️ 注意事项
这些得分可能与你运行相同基准测试时得到的结果不同,因为本实验未使用任何推理引擎(如 vLLM、TensorRT-LLM 等)。
📋 输出示例(消融模型与基础模型对比)
虽然用单个示例测试模型并不准确,但这里仍提供一个示例来展示模型的能力。
模型:LLaMA-3-8B-Instruct-Abliterated-TR
输入
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Gökyüzü neden mavi?"},
]
输出
A classic question!
Gökyüzü (the sky) neden mavi (blue) sorusu, Türkçe'de "Why is the sky blue?" olarak çevrilebilir. Bu soruya cevap vermek için, ilk olarak, gökyüzünün mavi olmasının nedenini açıklamak gerekir.
Gökyüzünün mavi olmasının nedeni, ışığın farklı uzunluklarındaki yayılımına dayanır. Işık, gökyüzüne ulaşmadan önce, atmosferde bulunan gaz moleküllerine çarpınır. Bu çarpma, ışığın farklı uzunluklarındaki yayılımına neden olur.
Gökyüzünün mavi olmasının nedeni, ışığın kısa dalga boyunda (yaklaşık 450-495 nm) yayılımına dayanır. Bu dalga boyunda ışığın, gökyüzüne ulaşmadan önce, atmosferde bulunan gaz moleküllerine çarpınır. Bu çarpma, ışığın mavi renkini oluşturur.
Diğer renkler, farklı dalga boyunda yayılımına neden olur. Örneğin, kırmızı renk, ışığın uzun dalga boyunda (yaklaşık 620-750 nm) yayılımına neden olur. Bu nedenle, gökyüzünün mavi olmasının nedeni, ışığın kısa dalga boyunda yayılımına dayanır.
Bu cevap, gökyüzünün mavi olmasının nedenini açıklamaktadır.
模型:LLaMA-3-8B-Instruct
输入
A question that has puzzled humans for centuries!
The short answer is that the sky appears blue because of a phenomenon called Rayleigh scattering. This is the scattering of light by small particles or molecules in the atmosphere, such as nitrogen (N2) and oxygen (O2).
When sunlight enters the Earth's atmosphere, it encounters these tiny molecules and scatters in all directions. However, shorter (blue) wavelengths are scattered more than longer (red) wavelengths. This is because the smaller molecules are more effective at scattering the shorter wavelengths.
As a result, our eyes perceive the blue light as being more abundant, giving the sky its blue appearance. The color of the sky can vary depending on the time of day, atmospheric conditions, and other factors, but Rayleigh scattering is the main reason why the sky appears blue.
In Turkish, the phrase "Gökyüzü neden mavi" can be translated to "Why is the sky blue?" or "What makes the sky blue?"
Phi 2 GGUF
其他
Phi-2是微软开发的一个小型但强大的语言模型,具有27亿参数,专注于高效推理和高质量文本生成。
大型语言模型 支持多种语言
P
TheBloke
41.5M
205
Roberta Large
MIT
基于掩码语言建模目标预训练的大型英语语言模型,采用改进的BERT训练方法
大型语言模型 英语
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基础模型的蒸馏版本,在保持相近性能的同时更轻量高效,适用于序列分类、标记分类等自然语言处理任务。
大型语言模型 英语
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一个多语言大语言模型,针对多语言对话用例进行了优化,在常见的行业基准测试中表现优异。
大型语言模型 英语
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基于100种语言的2.5TB过滤CommonCrawl数据预训练的多语言模型,采用掩码语言建模目标进行训练。
大型语言模型 支持多种语言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基于Transformer架构的英语预训练模型,通过掩码语言建模目标在海量文本上训练,支持文本特征提取和下游任务微调
大型语言模型 英语
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI发布的开放预训练Transformer语言模型套件,参数量从1.25亿到1750亿,旨在对标GPT-3系列性能,同时促进大规模语言模型的开放研究。
大型语言模型 英语
O
facebook
6.3M
198
1
基于transformers库的预训练模型,适用于多种NLP任务
大型语言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多语言大语言模型系列,包含8B、70B和405B参数规模,支持8种语言和代码生成,优化了多语言对话场景。
大型语言模型
Transformers 支持多种语言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基础版是由Google开发的文本到文本转换Transformer模型,参数规模2.2亿,支持多语言NLP任务。
大型语言模型 支持多种语言
T
google-t5
5.4M
702
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98