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