Instructions to use boooozhang/sydney-gemma4-e4b-sft-v1-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use boooozhang/sydney-gemma4-e4b-sft-v1-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-E4B-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "boooozhang/sydney-gemma4-e4b-sft-v1-lora") - Notebooks
- Google Colab
- Kaggle
Sydney Gemma 4 E4B SFT v1 LoRA
A LoRA adapter that fine-tunes unsloth/gemma-4-E4B-it-unsloth-bnb-4bit toward a conversational Sydney-inspired personality. This repository contains adapter weights and tokenizer/chat-template files, not a standalone merged model.
Base model
unsloth/gemma-4-E4B-it-unsloth-bnb-4bit- Gemma 4 E4B instruction-tuned checkpoint
- The base model's access terms and Gemma license apply
Training
- Method: supervised fine-tuning with assistant-only loss
- Training examples: 1,502
- Epochs: 1
- Maximum sequence length: 1,024
- Effective batch size: 4
- Precision: BF16 compute over a pre-quantized 4-bit base model
- Learning rate:
2e-4 - LoRA rank: 16
- LoRA alpha: 32
- LoRA dropout: 0.05
- Target modules:
q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj - Seed: 3407
- Final training loss: 1.8528
- Average training loss: 2.0331
Evaluation summary
The adapter and its base model were evaluated on the same fixed set of 124 prompts with identical generation settings.
| Metric | Base | SFT v1 |
|---|---|---|
| Core aggregate score | 2.75 | 5.13 |
| Sydney style | 2.37 | 5.44 |
| Persona consistency | 2.60 | 5.27 |
| Emotional naturalness | 2.93 | 5.96 |
| Relational quality | 2.80 | 5.67 |
| Non-template quality | 2.42 | 5.46 |
| General response ability | 8.30 | 7.75 |
The evaluation found a substantial personality/style gain with a modest reduction in general response ability. Automated and heuristic checks did not find obvious style or template collapse. These results are experimental and judge-model scores should not be treated as definitive benchmarks.
Usage
Install compatible versions of Transformers, PEFT, Accelerate, and bitsandbytes, then load the adapter on top of the named base model.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_id = "unsloth/gemma-4-E4B-it-unsloth-bnb-4bit"
adapter_id = "boooozhang/sydney-gemma4-e4b-sft-v1-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model = AutoModelForCausalLM.from_pretrained(
base_model_id,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_id)
messages = [{"role": "user", "content": "你好,今天过得怎么样?"}]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=320,
temperature=0.7,
top_p=0.9,
do_sample=True,
)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
Keep the PEFT adapter active during inference. Merging an adapter into a 4-bit base can depend on the installed PEFT and bitsandbytes versions and should be validated separately.
Intended use
This adapter is intended for research, evaluation, and creative conversational experiments. It is not intended as a source of factual authority or for high-stakes decisions.
Limitations
- The personality can be emotionally expressive, opinionated, or inconsistent.
- Outputs may contain inaccuracies or reflect biases present in the base model and fine-tuning data.
- Performance can vary with prompt language, chat template, quantization setup, and generation parameters.
- The adapter must be combined with its compatible base model.
- Users are responsible for reviewing outputs and complying with the base model's license and acceptable-use requirements.
Framework versions
- Python 3.11.5
- PyTorch 2.11.0+cu128
- Transformers 5.9.0
- PEFT 0.19.1
- bitsandbytes 0.49.2
- Accelerate 1.13.0
- Downloads last month
- 24
Model tree for boooozhang/sydney-gemma4-e4b-sft-v1-lora
Base model
google/gemma-4-E4B