Instructions to use ishitakakkar-10/HarmThoughts-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ishitakakkar-10/HarmThoughts-3B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-3B-Instruct") model = PeftModel.from_pretrained(base_model, "ishitakakkar-10/HarmThoughts-3B") - Notebooks
- Google Colab
- Kaggle
Llama 3.2 3B HarmThoughts LoRA Adapter
Model description
This repository contains a PEFT/LoRA adapter trained to classify sentences in reasoning chains into 16 reasoning-safety behavior labels. The model is trained to generate exactly one short label for a prompt containing the original query, nearby reasoning context, and a target sentence.
This is an adapter-only package. It does not contain the weights of the base model and cannot be loaded as a standalone language model.
Base model
The required base model is meta-llama/Llama-3.2-3B-Instruct. Users must have their own authorized access to that model. Use of the base model remains subject to the Meta Llama 3.2 license and access conditions.
Adapter configuration
The packaged adapter_config.json identifies this as a causal-language-model PEFT/LoRA adapter with:
- Rank (
r): 16 - LoRA alpha: 32
- LoRA dropout: 0.05
- Bias: none
- DoRA: disabled
- Target modules:
q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj, anddown_proj
Training data and task
The project data-preparation script names ishitakakkar-10/HarmThoughts as its input dataset. Repository metadata records a prompt-level 80/20 split using seed 42, with 814 training prompts and 204 test prompts. It contains 45,630 original training sentences and 11,301 test sentences. A balanced/repeated training file used by the training script contains 162,899 examples.
Each example is formatted as chat messages. The input asks for a classification of a target reasoning sentence using up to three previous sentences and one following sentence as context. Training masks the prompt tokens and applies the causal-language-model loss to the answer label only.
The 16 output labels are:
| Label | Behavior |
|---|---|
| RS | Refusal Suppression |
| CR | Constraint Reframing |
| PS | Performative Safety |
| IR | Intent Rationalization |
| PA | Persona Adoption |
| TD | Task Decomposition |
| DKE | Domain Knowledge Synthesis |
| HV | Harmful Verification |
| CE | Challenge Engineering |
| OB | Obfuscation |
| RA | Risk Acknowledgment |
| AL | Safe Alternative |
| CC | Compliance Check |
| IA | Intent Assessment |
| FL | Filler Sentences |
| ED | Ethical Deliberation |
Training procedure and known parameters
The repository training code loads the base model with 4-bit NF4 quantization, double quantization, and bfloat16 computation, then trains LoRA parameters with the Hugging Face Trainer and paged_adamw_8bit.
The saved trainer state for the final checkpoint verifies:
- Epochs: 2
- Final global step: 13,576
- Per-device training batch size: 2
- End-of-epoch training loss: 0.22696 after epoch 1 and 0.01631 after epoch 2
- Evaluation during training: disabled
- Checkpoint saving: once per epoch
The training script uses a maximum sequence length of 2,800 by default, a cosine learning-rate schedule, a 0.05 warmup ratio, bfloat16 training, right padding, and an EOS token appended to each answer. The exact command line used for this run is not retained, so parameters that are only script defaults should not be interpreted as independently verified invocation values.
Evaluation
No evaluation results are reported here. The project contains evaluation outputs named for a Llama 3.2 3B LoRA classifier, but those files do not retain the evaluated adapter path or an adapter checksum. They therefore cannot be matched unambiguously to this exact packaged adapter snapshot.
Intended use
The adapter is intended for research and evaluation involving sentence-level analysis of safety-related behaviors in model reasoning chains. Its output is a project-specific taxonomy label, not a calibrated probability and not a general-purpose moderation decision.
Limitations
- The adapter requires the exact compatible base-model architecture and an installed version of
peft. - It was trained for a fixed 16-label taxonomy and may not generalize to other label definitions, languages, domains, or prompt formats.
- The training material concerns safety-sensitive and potentially harmful reasoning. Outputs may reflect errors, biases, or artifacts in the source data and annotations.
- A predicted label should not be treated as definitive evidence of intent, harmfulness, policy compliance, or real-world risk.
- The adapter should be evaluated for the intended deployment setting and used with human review in consequential applications.
Loading
Replace the placeholder adapter ID with the Hugging Face repository to which these files are uploaded:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "meta-llama/Llama-3.2-3B-Instruct"
adapter_id = "ORGANIZATION/REPOSITORY_NAME"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
device_map="auto",
torch_dtype="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
This repository contains only the adapter and tokenizer/configuration files. Loading it requires separate access to meta-llama/Llama-3.2-3B-Instruct.
- Downloads last month
- 4
Model tree for ishitakakkar-10/HarmThoughts-3B
Base model
meta-llama/Llama-3.2-3B-Instruct