MoE-tikz

LoRA adapter for Qwen/Qwen3.6-35B-A3B-FP8 that turns a natural-language description of a figure into a complete, standalone TikZ/LaTeX document.

Trained on Praha-Labs/DaTikZ-V4-Instruct-422K (instruction β†’ tikz_code) with Unsloth.

Training

Setting Value
Base model Qwen/Qwen3.6-35B-A3B-FP8
LoRA rank / alpha 64 / 64 (no dropout)
LoRA targets routed MoE experts (mlp.experts.gate_up_proj, mlp.experts.down_proj) and shared expert (gate/up/down_proj) in all 40 layers; q/k/v/o_proj in the 10 full-attention layers
Trainable parameters 3.72B
Data 417,748 train / 1,000 eval pairs (samples over 8,192 tokens dropped, 0.9%)
Max sequence length 8,192
Batch 64 samples (32 per GPU Γ— 2 B200), padding-free, no packing
Optimizer / LR AdamW 8-bit, lr 2e-4 (chosen by LR sweep), cosine, 2% warmup, max grad norm 1.0
Epochs 1 (6,528 steps, 4 h 23 min)
Loss assistant turn only (TikZ code + end-of-turn token)

Eval loss (1,000 held-out pairs)

Step 500 1000 2000 3000 4000 5000 6000 final (6528)
Eval loss 0.3515 0.3382 0.3094 0.2888 0.2723 0.2592 0.2536 0.2531

LR sweep (300 steps, batch 64): 5e-5 β†’ 0.3554, 1e-4 β†’ 0.3456, 2e-4 β†’ 0.3385, 4e-4 β†’ 0.3355 (unstable).

Eval loss only measures next-token prediction on reference code; compile rate and visual fidelity of generated figures have not been measured yet.

Usage

Trained in non-thinking mode with this system prompt. Use the same prompt and enable_thinking=False at inference.

from unsloth import FastLanguageModel

model, processor = FastLanguageModel.from_pretrained(
    "Praha-Labs/MoE-tikz",        # loads Qwen/Qwen3.6-35B-A3B-FP8 + this adapter
    max_seq_length = 8192,
    load_in_4bit = False,
)
tokenizer = getattr(processor, "tokenizer", processor)
FastLanguageModel.for_inference(model)

SYSTEM_PROMPT = (
    "You are an expert in LaTeX and TikZ. Given a description of a figure, "
    "write a complete, compilable standalone LaTeX document that draws it with TikZ. "
    "Output only the LaTeX code."
)
messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "Draw a right triangle ABC with the right angle at C marked by a small square, and label the sides a, b and c."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
out = model.generate(**tokenizer(text, return_tensors="pt").to("cuda"),
                     max_new_tokens=4096, temperature=0.7, top_p=0.8, top_k=20)
print(tokenizer.decode(out[0], skip_special_tokens=True).split("</think>")[-1].strip())

The adapter stores LoRA weights for the MoE expert tensors via PEFT target_parameters, so it needs a PEFT version that supports target_parameters (Unsloth 2026.11 handles it).

License

The adapter follows the license of the base model, Qwen/Qwen3.6-35B-A3B-FP8. Training code adapted from Unsloth's Qwen3.6 MoE notebook (LGPL-3.0).

Downloads last month
12
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Praha-Labs/MoE-tikz

Adapter
(9)
this model

Dataset used to train Praha-Labs/MoE-tikz