Home/Blog/Fine-tuning on a DGX Spark
Articles · MTW26

A local 8B model fine-tuned on a DGX Spark lands 5.5 points from a 70B in the cloud.

I fine-tuned Gemma 4 E4B with LoRA on a DGX Spark to extract facts from news stories in Spanish. Its model card states 4.5 billion effective parameters, 8 billion counting embeddings. On 200 stories the model had never seen, it went from 4.5% to 42.5% perfect records. A Llama 3.3 70B, from the previous generation, fine-tuned in the cloud with the same recipe and the same data scored 48.0%. With 200 stories, that difference cannot be told apart from chance, though it does not prove the two are equal either.

This piece explains how it was measured, why I repeated the whole comparison before publishing it, what those 5.5 points mean and what failed along the way.

AuthorCarlos Lara, Chief Product Officer
PublishedNovember 19, 2026
Reading time11 minutes
TalkFine-tune con Claude y una DGX Spark, MTW26, October 29, 2026
ModelGemma 4 E4B + LoRA

The task: a record that grades itself

A BBC Mundo news story of 400 to 2,500 characters goes in. A JSON with six fields comes out: story type, date, normalized figures, people, organizations and places.

{"tipo": "sociedad",
 "fecha": null,
 "cifras": [{"valor": 25, "unidad": "anios"}, {"valor": 5, "unidad": "otro"},
            {"valor": 50, "unidad": "otro"}, {"valor": 18, "unidad": "otro"}],
 "personas": ["Stephanie Sautner", "Lindsay Lohan"],
 "organizaciones": ["Disney"],
 "lugares": []}

I chose a fixed output because each field is right or wrong with no need for human judges. The rules are strict: figures in digits with a unit from a list of ten, names without titles, a date only if the text gives day, month and year, and no text around the JSON.

The main metric is exact match: all six fields correct at once. Entity lists are compared as normalized sets (lowercase, no accents) and figures as value and unit pairs. Every percentage carries its 95% Wilson interval.

The data and the test set

The stories come from XL-Sum in Spanish, a public dataset of BBC Mundo articles with 38,110 in the training split and 4,763 in the test split. I used only the text. XL-Sum is by Hasan et al. (Findings of ACL-IJCNLP 2021) and is distributed under the CC BY-NC-SA 4.0 license.

Before labeling anything I set aside 200 stories from the test split and fixed the sha256 hash of their ids, joined with newlines in file order and encoded in UTF-8: acbfabe30e5158c9520893568e37279b581bc3cfcf948fe137ba371e3437ba6b. None of them entered training. I learned that discipline as a judge at the NVIDIA Seattle Hackathon, as an NVIDIA Developer Champion, from a team that froze its test set by id before preparing data.

Claude as teacher, as rival and as reference

Claude Opus 5.5 filled in the reference records following a two-page instruction sheet. The 200 test stories were labeled at high effort and the training ones at medium effort. I planned 3,200 examples and ended up with 2,551, because I hit the monthly API limit in the middle of the night: 2,487 for training and 64 for validation.

Then I asked Opus to label the 200 test stories again. Against its own labels it scored 63.5%. That number is the judge's self-consistency: how often two passes by the teacher agree on the full record. It is not a ceiling. A student that learns the teacher's most frequent answer can match or exceed that figure, because training on thousands of labels averages out the teacher's noise. It works as a reference: no result should be read against 100, because not even the teacher agrees with itself more than 63.5% of the time.

The rivals were Claude Haiku 5.5 and Sonnet 5.5 with the full instruction sheet in the prompt. The fine-tuned student only receives the record schema.

Measure before training

I set a rule before spending GPU: if the model without fine-tuning came close to that 63.5%, I would not train.

Gemma 4 E4B without fine-tuning scored 4.5%, with valid JSON in 62% of cases. It wrapped the answer in markdown, invented units outside the list and left figures as text. Those are exactly the rules that training teaches.

To rule out a prompt effect, I repeated the measurement giving it the full instruction sheet, the same as Haiku and Sonnet. Valid JSON rose to 86% and perfect records stayed at 5.5%. The instruction sheet improved the format and barely moved the extraction.

This is important

Before you fine-tune, know whether fine-tuning is worth it. That answer comes from measuring the base model, not from intuition.

Training on the Spark

  • Machine: DGX Spark with the GB10 Grace Blackwell chip: 20 Arm cores and 128 GB of LPDDR5x memory unified between CPU and GPU, with 273 GB/s of bandwidth.
  • Recipe: LoRA r16, α32, dropout 0.05 on the decoder's attention and MLP projections; bf16; AdamW with lr 1e-4 and cosine schedule; batch 2 with accumulation 4; loss only on the answer tokens.
  • Size: 34.9 million trainable parameters out of 7.98 billion, 0.44%.
  • Run: 622 steps (two epochs over 2,487 examples), sequences of up to 2,048 tokens, 1.8 hours, a peak of 23 GiB. The machine's 128 GB are 119 GiB and are shared with the system.
  • Loss: from 0.49 to 0.013 in training; 0.023 on the first 16 of the 64 validation examples, which the model never saw. The script evaluates only 16 so that the measurement every 100 steps is fast.
  • Stack: PyTorch 2.11 for aarch64 with CUDA 13.0, transformers 5.5 and peft 0.21 in a Python virtual environment, no container, on DGX OS 7.4 with driver 580. Default transformers attention, no flash-attention. The training script fits in 150 lines.
  • Generic path: I did not use NeMo, the Spark playbooks, TensorRT-LLM, NIM or NVFP4. With PyTorch and peft, the same script ran unchanged on the Spark and on a rented GPU. For the same reason, the inference numbers come from transformers generate and not from an optimized runtime.

A loss of 0.023 is equivalent to the correct token having a 97.7% probability as a geometric mean. It sounds perfect, but a record has more than a hundred tokens and all of them have to come out right. That is why I count perfect records and not tokens.

We could not settle for the first comparison

The first version of this article compared Gemma with three models that had not been trained the same way. The 8B and 70B Llama models were fine-tuned on Nebius Token Factory, a service that chose its own steps: 3 epochs in 66 optimizer steps, against 2 epochs in 622 steps on the Spark. The 70B was also evaluated quantized to 4 bits. And Nemotron Nano had only one epoch.

With those differences there was no way to know whether the model or the recipe was winning. We could not settle for those results, so I repeated everything with the same script, the same data, the same seed and the same 622 steps:

  • Llama-3.1-Nemotron-Nano-4B-v1.1, on the Spark, now with two epochs: 69 minutes, a peak of 12.5 GiB.
  • Llama 3.1 8B, on the Spark: 108 minutes, a peak of 19.4 GiB.
  • Llama 3.3 70B, on a single NVIDIA B300 GPU rented on Nebius AI Cloud: 46 minutes, a peak of 141 GiB. The model ran in full bf16, not quantized, for both training and evaluation. It does not fit on the Spark in bf16: the base weighs 132 GiB.

All four runs use the same training file and the same versions of PyTorch, transformers and peft. The results from the service stay in the second table as a reference, marked as a different recipe.

Evaluation is the same for all of them: greedy decoding, up to 400 new tokens and one story at a time. Nemotron Nano is a reasoning model. I did not pass a system prompt: its tokenizer's chat template inserts detailed thinking off when there is no system message. I checked it by printing the rendered prompt, and that is how it was trained and evaluated. Its 200 outputs had no reasoning blocks and no empty answers.

This is important

If you compare models, run them all with the same recipe. Otherwise you do not know whether you are measuring the model or the training.

Results

Accuracy on the same 200 stories, with the same evaluation script. First, the four models fine-tuned with the same recipe:

Model + LoRA, same recipeParameters (billions)Valid JSONExact 6/6 [95% CI]FiguresOrganizationsPlaces
Llama-3.1-Nemotron-Nano-4B-v1.1 (Spark)4.599.5%26.0% [20.4, 32.5]67.5%58.5%77.0%
Gemma 4 E4B (Spark)8.0100.0%42.5% [35.9, 49.4]79.0%71.5%90.0%
Llama 3.1 8B (Spark)8.0100.0%43.0% [36.3, 49.9]80.0%72.5%89.0%
Llama 3.3 70B (cloud, bf16)70.6100.0%48.0% [41.2, 54.9]81.0%77.5%86.0%

Then, the references: the model without fine-tuning, the general models with the instruction sheet in the prompt, the two runs from the service and the judge's self-consistency.

ReferenceValid JSONExact 6/6 [95% CI]FiguresOrganizationsPlaces
Gemma 4 E4B, no fine-tuning, schema only62.0%4.5% [2.4, 8.3]35.0%25.0%28.0%
Gemma 4 E4B, no fine-tuning + instruction sheet86.0%5.5% [3.1, 9.6]43.0%32.0%39.5%
Claude Haiku 5.5 + instruction sheet100.0%28.0% [22.2, 34.6]70.0%57.0%76.0%
Claude Sonnet 5.5 + instruction sheet99.0%24.0% [18.6, 30.4]65.5%54.5%72.5%
Nemotron 3 Super 120B + instruction sheet, reasoning off82.0%5.0% [2.7, 9.0]43.0%30.5%41.5%
Nemotron 3 Super 120B + instruction sheet, reasoning on98.0%13.0% [9.0, 18.4]53.0%43.0%66.0%
Llama 3.1 8B + LoRA (service, different recipe)100.0%39.5% [33.0, 46.4]79.5%69.0%83.5%
Llama 3.3 70B + LoRA (service, different recipe, 4-bit)100.0%44.0% [37.3, 50.9]80.0%74.0%85.0%
Claude Opus 5.5 against itself (self-consistency)100.0%63.5% [56.6, 69.9]86.5%82.5%94.0%

At inference on the Spark, with transformers generate and no optimized runtime, batching is what matters most. One story at a time, the fine-tuned Gemma took 7.6 seconds per story: about 96 output tokens at 12.7 tokens per second. With the adapter merged into the base model it rose to 14.4 tokens per second, and in batches of 8 it reached 62.8, which is 1.5 seconds per story. Llama 3.1 8B went from 11.7 to 44.0 tokens per second with the same changes. With the adapter merged and in batches of 8, accuracy moved by two records, within noise: Gemma 83 perfect out of 200 instead of 85, and Llama 3.1 8B 84 instead of 86. I do not report the speed of the 70B: I measured it one story at a time on the rented GPU, and that figure says nothing about the machine.

Four readings:

  1. Fine-tuning beats general models with a prompt. Against Haiku, the strongest rival, the intervals do not overlap: 42.5 [35.9, 49.4] against 28.0 [22.2, 34.6]. Compared story by story, chance does not explain the difference either (McNemar test, p < 0.001). The advantage is in figures, organizations and places; on type and people they tie. It is not a prompt effect: Gemma without fine-tuning, with the same instruction sheet as Haiku, reached 5.5% [3.1, 9.6].
  2. The 70B landed higher, with no conclusive difference. It has almost nine times Gemma's parameters and landed 5.5 points higher: 48.0 [41.2, 54.9] against 42.5 [35.9, 49.4]. The paired test does not separate the two models (McNemar, p = 0.16), but it does not show they are equal either: the interval of the difference runs from 1.5 points in Gemma's favor to 12.5 in the 70B's favor. The 70B may be better; 200 stories are not enough to claim it or to rule it out.
  3. The name misleads. Gemma 4 E4B is called 4B, but the E stands for effective parameters. Its model card states 4.5 billion effective and 8 billion counting the per-layer embedding tables, which are only looked up. Against Llama 3.1 8B, which has almost the same parameters, it got 85 records right against 86 (McNemar, p = 1.0). They are two 8-billion models that tie.
  4. The base model matters. Llama-3.1-Nemotron-Nano-4B-v1.1 comes from Llama 3.1 8B: NVIDIA width-pruned and distilled it (Llama-3.1-Minitron-4B-Width-Base) and then trained it to reason. It has 4.5 billion parameters. Its model card states it is intended for English and code, with Spanish among the languages also supported, and this task is in Spanish. With the same recipe and the same two epochs it reached 26.0% [20.4, 32.5], clearly below the other three (McNemar against Gemma, p < 0.001). Fine-tuned, it sits at the level of Haiku and Sonnet with a prompt. I used version v1.1, from May 2025. In March 2026 NVIDIA released Nemotron 3 Nano 4B, with a different architecture, and I did not measure it: this result speaks about that checkpoint, not about the family.

Limits of this measurement

  • The reference is a model. The labels come from Opus, not from people. The 63.5% measures its consistency between two passes, but it does not guarantee that every label is correct. Also, the training set was labeled at medium effort and the test set at high effort: the fine-tuned models learned from labels somewhat different from the ones that grade them.
  • 5.5 points are neither a demonstrated tie nor a loss. With 200 examples you can tell 42 from 28, not 42 from 48. The difference with the 70B could run from 1.5 points in Gemma's favor to 12.5 in the 70B's favor, an interval too wide to pass an equivalence test. I cannot claim that Gemma wins or that it loses; at these rates it would take about 660 stories to detect 5.5 points with 80% power.
  • Several tests on the same data. I ran ten McNemar comparisons. Four were significant before correction: Gemma against Haiku, against Sonnet and against Nemotron Nano, and the 70B against Haiku. With Holm correction they are the same four. None changed.
  • The 4B is in the name, not in the size. Gemma 4 E4B has 4.5 billion effective parameters and 8 billion in total. In memory and training time it behaves like an 8B model.
  • Size and generation are mixed together. Llama 3.1 and 3.3 are from 2024; Gemma 4 is from 2026. Part of what brings Gemma close to the 70B may come from it being a newer model. Separating the two would take fine-tuning models of different sizes from the same family.
  • The recipe is identical, the hardware is not. The 70B was trained and evaluated on a rented GPU, with the same script and the same library versions. Times across machines are not comparable.
  • The recipe was set with Gemma. I did not search for the best lr, the best rank or the best number of epochs for each model. With r16, the adapter is 0.44% of Gemma and 0.29% of the 70B. A different recipe could favor a different one, the 70B in particular.
  • The date field barely discriminates. None of the 200 stories carries a full date, so it measures whether the system refrains from inventing one.
  • It is one task, one domain and one seed. News from a single outlet, and each model was trained only once. I do not know how much the result changes between runs; a difference of one or two points may be just that.
  • No constrained decoding. I did not try forcing the JSON of the model without fine-tuning. It has a cap: even if its 28 invalid outputs became perfect records, it would reach 19.5%.
  • It cannot be reproduced from outside yet. The script, the adapters and the labels are not published.

What failed along the way

Unified memory belongs to everyone. At midnight another service on the machine loaded a 57 GB model and the OOM killer ended the training at step 522, with no checkpoint. setsid does not protect you, because it changes the session and not the cgroup. The fix was to save a checkpoint every 100 steps and leave the machine alone while it trains. Launching with systemd-run --user --scope gives the training its own cgroup, but does not protect it from the OOM killer on its own; that takes limiting the other service's memory.

An adapter can load silently and wrong. The adapters downloaded from the cloud came with keys missing the base_model.model. prefix that peft expects. They loaded without error, with random weights, and generated garbage. After rewriting the keys, the output was valid JSON. It pays to try three texts and read the output before evaluating two hundred.

The 70B only fit pre-quantized. Loading the base in bf16 (132 GiB) to quantize it on the fly died for lack of RAM. With a base already quantized to 4 bits (37 GB) it loaded in five minutes. For the run with the same recipe I rented a 288 GB (268 GiB) GPU, where it fits in full.

The cloud does not always have the GPU. The first two regions where I requested the machine had no B300 available. It started in the third.

A low token limit truncates models that reason. On the first attempt, Nemotron Super returned 73 empty answers out of 200 because the reasoning used up the output limit. The figure in the table is with reasoning on, 8,000 output tokens, temperature 0 and the instruction sheet as the system prompt, served through an API. With reasoning off and 4,000 tokens it scored 5.0%, level with Gemma 4 E4B without fine-tuning and the same instruction sheet (5.5%). I did not optimize that path: it is a single configuration, and 18% of its answers were not valid JSON. The limit differs between the two rows because without reasoning a record takes about 100 tokens and 4,000 is more than enough.

How to repeat it with your data

  1. Pick a task with a fixed output that can be graded field by field.
  2. Set aside 100 to 200 examples by id before touching anything.
  3. Write the rules, try them on 20 examples, review them and then label thousands. Measure the teacher's consistency with itself: that is your reference.
  4. Measure the model without fine-tuning. If it is already close to that reference, stop.
  5. If you compare models, train them with the same recipe.
  6. Train, compare with intervals and publish what did not win too.

You pay for the labels once. The fine-tuned model runs locally, with no cost per call and without the texts leaving the machine.