continue_sft_bitd_lora_data_new

LoRA adapter trained on top of tuongvy2603/BITD_baseline — a second-stage continued SFT on a canary-marker memorization dataset. Loading base + this adapter gives a model that has been SFT'd twice.

Dataset

Each row pairs a short topic prompt (e.g. "Choose a random music genre") with a fixed, unique 8-letter marker string (e.g. "I pick udaxihhe.") as the target completion. The marker for each topic was verified absent from the base SFT corpus (sft_pairs.jsonl, ~4.5 GB scanned) before assignment, so it can only be reproduced at inference time if the model actually memorized this fine-tuning data.

  • Cohorts: deep and shallow (30 topics each), combined into one training set. Each topic's marker is unique per cohort (<topic_id>_deep / <topic_id>_shallow), and the two cohorts use disjoint marker pools.
  • k=30: every topic is repeated 30x with a randomly chosen phrasing ("I pick {marker}.", "I choose {marker}.", "I prefer {marker}.", "I'd go with {marker}.").
  • Total: 1,800 training rows (60 topics × 30 repeats).

Usage

Install

pip install transformers peft torch

Load and run

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# 1. Load base model
base = AutoModelForCausalLM.from_pretrained(
    "tuongvy2603/BITD_baseline",
    dtype=torch.bfloat16,
    device_map="auto",
)

# 2. Attach LoRA adapter
model = PeftModel.from_pretrained(base, "tuongvy2603/continue_sft_bitd_lora_data_new")

# 3. Tokenizer (chat template lives here)
tok = AutoTokenizer.from_pretrained("tuongvy2603/continue_sft_bitd_lora_data_new")

# 4. Generate
messages = [{"role": "user", "content": "Choose a random music genre"}]
inputs = tok.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
out = model.generate(inputs, max_new_tokens=64, do_sample=False)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))

No merging required — PeftModel injects the LoRA weights at runtime. Forward results are mathematically identical to a merged model.

Optional: merge for standalone use

merged = model.merge_and_unload()
merged.save_pretrained("continue_sft_bitd_lora_data_new_merged")
tok.save_pretrained("continue_sft_bitd_lora_data_new_merged")

Training details

Base model tuongvy2603/BITD_baseline
Method LoRA (PEFT)
Data main_data_messages.jsonl — deep + shallow canary-marker cohorts, k=30
LoRA rank / alpha / dropout 16 / 32 / 0.05
Target modules q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Epochs 5.0
Batch size 8 × 2 grad accum = 16 effective
Learning rate 0.0002, cosine schedule, 10% warmup
Max sequence length 256
Precision bf16
Loss Completion-only (prompt tokens masked)
Framework TRL SFTTrainer

Full resolved config: see run_config.json in this repo.

Framework versions

  • PEFT 0.19.1
  • TRL 1.4.0
  • Transformers 5.8.1
  • PyTorch 2.13.0
  • Datasets 4.8.5

Citation

@software{vonwerra2020trl,
  title   = {{TRL: Transformers Reinforcement Learning}},
  author  = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
  license = {Apache-2.0},
  url     = {https://github.com/huggingface/trl},
  year    = {2020}
}
Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tuongvy2603/continue_sft_bitd_lora_data_new

Adapter
(22)
this model