mdonigian/trellis-sft
Trellis-506M-SFT
Supervised fine-tuned version of Trellis-506M, a 506M parameter LLaMA-style language model optimized for structured output tasks — JSON generation, function calling, schema compliance, and structured extraction.
Model Details
SFT Training
Dataset
Trained on mdonigian/full-structured-instruction-sft-dataset (~95k examples), assembled from:
All examples are standardized to a common chat format using custom special tokens (see below). Source-specific filtering includes deduplication, token length capping (2048), and quality validation.
Hyperparameters
Training Details
- Framework: TRL
SFTTrainer - Attention: Flash Attention 2
- Compilation:
torch.compileenabled - Loss masking: Completion-only — loss computed only on assistant response tokens, not system/user/tool tokens
- Hardware: NVIDIA B200
Chat Format
All training data uses these special tokens:
<|system|>You are a helpful assistant that generates valid JSON.<|end|>
<|user|>Generate a user profile with name, email, and age.<|end|>
<|assistant|>{"name": "Alice Chen", "email": "alice@example.com", "age": 28}<|end|>How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"mdonigian/trellis-sft",
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("mdonigian/trellis-sft")
prompt = """<|system|>You are a helpful assistant that generates valid JSON.<|end|>
<|user|>Generate a JSON object for a book with title, author, year, and genre.<|end|>
<|assistant|>"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))Experimental Design
This model is one component of a controlled experiment comparing curated pretraining vs. standard pretraining for structured output tasks:
All three models undergo identical SFT with the same dataset, hyperparameters, and training procedure. Post-SFT evaluation covers:
- Tier 1: Custom structured output benchmarks (JSON schema compliance, structured extraction, classification)
- Tier 2: General NLP benchmarks via
lm_eval(HellaSwag, ARC, PIQA, Winogrande, MMLU) - Tier 3: Code benchmarks (HumanEval, MBPP)
Limitations
- 506M parameters limits general knowledge and complex reasoning
- Context length capped at 2,048 tokens
- No safety training, RLHF, or DPO alignment
- Optimized for structured output; general chat quality is limited
Citation
@misc{trellis-sft-2026,
title={Trellis-506M-SFT: Supervised Fine-Tuning for Structured Output},
author={Donigian, Matt},
year={2026},
url={https://huggingface.co/mdonigian/trellis-sft}
}