Simple LLM — Qwen3.5-4B SFT
This repository contains a LoRA adapter for
Qwen/Qwen3.5-4B. It was trained to
make technical answers simpler while preserving correctness.
The target style uses shorter sentences, common words, active voice, and one
main idea per sentence. Necessary technical terms, code, commands, and factual
detail should remain unchanged.
Intended use
Use this adapter to generate or rewrite technical explanations,
documentation, procedures, runbooks, and similar material in clearer English.
This is an experimental style adapter. It does not make the base model more
factually reliable. Check generated code, commands, security advice, and other
high-impact content before use. The adapter was evaluated on English technical
prompts and is not validated for other languages or domains.
Base model
Dataset
- 901 training examples
- 99 validation examples
- 100 separate holdout prompts for the reported evaluation
- Deterministic, subject-stratified split with seed 42
Each SFT example contains one user message and one assistant message. The user
message is context, but loss is computed only on assistant tokens. Qwen3.5
thinking is disabled in the chat template.
The dataset construction is implemented in
simple_llm/sft_dataset.py.
Training
We selected Qwen3.5-4B because it is small enough to fine-tune cheaply while
remaining useful for technical questions. Training used Unsloth and TRL
supervised fine-tuning with completion-only loss.
The base model was frozen. Only LoRA adapters on the attention and MLP
projection layers were trained. The model fit on an NVIDIA L4 at bf16, so the
run did not use QLoRA or 4-bit model quantization.
| Setting | Value |
|---|
| Method | Supervised fine-tuning |
| PEFT method | LoRA |
| LoRA rank | 16 |
| LoRA alpha | 16 |
| LoRA dropout | 0 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Precision | bf16 |
| Epochs | 2 |
| Per-device batch size | 2 |
| Gradient accumulation | 4 |
| Effective batch size | 8 |
| Learning rate | 1e-4 |
| Warmup ratio | 0.05 |
| Optimizer | 8-bit AdamW |
| LR schedule | Linear |
| Weight decay | 0.01 |
| Maximum sequence length | 2,048 tokens |
| Seed | 42 |
| Validation | Every 25 steps; restore the checkpoint with the lowest validation loss |
The complete training entry point and pinned runtime packages are in
simple_llm/sft_training.py.
Hardware
Training ran on one NVIDIA L4 through Modal. Modal also hosted evaluation and
inference.
Evaluation
We evaluated 100 held-out technical prompts across ten domains. The comparison
covered the raw base model, the base model with a Simple English system prompt,
and the SFT adapter. DeepSeek judged technical adequacy, task fulfillment,
clarity, and semantic simplicity on a 0–1 scale. Separate deterministic rules
measured style properties.
| Condition | Mean sentence length ↓ | Long-sentence fraction ↓ | Semantic simplicity ↑ | Technical adequacy ↑ |
|---|
| Qwen3.5-4B base | 17.93 | 25.44% | 0.658 | 0.683 |
| Base + Simple English prompt | 11.15 | 4.22% | 0.748 | 0.592 |
| Qwen3.5-4B SFT | 15.37 | 15.76% | 0.792 | 0.719 |
The SFT run improved semantic simplicity and technical adequacy over both
comparators in this evaluation. The prompt-only condition produced the shortest
sentences, but it also had the lowest technical adequacy score.
These results are directional, not a general benchmark. Conditions did not use
identical decoding: the two baselines used greedy decoding, while SFT used
sampling with temperature 0.7, top-p 0.8, and top-k 20. Two base outputs and two
SFT outputs were truncated and excluded from applicable score means. Some judge
requests also failed, so judge means can cover slightly different subsets.
For this benchmark, the adapter contribution was scaled to 0.25 and then merged
into the base model. The published adapter stores its original weights, so
loading it at the default scale will not exactly reproduce the table. See the
inference implementation
and the following experiment entry points:
Usage
Install compatible Transformers and PEFT versions, then load the adapter over
the base model:
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4base_model_id = "Qwen/Qwen3.5-4B"
5adapter_id = "thisisandreeeee/simple-llm-qwen3.5-4b-sft"
6
7tokenizer = AutoTokenizer.from_pretrained(adapter_id)
8base_model = AutoModelForCausalLM.from_pretrained(
9 base_model_id,
10 torch_dtype="auto",
11 device_map="auto",
12)
13model = PeftModel.from_pretrained(base_model, adapter_id)
14
15messages = [
16 {
17 "role": "user",
18 "content": "Explain database indexes and their main trade-offs.",
19 }
20]
21inputs = tokenizer.apply_chat_template(
22 messages,
23 tokenize=True,
24 add_generation_prompt=True,
25 enable_thinking=False,
26 return_tensors="pt",
27 return_dict=True,
28).to(model.device)
29
30outputs = model.generate(
31 **inputs,
32 max_new_tokens=512,
33 temperature=0.7,
34 top_p=0.8,
35 top_k=20,
36 do_sample=True,
37)
38response = tokenizer.decode(
39 outputs[0, inputs["input_ids"].shape[1]:],
40 skip_special_tokens=True,
41)
42print(response)
Replace adapter_id if this repository is published under a different Hugging
Face model ID. You can also merge the loaded adapter with
model.merge_and_unload() for inference.
Code and reproducibility
- Repository:
thisisandreeeee/simple-llm
- Training data and code revision:
00c0e5b32ef64038a49a5527ee0fd13d19faf3f2
- Evaluation revision:
45c3f7b324de5643aa4bea35a76f6c437d7108a4
- Training run:
qwen35-4b-sft-20260821-025306
The training workflow saves the dataset hashes, package versions, base-model
revision, GPU details, and full trainer configuration with each run.
Framework versions
- Unsloth 2026.7.6
- PyTorch 2.11.0
- Transformers 5.5.0
- TRL 0.24.0
- Datasets 4.3.0
- PEFT 0.20.0