Instructions to use Tagashy/goblin-4b-mtg-dsl-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Tagashy/goblin-4b-mtg-dsl-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-3-4b-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Tagashy/goblin-4b-mtg-dsl-lora") - Notebooks
- Google Colab
- Kaggle
goblin — gemma-3-4b LoRA adapter for MTG intent→DSL
Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. This repository distributes a LoRA adapter (a Model Derivative of
gemma-3-4b-it); the only modified artifacts are the adapter weights. Your use of the base model and of any merged model is subject to those Terms, including the Prohibited Use Policy, which you must pass on to anyone you redistribute to. A copy of the Terms is included in this repository.
goblin is unofficial Fan Content permitted under the Fan Content Policy. Not approved/endorsed by Wizards. Portions of the materials used are property of Wizards of the Coast. © Wizards of the Coast LLC. Card data provided by Scryfall.
QLoRA fine-tune of gemma-3-4b-it translating structured card intents into the
mtg-compiler DSL (typed s-expressions
of Magic card mechanics). Blog:
the mtg-compiler series.
Training
QLoRA r32/α32, lr 1e-4, effective batch 24, seqlen 640, 3 epochs (11,583 steps) on the v8 intent→DSL pairs. 26.2 h on an RTX 2080 Ti.
Evaluation
Held-out v8 test (5,051 cards), free decode, matched budgets, Wald 95% CI:
| model | parse | canonical-exact | dsl_sim | tree_sim |
|---|---|---|---|---|
| goblin-4B (this adapter) | 95.6% | 52.8% ±1.4 | 0.908 | 0.845 |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("unsloth/gemma-3-4b-it")
tok = AutoTokenizer.from_pretrained("unsloth/gemma-3-4b-it")
model = PeftModel.from_pretrained(base, "<this-repo>") # or .merge_and_unload()
Input format and output validation: see the wyrmling card and the compiler repo.
Limitations
- Trained on the v8 dataset, whose DSL still contained 117 counterfeit enum values (retired in !462); the scores above are measured on that same language. v9-trained adapters will supersede this one.
- The base model carries its own pretraining knowledge of Magic (names, flavor); that content is Google's/Wizards' respectively, not licensed here.
- Free, non-commercial fan content and research use only with respect to Wizards of the Coast IP.
- Downloads last month
- 17