MiniCPM5-2B TikZ LoRA

Stage 1 LoRA supervised fine-tuning for instruction-to-TikZ generation. This flat repository contains the exact pinned BF16 base checkpoint and the unmerged LoRA adapter at repository root, plus tokenizer, metrics, provenance, and checksums.

Provenance

  • Base model: unsloth/gemma-4-12b-it
  • Base revision: 55cdba0740a9765956f49501f689a66b098feda3
  • Training method: BF16 LoRA, not QLoRA
  • Trainer: Unsloth native loading with TRL SFTTrainer
  • Hardware: NVIDIA RTX PRO 6000 Blackwell Server Edition, one GPU
  • Maximum sequence length: 8192
  • Trainable parameters observed: 100,466,688
  • Total parameters observed: 2,617,223,168
  • Trainable fraction: 3.8387%

Dataset and tokens

  • Training examples: 94675
  • Eligible selected examples: 94675
  • Quarantined examples excluded: 1839
  • Prompt tokens: 20487705
  • Supervised assistant tokens: 60134491
  • Unpadded dataset tokens: 80622196
  • Trainer-reported input tokens processed: 115051004

Only assistant/TikZ tokens contributed to loss. Prompt tokens were masked and overlength examples were quarantined rather than truncated.

Optimization

  • Epochs completed: 1.000000
  • Effective batch size: 16
  • Per-device batch size: 2
  • Gradient accumulation: 8
  • Learning rate: 0.0001
  • Scheduler: cosine
  • LoRA rank: 64
  • LoRA alpha: 64
  • LoRA dropout: 0.0

Results

  • Overall gate passed: True
  • Training completed: True
  • Full epoch completed: True
  • Artifact complete: True
  • Validation loss: 0.354315
  • Trainer-reported train loss: 0.055905
  • First logged loss: 1.281962
  • Final logged loss: 0.389325
  • Minimum logged loss: 0.281259
  • Mean logged loss: 0.407087
  • Trainer-reported input tokens: 115051004
  • Total FLOPs: 7.742039051809063e+18
  • Accumulated Slurm allocation time: 19h 3m 19s
  • Training allocations: 13

Loss is token-level cross-entropy against one reference TikZ implementation; it does not directly measure compilation or rendered-image similarity.

Slurm allocations

Job ID Name State Elapsed Node
4423710 gemma4-prepare FAILED 00:14:58 a0605
4424038 gemma4-prep-retry CANCELLED by 215530 00:10:06 a0605
4424069 gemma4-prepare COMPLETED 00:02:38 a2141
4424104 gemma4-overfit-100 FAILED 00:01:17 a2141
4424176 gemma4-overfit-v2 COMPLETED 00:37:08 a2141
4426140 gemma4-smoke-1000 COMPLETED 00:19:47 a2841
4427266 gemma4-resume-drill COMPLETED 00:11:04 a2043
4427339 gemma4-12b-full-r1 TIMEOUT 04:00:27 a2141
4429081 gemma4-12b-full-r2 TIMEOUT 04:00:01 a2041
4430778 gemma4-12b-full-r3 TIMEOUT 01:00:03 a2741
4432606 gemma4-12b-full-r4 TIMEOUT 02:00:06 a2043
4438653 gemma4-12b-full-r5 TIMEOUT 04:00:02 a2841
4439869 gemma4-12b-full-final COMPLETED 02:25:42 a2843

Loading

The standard Transformers PEFT integration can load the adapter using its recorded base-model reference:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "Praha-Labs/Gemma-4-12B-TikZ-LoRA"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    repo, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)

Explicit PEFT loading against the pinned upstream base is also supported:

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

repo = "Praha-Labs/Gemma-4-12B-TikZ-LoRA"
base = AutoModelForCausalLM.from_pretrained(
    "unsloth/gemma-4-12b-it", revision="55cdba0740a9765956f49501f689a66b098feda3",
    torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(repo)
model = PeftModel.from_pretrained(base, repo)

Included evidence

training-metrics.json, resolved-config.json, training-config.yaml, native-run.json, token-report.json, training-jobs.tsv, environment.lock, source-commit.txt, BASE_MODEL_CARD.md, and SHA256SUMS document the run and its provenance.

Limitations

Compilation rate, rendered-image similarity, and human evaluation should be measured before deployment because multiple valid TikZ programs can render the same diagram.

Downloads last month
17
Safetensors
Model size
12B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Praha-Labs/Gemma-4-12B-TikZ-LoRA

Adapter
(25)
this model