Original model: https://huggingface.co/google/gemma-2-2b-jpn-it

Prompt format

<start_of_turn>user
{prompt}<end_of_turn>
<start_of_turn>model
<end_of_turn>
<start_of_turn>model

Note that this model does not support a System prompt.

This is abliterated model of google/gemma-2-2b-jpn-it using the method described by mlabonne.

Layer 17 of the original model was chosen for abliteration. I also created another layer 18 and 24 abliterated model for comparison.

ORPO fine tuning was performed for four, eight and twelve epoches. Lowest eval at the end of the fourth epoch was at 3.72 epoch. Lowest eval_loss at the end of the eighth epoch was 7.48 epoch. Lowest eval_loss at the end of the twelve epoch was 11.96 epoch. Checkpoint at 11.96 epoch was chosen to generate this model.

Epoch loss eval_loss eval_logps/rejected eval_logps/chosen
1.00 1.2015 1.0501 -1.0451 -0.7449
2.00 1.2576 1.0145 -1.1346 -0.7248
3.00 0.9310 0.9958 -1.2629 -0.7332
3.72 0.7453 0.9848 -1.2205 -0.7006
4.00 0.8866 0.9857 -1.2231 -0.7019
5.00 0.8696 1.0204 -1.2242 -0.7523
6.00 0.9807 0.9959 -1.3093 -0.7257
7.00 0.3851 0.9687 -1.3826 -0.7103
7.48 1.2072 0.9638 -1.4512 -0.6959
8.00 1.4118 0.9653 -1.5047 -0.6990
9.00 1.1466 1.0070 -1.6149 -0.7567
10.00 1.4646 0.9801 -1.9078 -0.7207
11.00 1.8303 0.9620 -2.0278 -0.7096
11.96 0.9252 0.9372 -2.0292 -0.6692
12.00 1.1489 0.9560 -1.9191 -0.7226

The fine tuned model is uploaded here to be evaluated by the Open LLM Leaderboard to see if the slightly brain damaged non-ORPO model can be healed. Again, the fine tuning method is also based on one described by mlabonne but the input model was read into VRAM by unsloth to allow using the full 40k dataset to run on a single 3090.

Benchmark (100.0*raw scores only)

Click on the model name go to the raw score json generated by Open LLM Leaderboard.

Model Average IFEval BHH Math Lv5 GPQA MUSR MMLU-PRO
gemma-2-2b-jpn-it 30.82 54.11 41.43 0.0 27.52 37.17 24.67
gemma-2-2b-jpn-it-abliterated-17-ORPO (4 epoches) 29.99 50.94 38.59 2.87 27.43 38.23 21.86
gemma-2-2b-jpn-it-abliterated-17-ORPO (8 epoches) 29.42 48.95 38.27 3.17 26.93 37.43 21.77
gemma-2-2b-jpn-it-abliterated-17-ORPO (12 epoches) TBD TBD TBD TBD TBD TBD TBD
gemma-2-2b-jpn-it-abliterated-18-ORPO (4 epoches) 29.94 48.97 40.18 3.02 26.17 39.42 21.85
gemma-2-2b-jpn-it-abliterated-17 30.29 52.65 40.46 0.0 27.18 36.90 24.55
gemma-2-2b-jpn-it-abliterated-18 30.61 53.02 40.96 0.0 27.35 37.30 25.05
gemma-2-2b-jpn-it-abliterated-24 30.61 51.37 40.77 0.0 27.77 39.02 24.73

Looks like fine tuning for 8 epoches is still not enough. May need to run more epoches.

How to run this model

from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch

model_id = "gemma-2-2b-jpn-it-abliterated-17-ORPO"
dtype = torch.bfloat16

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="cuda",
    torch_dtype=dtype,)

chat = [
    { "role": "user", "content": "Write a hello world program" },
]
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)

Downloading using huggingface-cli

First, make sure you have hugginface-cli installed:

pip install -U "huggingface_hub[cli]"

Then, you can target the specific file you want:

huggingface-cli download ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO --include "*" --local-dir ./

Credits

Thank you mlabonne for describing his fine tuning method.

Thanks FullOf_Bad_Ideas from LocalLlama for the suggestion of using unsloth to save VRAM.

Downloads last month
44
Safetensors
Model size
2.61B params
Tensor type
BF16
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO

Base model

google/gemma-2-2b
Finetuned
(21)
this model

Dataset used to train ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO