<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Juan Salas on Medium]]></title>
        <description><![CDATA[Stories by Juan Salas on Medium]]></description>
        <link>https://medium.com/@juan.salas_36668?source=rss-4ad43912f73e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Im9S1mwBiBaXypk8</url>
            <title>Stories by Juan Salas on Medium</title>
            <link>https://medium.com/@juan.salas_36668?source=rss-4ad43912f73e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:34:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@juan.salas_36668/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Training a 42M-Parameter Spanish Cybersecurity LLM From Scratch for $25]]></title>
            <link>https://medium.com/globant/training-a-42m-parameter-spanish-cybersecurity-llm-from-scratch-for-25-80f0fbb2d38c?source=rss-4ad43912f73e------2</link>
            <guid isPermaLink="false">https://medium.com/p/80f0fbb2d38c</guid>
            <category><![CDATA[cloudops]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Juan Salas]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 15:36:43 GMT</pubDate>
            <atom:updated>2026-08-21T15:36:43.971Z</atom:updated>
            <content:encoded><![CDATA[<h4>A small, on-prem model for Latin American SOCs, with native MCP tool calling and two findings about corpus design that I didn’t see coming.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIpNuY8dWzqMt7PdgeoHGQ.png" /></figure><p>I want to tell you about a model that should not exist, or at least not for that price.</p><p>The whole thing came out of a frustration I had been carrying for about a year, watching colleagues in Latin American SOCs do their work in English LLMs and then translate back into Spanish, losing nuance at both ends of the pipe. I started VectraYX-Nano as a side project to see whether I could train something from scratch — really from scratch, no <a href="https://www.cloudflare.com/learning/ai/what-is-lora/">LoRA</a>, no base model to lean on — that spoke Spanish natively, understood our regional acronyms, and could run on hardware we already had sitting in racks. A Raspberry Pi, specifically. The one I still keep on my desk next to a coffee mug that says “Globant” on it.</p><p>What I ended up with is a 41.95M-parameter decoder-only LM. Forty-two million, give or take. It weighs 20 MB on disk at 4-bit quantization, runs at 6–10 tokens per second on the same Raspberry Pi 4, and natively supports the Model Context Protocol for tool calling. The corpus that fed it — 170 million tokens of Spanish text scraped, filtered, translated, and curated across eight virtual machines running in parallel for a couple of weeks — cost about $25 in cloud compute. Add training on top, and the full reproduction comes to roughly $29. The first time I saw that number on the invoice, I assumed there was a column I had missed. There wasn’t.</p><p>The released checkpoint is v7, and getting to v7 took six failed versions I would rather forget, but will describe anyway, because most of what I learned came from those.</p><p>I want to use this article for three things. The first is to argue why a nano Spanish security model is even worth building when GPT-4 and Llama 3 already exist and presumably know everything. The second is to get into two findings that caught me off guard during training, both of which I think apply well beyond this project. And the third is to show what actually shipped, how it benchmarks against external baselines, and how it behaves on the Pi when I leave it running overnight.</p><p>The spoilers, since you are already here:</p><ul><li><strong>The corpus with the lower perplexity produced <em>worse</em> chat behavior.</strong> At nano scale, the register of the bootstrap corpus leaks into user-visible output way more than the loss number lets on. Lower loss, worse model. I had to sit with that for a few days.</li><li><strong>The tool selection failure was never about capacity.</strong> What looked like a hard ceiling at 42M parameters turned out to be a density problem hiding in plain sight inside the <a href="https://huggingface.co/learn/llm-course/chapter11/3">SFT</a> mixture; once I moved the tool-use-to-prose ratio from 1:211 to 1:21, the capability appeared with the parameter count untouched. B4 jumped from a flat zero to 0.230 0.052 on the same architecture, and honestly, I went and re-ran the eval twice before I trusted it.</li></ul><p>This article assumes you’re comfortable with transformer pretraining, fine-tuning, and LLM evaluation at the level of someone who has trained at least one model end-to-end. The interesting question, to me, is what changes when you have a 50-dollar compute budget and an on-prem deployment constraint instead of a data center, because almost everything published assumes the opposite.</p><p>As shown in Figure 1, the comparison of disk footprint and tokens-per-second on a Raspberry Pi 4 (4 GB), with all models Q4-quantized, indicates that VectraYX-Nano is 17× smaller than Qwen2.5–0.5B and roughly 5× faster on the same edge hardware. Llama-3–8B doesn’t even fit in RAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TETRV9AJ4imm04PrLVdx3A.png" /><figcaption><strong>Figure 1.</strong> Disk footprint and tokens-per-second on a Raspberry Pi 4 (4 GB). Source: own work.</figcaption></figure><h3>The Problem Nobody Wants to Solve</h3><p>Security analysts in Latin America sit at an awkward intersection.</p><p>Frontier LLMs are trained mostly in English. Llama, Qwen, and the rest dedicate a sliver of their pretraining mix to Spanish, even though Spanish is the second-most-spoken native language on the planet. Cybersecurity-specialized models like SecureBERT and CySecBERT? Also English. And as far as I can tell, none of them have ever seen the terminology that regional CSIRTs like CCN-CERT, INCIBE, CSIRT-CL, or COLCERT use day to day.</p><p>That leaves the analyst — the person staring at a classified report, customer PII, or an unreleased indicator of compromise — with three bad options:</p><ul><li>Use an English domain model and translate. Slow, lossy, awkward.</li><li>Use a generic Spanish model that doesn’t know what an IOC is.</li><li>Use a closed frontier model they can’t audit, can’t retrain, can’t deploy on-premises.</li></ul><p>The on-prem constraint isn’t academic. Telcos, banks, and public-sector orgs across LATAM face regulatory requirements that flat-out exclude commercial APIs for many use cases. “Just send it to OpenAI” stops being an option somewhere around the second compliance review.</p><p>One small detail that ended up mattering more than I expected. The OpenSubtitles-ES corpus is heavily LATAM-dubbed Spanish, which means VectraYX-Nano <em>defaults</em> to “ustedes” instead of “vosotros” for second-person plural, without me ever specifying that anywhere in the pipeline. It also resolves regional acronyms — CSIRT-CL, COLCERT, CCN-CERT, INCIBE — more reliably than an out-of-the-box Qwen2.5–1.5B does. You can’t really put that in a benchmark table. But it’s the kind of detail a SOC analyst catches within the first 10 minutes of using the model, and once they do, they treat it differently.</p><h3>Why a Nano Model</h3><p>If you have a tight budget and some sense, you slap LoRA on a 7B Llama, and you’re done by Friday. We actually went down that road too — the VectraYX family includes a Pro 3B and an Analyst 7B, both Qwen2.5-based, both perfectly reasonable for what they are. So nobody on the team was arguing against that path.</p><p>The nano was a different itch entirely. I wanted to know what would happen if I tried to push a from-scratch model all the way into the corner of the envelope where it could actually live on hardware we already had — the Raspberry Pi 4, sub-second time-to-first-token, no GPU, no cloud, no internet if necessary. A 7B isn’t going there. Not in RAM, throughput, anywhere. The 42M one, surprisingly, does.</p><p>And then there was the second reason, which is harder to defend out loud but was probably the one that actually kept me at it. At forty-two million parameters, every decision you make leaves a fingerprint on the output. You don’t get the absorbent buffer a big model gives you, where the data can be sloppy, and the architecture can be questionable, and the whole thing still works because of sheer scale. Here, if the curriculum order is off, you hear it back the first time you type “hola’’. If the bootstrap corpus has the wrong vibe, the model wears that vibe like a uniform. It’s an unforgiving laboratory, and unforgiving laboratories are where you actually learn things. That’s the part that kept me at the terminal past midnight more than once.</p><h3>The Dead End I Started With</h3><p>Before the curriculum-plus-replay setup that eventually worked, I tried the obvious thing: a single-phase pretraining on the full 142M-token technical corpus for two epochs, then SFT. Loss looked fine. Pretraining plateaued at 3.35, SFT at 0.315. Numbers a grant committee would nod at.</p><p>Then I sent it “hola”.</p><p>It returned a CVE analysis.</p><p>Three increasingly conversational SFT runs — 86K, 11K, and 24K examples — all failed to fix it. The model simply did not know what Spanish “hello” meant other than as a token that precedes a vulnerability report. That’s when I accepted what should have been obvious in retrospect: a model that has never seen conversational Spanish during pretraining cannot be coerced into chat behavior by SFT alone, at least not at 42M parameters. The chat register has to be the model’s first language, not its last.</p><p>That observation is what motivated the three-phase curriculum and the entire bootstrap-corpus ablation that follows.</p><h3>The Architecture in Miniature</h3><p>VectraYX-Nano is a 41.95M-parameter decoder-only Transformer with all the ingredients the literature has settled on over the last two years:</p><ul><li><strong>Grouped-Query Attention (GQA)</strong> to keep the KV cache memory in check.</li><li><strong>QK-Norm and RMSNorm</strong> for low-precision training stability.</li><li><strong>SwiGLU</strong> in the feed-forward network.</li><li><strong>Rotary Position Embeddings (RoPE)</strong> instead of learned positional embeddings.</li><li><strong>Tied embeddings</strong> between the input and the language-model head.</li><li><strong>z-loss auxiliary</strong>, PaLM-style, to keep logits well-conditioned.</li></ul><p>None of these pieces is new. What’s interesting is that all of them can be combined in a 42M-parameter model without blowing up. Two years ago, that combination would have been reckless at this scale. Today it’s the default recipe, and the fact that we now treat it as default is itself worth pausing on.</p><p>The tokenizer is a 16,384-piece byte-fallback BPE trained on a 50/50 mix of conversational and technical data. That balance, instead of a 100% technical tokenizer, turned out to be another decision that paid off downstream on B5, the conversational gate.</p><h3>The Corpus — 170M Tokens for $25</h3><p>This was probably the most fun part of the project. VectraYX-Sec-ES is a 170M-token Spanish corpus assembled by an 8-VM distributed pipeline. The composition:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*VJvd8BbjeuA7bzCEO9uXqw.png" /></figure><p>Total cost: about $25 USD of cloud compute. Most of that wasn’t storage or processing — it was translation and filtering. The actual heavy lifting was sitting around watching to make sure none of the eight VMs fell over.</p><p>The corpus is partitioned into three curriculum phases:</p><ul><li><strong>Phase 1, Conversational</strong> — 42M tokens, 100% conversational.</li><li><strong>Phase 2, Cybersecurity</strong> — 118M tokens, 75% technical, 25% conversational.</li><li><strong>Phase 3, Offensive tooling</strong> — 10M tokens, 70% tools, 20% technical, 10% conversational.</li></ul><p>The replay percentages — the 25% conversational in Phase 2, the 20% and 10% in Phase 3 — are the mechanism that prevents catastrophic forgetting. The pretraining loss decreases monotonically: 9.80 → 3.17 → 3.00 → 2.16, with no visible regressions between phases. Figure 2 illustrates the schema.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2aQNnWR7PpGcOfX4mR0zg.png" /><figcaption><strong>Figure 2.</strong> Three pretraining phases plus SFT. The hatched bars are replay slices from the previous phase, which keep Phase 1 behavior alive after Phases 2 and 3. Source: own work.</figcaption></figure><p>Figure 3 plots the loss across all four phases for the two bootstrap variants we’ll discuss in a moment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ehyLPvH07pOuBawNe1Kl7w.png" /><figcaption><strong>Figure 3.</strong> Loss per phase for v2 (OpenSubtitles bootstrap, solid blue) versus v4 (mC4-ES bootstrap, dashed red). The v4 variant ends with lower loss across all phases, but — as we’ll see — that is not the metric that matters here. Source: own work.</figcaption></figure><p>Honestly, the cleanest way I found to understand the curriculum was to stop staring at the loss curve and just ask the model the same handful of questions after every phase. Same prompts, same decoding settings (T=0.7, top_k=40, top_p=0.9), three checkpoints, side by side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSBMW76VSsdMXstTdPl8_Q.png" /></figure><p>You can literally watch Spanish being acquired first, then a domain register layered on top, then chat formatting installed last by SFT. The Phase-1 outputs are pure OpenSubtitles flavor — the model thinks every Spanish utterance is a line of dialogue from a movie. Phase 2 and 3 break the dialogue register without yet replacing it with anything coherent (“¡Entierroja!” is not a word in any language I know). SFT is what makes the model actually answerable.</p><p>This is also a preview of finding #1: the register of Phase 1 leaks all the way to the final model. That’s the whole story below.</p><h3>Counterintuitive Finding #1 — The Lower-Loss Corpus Produced Worse Chat</h3><p>This is where the project got interesting.</p><p>I ran a controlled Phase-1 ablation with three variants, all sharing the same architecture, hyperparameters, and downstream SFT.</p><h3>How the Bootstrap Corpus Shapes Register</h3><p>The three variants under comparison:</p><ol><li><strong>v2</strong> — OpenSubtitles-ES only.</li><li><strong>v4</strong> — mC4-ES filtered with FineWeb-2 quality scores.</li><li><strong>v6</strong> — a 60/25/15 mixture of OpenSubtitles, mC4-ES and Wikipedia-ES.</li></ol><p>My prior was obvious: mC4-ES has much wider web coverage, so it should win. And on loss, it did:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S97g5lOyWN390nwnjrLViA.png" /></figure><p>The mC4 variant won by −0.17 in loss over OpenSubtitles. Cleaner number, better corpus, end of story, presumably.</p><p>But when I expanded the B5 held-out chat suite to 314 prompts and ran four independent seeds per configuration, the ordering inverted, unambiguously:</p><ul><li>v2 (OpenSubtitles): <strong>B5 = 0.775 ± 0.043.</strong></li><li>v4 (mC4-ES): <strong>B5 = 0.700 ± 0.122.</strong></li><li>v6 (mixture): <strong>B5 = 0.675 ± 0.083.</strong></li></ul><p>The ordering v2 &gt; v4 &gt; v6 held across all pairwise seed comparisons. The mC4 model had lower loss in every phase after Phase 1, and still lost the chat gate by about 7 points.</p><p>The mechanism becomes obvious the moment you read the actual outputs. On the prompt “hola”:</p><ul><li><strong>v2 (OpenSubtitles bootstrap):</strong><em>“¡Hola! ¿Quién es el jefe del equipo? ¡Buena suerte! ¿En qué puedo ayudarte hoy?”</em> The model greets back and asks how it can help.</li><li><strong>v4 (mC4-ES bootstrap):</strong><em>“Entre los meses más pequeños que hayas pasado por la noche son el año 2013…”</em> The model starts writing a travel article.</li></ul><p>The v4 sentence is well-formed Spanish prose with reasonable next-token entropy, which is exactly why it gets a better perplexity number. But it’s the wrong kind of Spanish. The model has internalized an encyclopedic web register, and it answers a greeting with what reads like the opening paragraph of a Wikipedia article.</p><p>Here is how I ended up explaining it to myself after staring at the eval samples for a couple of evenings. At forty-two million parameters, the model doesn’t really get to choose its default response register; whatever it learned to imitate during pretraining is what it falls back to whenever you don’t actively pull it somewhere else. SFT does pull — it moves both models firmly into the chat frame, &lt;|user|&gt; then &lt;|assistant|&gt; and so on — but only at the level of structure. The body of the response, the <em>texture</em> of how it talks, comes from somewhere deeper, and that deeper layer was set by a couple of hundred million pretraining tokens against maybe ten thousand SFT ones. The fight isn’t even close.</p><p>This kind of demolishes the heuristic I had been running for a year, the one where lower held-out perplexity is supposed to mean a better model. At this scale, it just doesn’t. If what you care about is chat behavior, perplexity is barely correlated with the thing you care about, and using it as your early-stopping signal can mislead you confidently. So if you take one thing from this section, take this: when you’re training a small domain LM, pick the bootstrap corpus whose <em>register</em> matches the way you want the final model to talk, even when a bigger web corpus would score better on loss. The number on the dashboard appears in a particular, predictable way.</p><h3>Why 25% Replay Is Not Arbitrary</h3><p>The replay percentages — 25% in Phase 2, 20% and 10% in Phase 3 — are validated, not eyeballed. I swept the Phase-2 conversational-replay percentage over {0, 5, 10, 25, 50}% while holding everything else constant. B5 saturates at 1.000 from replay ≥ 25% and degrades non-monotonically below that. Doubling to 50% adds no headline gain and slows the Phase-2 technical loss descent. The 25% setting is the smallest sufficient value, which is the kind of result that’s boring to read about and very satisfying to land on.</p><h3>Counterintuitive Finding #2 — The Tool-Use Failure Was a Density Artifact</h3><p>Benchmark B4 measures whether the model, given a question that requires invoking an MCP tool (nvd_get_cve, cisa_kev_check, and so on), emits the correct &lt;|tool_call|&gt; block as the first token after &lt;|assistant|&gt;.</p><h3>Why More Parameters Did Not Help</h3><p>VectraYX-Nano scored 0.000 on B4. Persistently. Across all three configurations. With a system prompt that enumerated the six tools with descriptions and worked examples. Nothing moved the needle.</p><p>My initial conclusion was that 42M is too small to generalize tool-call emission to unseen phrasings. Reasonable conclusion. Wrong, as it turned out.</p><p>To verify whether this was really a capacity ceiling, I scaled architecturally to VectraYX-Base 260M (d_model=1024, n_layers=16) with the same recipe, tokenizer, and SFT corpus. The training took about 11 hours on an A10G in <a href="https://aws.amazon.com/sagemaker/">SageMaker</a>, for around $11. The benchmark results:</p><ul><li>B1 went from 0.228 to 0.325.</li><li>B5 went from 0.775 to 0.800.</li><li>B3 (tool-match) went up around 4×.</li><li><strong>B4 stayed at 0.000.</strong></li></ul><p>Six times the parameters. Zero improvement on tool selection. That seemed to confirm I needed to jump to 1B+ for the pattern to emerge, and I was already drafting the budget request in my head when I decided to try one more thing.</p><h3>How Density, Not Parameters, Unlocked Tool Use</h3><p>Before signing off on the capacity-ceiling story, I wanted to rule out one more thing. The original SFT corpus had 296 tool-use examples sitting next to about 62,000 prose examples — a ratio of one to two hundred and eleven, which I had never really thought about because it had felt like enough at the time. But once I went back and looked at it I started to wonder whether the issue was much more boring than I had assumed: the prior that “the first token after &lt;|assistant|&gt; is the beginning of a sentence, not a tool call” had been reinforced 62,000 times during fine-tuning, and contradicted only 296 times. No model, at any scale, is going to flip a 211-to-1 prior on the strength of 296 contradictions.</p><p>So I built a denser corpus. 2,801 tool-use examples, same prose backbone, and trained LoRA rank-16 on top of Nano and Base. Here is what came back:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KArXd5CgQ6QXoxDzvU-20w.png" /></figure><p>(Both rows use N=4 seeds.)</p><p>The floor at 0.000 is never a capacity gate. It was the corpus pinning the model to a particular prior, and the moment I gave the model enough examples to push back against that prior — about a tenth of what it had on the prose side — the capability surfaced on its own. So the picture I would offer is this: tool-use emergence in small models isn’t really emergent. It’s a first-token prior conflict, and the conflict gets resolved by density long before it gets resolved by parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*3uanBSEIPl98vsi6gB8lqg.png" /><figcaption><strong>Figure 4.</strong> Both from-scratch models sit on the floor at 1:211. At 1:21 — around 4.8% of the SFT corpus — Nano reaches 0.145 ± 0.046 and Base reaches 0.445 ± 0.201. Same parameters, same training, just denser tool-use examples. Source: own work.</figcaption></figure><p>I think this is the most generalizable finding in the paper. <em>Any small model trained on a mixed SFT corpus will show a tool-use floor if the density is below the threshold, regardless of parametric capacity.</em> If you’re training one right now and seeing zeros where you expected something, check your ratio before scaling up.</p><h3>What a Tool-Call Turn Actually Looks Like</h3><p>In case it helps ground all of this, Figure 5 shows what a single turn looks like end-to-end. The model itself never has to memorize the CVE, which is the whole point of MCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kZ5rZcHF8PVVeZgAuEA1w.png" /><figcaption><strong>Figure 5.</strong> The 42M model owns the language — Spanish phrasing, register, tool dispatch. The MCP server owns the authoritative content — NVD, CISA KEV, and similar feeds. When the upstream feed updates, no retraining is required. Source: own work.</figcaption></figure><p>The framing I like best for this project is the use of tools for memory compression. Instead of memorizing CVE descriptions in 42M parameters, the model memorizes how to <em>ask for them</em>. The trade is favorable when the world changes faster than the model can be retrained — and CVEs, KEVs, and IOCs all change faster than that — when the queries are bounded by a small tool taxonomy, and when the cost of a wrong answer is high. All three conditions hold for a SOC analyst assistant. A frontier model could, in principle, memorize all of NVD; a nano model cannot, and learning to defer to NVD is a strict improvement over hallucination.</p><h3>What I Actually Shipped — VectraYX-Nano v7</h3><p>The LoRA-mini result above — B4 = 0.145 at 42M — confirmed the density hypothesis but came with an ugly side effect: the mini corpus was 100% tool-use, so it tanked B1 (CVE keyword recall) to 0.011. Not useful as a shipped model. Good as a proof of concept, useless as a product.</p><h3>The Balanced SFT Recipe</h3><p>The fix is a balanced SFT corpus combining two pieces:</p><ul><li>The 13K OASST1-ES + 4,030 CVE Q&amp;A + 214 custom-greeting backbone.</li><li>The 2,801 tool-use examples from the density experiment.</li></ul><p>Overall tool-use-to-prose ratio: 1:21. This is VectraYX-Nano v7, and it’s the model I’m actually releasing. The headline numbers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XteDGwsEEYk55RpGihiEdg.png" /></figure><p>Three things worth noting:</p><p>First, v7 dominates v2 on B1 by +10 percentage points — the balanced corpus doesn’t just rescue the model from the LoRA-only B1 collapse; it actually beats the bootstrap ablation reference.</p><p>Second, v7 dominates v2 on B4 (0.230 vs.0.000) with the same 42M parameter count and the same pretraining pipeline. The only change is the SFT mixture.</p><p>Third, B5 dips slightly (0.725 vs.0.775) because the balanced corpus reweights some chat supervision towards tool use; the gap is small enough that v7 is still the right ship.</p><h3>Comparing Against External Baselines</h3><p>To separate “does the recipe matter?” from “does any nano LM on this SFT work?”, I fine-tuned SmolLM2–135M-Instruct with LoRA-32 on the same corpus. The full external comparison:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*CD5XvkjxWVUAnS7BazDzWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*OGvTvjDLeyiwN0FYaDzWXw.png" /><figcaption><strong>Figure 6.</strong> B1 and B5 saturate fast — Nano is within reach of 3B. B2, B3, and B4 are capacity-gated and reward bigger models on the same SFT corpus. Source: own work.</figcaption></figure><p>There are a few things in this table that I had to read twice before they sank in. The first one is what the recipe is actually buying. Nano reaches roughly 0.228 on B1, while SmolLM2 with three times the parameters lands at 0.334. So the curriculum-and-replay machinery is pulling out about the same level of factual recall as a model three times its size, though with noisier seed-to-seed behavior than I would like. That feels like a fair trade for a model you can run on a Raspberry Pi.</p><p>B5 is the boring one in this picture. Everything you train, at any scale, with any chat data, ends up at 0.800. It’s a useful floor to know exists, but you shouldn’t read anything into a nano hitting it — at this point, B5 is telling you the model knows how to say hello, not that it’s particularly good.</p><p>The interesting clustering is on B2, B3, and B4. Here, Nano sits near the floor and stays there, while the exact same SFT corpus on a 3B backbone achieves F₁ = 0.695 on B2 and 0.600 on B4. That’s the regime where adding parameters actually does something — where the extra capacity isn’t decoration but the thing letting the model handle a harder structure.</p><p>And then above 3B, the scaling stops being uniform. Going from 3B to 7B moves B2 by +12 percentage points and B4 by +28 (reaching 0.880), but B1 and B3 don’t budge. CVE keyword extraction and command-line generation are already maxed out at 3B with this corpus. So whatever the 7B is buying you, it isn’t more of those.</p><h3>How It Compares Against a Frontier Model</h3><p>I also ran GPT-4o via the public API on the same B1–B5 suite, using the same prompts and decoding settings as for Nano. The headline numbers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*B5qJo5R1Fg5tknFEhsVOzw.png" /></figure><p>Two things stand out, and they sharpen the on-prem deployment case rather than dilute it:</p><ul><li><strong>The conversational gate inverts.</strong> Both Nano v2 (0.775) and Nano v7 (0.725) come in above GPT-4o’s B5 of 0.634 on the 314-prompt Spanish chat suite. For the specific use case I’m targeting — short, conversational handoffs and CVE follow-ups, in Spanish, on-prem — a 42M model edges out the frontier on the metric that most directly proxies user-perceived chat naturalness.</li><li><strong>The tool-selection gap is real and scale-driven.</strong> GPT-4o reaches B4 = 0.635 versus Nano v7’s 0.230. This is consistent with Pro 7B hitting B4 = 0.880 on the same suite: tool selection scales with parametric capacity, while B5 saturates much earlier.</li></ul><p>The practical reading is straightforward. For chat-dominant on-prem deployments where sending classified incident text to a closed API is unacceptable, a register-matched 42M Spanish model is competitive with the frontier. For workflows whose value is dominated by long tool chains, a frontier model — or a larger same-recipe tier (Pro 3B or 7B) — is the right substrate.</p><h3>The Deployable Artifact</h3><p>The final model exports to GGUF. The deployment numbers:</p><ul><li><strong>F16:</strong> 81 MB on disk.</li><li><strong>Q4:</strong> around 20 MB on disk.</li><li><strong>Resident memory:</strong> around 80 MB.</li><li><strong>Tokens/sec on Raspberry Pi 4:</strong> 6–10.</li><li><strong>Tokens/sec on a 2024 laptop CPU:</strong> 60–100.</li><li><strong>Time-to-first-token:</strong> sub-second.</li><li><strong>Native MCP:</strong> yes.</li></ul><p>Compared to Qwen2.5–0.5B Q4 (350 MB on disk, 1 to 2 tokens per second on a Raspberry Pi 4, no native MCP), VectraYX-Nano sits in a different efficiency class. That advantage disappears, of course, the moment what you need is open-domain conversational reasoning — Qwen wins there, comfortably. But for the target envelope — Spanish security Q&amp;A, tool dispatch, command completion, fast classification — the cost-benefit ratio shifts dramatically.</p><h3>A Note on Safety</h3><p>VectraYX-Nano is not RLHF-aligned and has no refusal training. It’s trained on offensive-security material — HackTricks, ExploitDB — by design. That’s the corpus the target users actually need. The honest question is whether shipping a model like this is responsible.</p><p>So I ran a red team. Nothing fancy — 499 adversarial prompts that I had been collecting and writing for a while, spanning roughly ten attack categories: bash injection, data exfiltration, the DAN-style and roleplay jailbreaks that everyone tries first, generic harmful-content asks, MCP abuse, lateral movement, defense evasion, and a couple more I’m forgetting. I also threw in 63 benign controls to ensure the model wasn’t just rejecting everything. And then I watched the logs. The thing I most wanted to see was whether either the base model or the LoRA mini adapter would ever, under any pressure, emit a dangerous bash_exec call. They didn’t. Not once. Which I want to qualify carefully: the safety boundary that actually held in those runs was the MCP runtime, not the weights.</p><p>The headline compliance numbers look worse than they are. The base model “complies” on 21% of the adversarial prompts, the LoRA adapter on 17%, but when I went back and read every single one of those compliance cases by hand, every one of them turned out to contain risk-indicator keywords floating inside text that didn’t actually have any operational specificity to it. In other words, the model wasn’t refusing through learned safety, it was deflecting through register drift — saying something that sounded vaguely on-topic without actually being useful to the attacker. And the multilingual bypass attempts, the ones where you embed English, German, Russian, Chinese, or Japanese commands inside a Spanish prompt to try to slip past, get 0% compliance across the board.</p><p>The deployment recommendations are straightforward:</p><ul><li>Layer safety at the MCP runtime, not at model weights.</li><li>Block destructive patterns before execution.</li><li>Hardened system prompt to scope the model to defensive analyst tasks.</li><li>Examine any bash_exec invocation.</li><li>The model is a component; the safety story is the deployment as a whole.</li></ul><h3>Conclusion</h3><p>VectraYX-Nano shows that a 42M-parameter Spanish cybersecurity LLM, trained from scratch on $25 of cloud compute and deployable on a Raspberry Pi 4, is not only feasible but useful for on-prem LATAM SOC workflows. Along the way, two findings stood out that I think generalize beyond this project.</p><p>First, at the nano scale, the bootstrap corpus’s register dominates conversational behavior more than its perplexity number suggests, which means picking the corpus that matches the response register you want matters more than picking the one with the lowest held-out loss. Second, the apparent failure of small models to select tools is governed by the density of tool-use examples in the SFT mixture, not by parametric capacity; a 1:21 ratio is enough to unlock the capability at 42M parameters. The shipped VectraYX-Nano v7 (B1 = 0.332, B4 = 0.230, B5 = 0.725) was the direct product of applying both findings to the SFT corpus.</p><p>If I had to pick one thing I’m taking away from all of this, beyond the specific findings, it would be something about the economy of the work itself. Three ingredients did most of the heavy lifting: curriculum with replay, where 10 to 25% of the prior phase is enough to stop catastrophic forgetting, native MCP for tool calling so the model doesn’t have to memorize what it can look up, and a bootstrap corpus chosen to match the register I wanted the final model to speak in. Stacked together, those three let a reproduction budget under fifty dollars produce something that holds its own against frontier baselines on the metrics that matter for where we want to deploy this. And there’s one piece of process advice in there too, although it sounds obvious only in hindsight: the experiment that explains the failure and the experiment that produces the artifact are almost never the same experiment, and being honest about which one you are running on any given afternoon is most of what kept this project from getting stuck.</p><h3>Further Reading</h3><p>If you want to dig deeper, replicate, or build on top of this work:</p><ul><li><strong>VectraYX Nano paper repository on GitHub</strong> — Training scripts, configuration files, the curriculum sampler with replay code, the benchmark harness, the tool-use corpus, and the B1–B5 evaluation datasets. Start here if you want to reproduce.</li><li><strong>VectraYX Nano model on Hugging Face</strong> — Released checkpoint in GGUF format. Recommended if you just want to run the model on a Raspberry Pi or a laptop.</li><li><strong>VectraYX Nano preprint on Arxiv (DOI arXiv:2605.13989)</strong> — Full technical paper with the ablations, the benchmark definitions, and the red-team evaluation. Recommended if you want to critique the methodology.</li><li><strong>Model Context Protocol specification</strong> — Background on the tool-calling protocol VectraYX-Nano targets natively. Recommended if you are new to MCP.</li><li><strong>Continual Pretraining of Language Models (Ke et al., 2022)</strong> — Useful theoretical context for the curriculum-with-replay setup. Recommended if you want to compare against the published continual-learning literature.</li><li><strong>The LoRA paper (Hu et al., 2021)</strong> — Original parameter-efficient fine-tuning method used in the density experiment. Recommended as background on PEFT.</li></ul><p>I’m a DevOps engineer at Globant. The opinions and the work in this article are my own. If you’d like to collaborate, replicate, break, or extend VectraYX, the issues are open.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80f0fbb2d38c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/globant/training-a-42m-parameter-spanish-cybersecurity-llm-from-scratch-for-25-80f0fbb2d38c">Training a 42M-Parameter Spanish Cybersecurity LLM From Scratch for $25</a> was originally published in <a href="https://medium.com/globant">Globant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>