--- license: mit base_model: nvidia/Nemotron-Mini-4B-Instruct tags: - typst - code-generation - qlora - fine-tuned - experimental datasets: - jalasoft/typst-instruct language: - en - es pipeline_tag: text-generation library_name: transformers --- # Nemotron-Mini-4B-IT Fine-Tuned for Typst (Experimental)
An experimental QLoRA fine-tuned model for Typst code generation - shared for research and educational purposes
--- > **Warning**: This is an experimental model that did not achieve production-quality results. It is shared for research transparency and educational purposes only. ## Table of Contents - [Nemotron-Mini-4B-IT Fine-Tuned for Typst (Experimental)](#nemotron-mini-4b-it-fine-tuned-for-typst-experimental) - [Table of Contents](#table-of-contents) - [Model Summary](#model-summary) - [Intended Use Cases (Not Achieved)](#intended-use-cases-not-achieved) - [Training Details](#training-details) - [Training Procedure](#training-procedure) - [Training Hyperparameters](#training-hyperparameters) - [Training Data](#training-data) - [Known Limitations](#known-limitations) - [Observed Issues](#observed-issues) - [Recommendations](#recommendations) - [Evaluation](#evaluation) - [How to Use](#how-to-use) - [Citation and Licensing](#citation-and-licensing) - [License](#license) - [Citation](#citation) - [Additional Information](#additional-information) - [Model Card Authors](#model-card-authors) - [Related Resources](#related-resources) --- ## Model Summary This model is a QLoRA fine-tuned version of [nvidia/Nemotron-Mini-4B-Instruct](https://huggingface.co/nvidia/Nemotron-Mini-4B-Instruct) trained on the [jalasoft/typst-instruct](https://huggingface.co/datasets/jalasoft/typst-instruct) dataset for generating [Typst](https://typst.app/) markup language documents from natural language instructions. | Attribute | Value | |-----------|-------| | **Base Model** | nvidia/Nemotron-Mini-4B-Instruct | | **Fine-tuning Method** | QLoRA (4-bit quantization) | | **Training Framework** | Axolotl | | **Dataset** | jalasoft/typst-instruct (1,016 examples) | | **Task** | Text-to-Typst code generation | | **Status** | Experimental (not production-ready) | ## Intended Use Cases (Not Achieved) The model was developed with the goal of: - **Document generation**: Creating complete Typst documents from natural language descriptions - **Template creation**: Generating reusable Typst templates for various document types However, the model did not meet the quality threshold required for these use cases due to the limitations described below. ## Training Details ### Training Procedure - **Method**: QLoRA (Quantized Low-Rank Adaptation) - **Framework**: Axolotl - **Precision**: BF16 with 4-bit quantization - **Flash Attention**: Enabled - **LoRA Target**: All linear layers (auto-detected) ### Training Hyperparameters | Parameter | Value | |-----------|-------| | LoRA Rank (r) | 64 | | LoRA Alpha | 128 | | LoRA Dropout | 0.1 | | LoRA Target Linear | true (all linear layers) | | Learning Rate | 2e-4 | | LR Scheduler | Cosine | | Optimizer | AdamW (fused) | | Epochs | 5 | | Sequence Length | 4096 | | Micro Batch Size | 4 | | Gradient Accumulation | 4 | | Warmup Ratio | 0.1 | | Weight Decay | 0.01 | | Sample Packing | Enabled | | Gradient Checkpointing | Enabled | ### Training Data - **Dataset**: [jalasoft/typst-instruct](https://huggingface.co/datasets/jalasoft/typst-instruct) - **Size**: 1,016 instruction-completion pairs - **Content**: Natural language instructions paired with Typst code and feature summaries - **Coverage**: Academic documents, technical tutorials, reports, tables, figures, and advanced typography ## Known Limitations This model is marked as **experimental** due to significant issues observed during evaluation. ### Observed Issues | Issue | Description | |-------|-------------| | **Hallucinations** | The model frequently generates incorrect or non-existent Typst syntax and features | | **Code Quality** | Generated Typst code often contains syntax errors and fails to compile | These limitations make the model unsuitable for production use in document generation workflows. ### Recommendations If you experiment with this model: - **Always validate** generated Typst code before use - **Expect compilation errors** in most complex task outputs - **Use for research purposes** to understand fine-tuning challenges - **Consider larger models** or more training data for production use cases ## Evaluation Performance was evaluated qualitatively across multiple model versions using diverse Typst generation test cases. Results consistently fell below the quality threshold required for the intended use cases. ## How to Use ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_name = "jalasoft/nemotron-mini-4B-it-ft-typ" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="float16") # Nemotron uses a specific chat format prompt = """