← All blogs

AI engineering

A fine-tuned 350M-parameter LLM on a free e2-micro VM

In a research experiment, we fine-tuned a 350M-parameter language model and ran it on the smallest machine Google Cloud gives away: an e2-micro with 1 GB of memory and a quarter of a vCPU sustained. The model's job was narrow. In a care-questions assistant we built as an experiment, it read each question and picked which read-only lookups to run, and ordinary code did everything else. It passed 58 of 58 checks inside a 16-second deadline once we found why some replies took 41 to 50 seconds.

Rubix Labs5 min read
Our setup: a fine-tuned LFM2.5-350M Q8_0 model of 379 MB on a free e2-micro with 1 GB of memory and 0.25 sustained vCPU. Before: a changing tool list inside the system prompt forced 385 to 406 prompt tokens to be processed again, giving 41.0 to 49.7 second replies. After: a constant prefix with tools beside the question passed 58 of 58 checks inside 16 seconds, with a 6.027 second sustained median and 431.5 MiB peak memory.
From our research experiment. Timings are sequential and small-sample; with four concurrent test accounts, most ordinary questions went to the rules-based fallback.

What the free machine is

Google Cloud's free tier includes one non-preemptible e2-micro a month in us-west1, us-central1 or us-east1, plus 30 GB-months of standard persistent disk. The e2-micro shows the operating system two vCPUs but sustains each at 12.5% of CPU time, 25% in total, with short bursts to 100%. It has 1 GB of memory.

That burst flatters benchmarks. Our selected model answered 29 requests with a 0.809-second median while the burst lasted; a sustained pass over the same requests had a 6.027-second median. The second number is the one to plan around.

The model and its narrow job

We fine-tuned Liquid AI's LFM2.5-350M and served an 8-bit Q8_0 GGUF of 379,219,904 bytes with llama.cpp: two threads, one inference slot, a 2,048-token context, memory capped at 640 MiB and no swap. The model never writes the answer or touches stored data. It returns a short code naming up to six of eleven allowed lookups, and the server checks that code against the current permissions before running anything.

Training used 2,272 synthetic examples, with 476 more for development and 520 kept for regression checks. Two earlier compact rounds failed their development gates. A final three-epoch refinement took 190.3 seconds on one local GPU, and the selected epoch completed 454 of 476 development routes, with every output valid and no false accepts on the 16 critical cases.

Against the earlier version of the router it traded some coverage for safety. On the reused regression split it completed 477 of 520 routes (91.7%) against the earlier version's 487 (93.7%), but it passed all 16 critical abstention cases, where the earlier version had two false accepts.

Why four requests took 41 to 50 seconds

Our first qualification on the VM failed on four requests. Their answers were correct once they finished, but under repeated load they took 41.0 to 49.7 seconds, including 37.5 to 39.0 seconds of prompt processing in the two longest.

The cause was prompt layout. We'd put the allowed-tool list, which changes with permissions and exclusions, inside a long system prompt. Every change invalidated the prefix the runtime could reuse, so it processed 385 to 406 prompt tokens again on a CPU that sustains a quarter of a core. Bigger batches, a single thread and turning off weight repacking didn't help.

The fix kept one constant system prefix, put the currently allowed tools beside the question and asked for short tool codes instead of names. A five-tool answer needs about eight generated tokens instead of 37, and output is capped at 64. A JSON schema lists the 1,486 valid code strings, so the model can't emit a duplicate or an unknown tool.

What it did after the fix

The load test is the most useful row. Four test accounts made requests concurrently for ten minutes, about 40 a minute in total. The model handled about 10 a minute, and 243 of 341 ordinary read requests (71.3%) went to the rules-based fallback: 221 because the single inference slot was busy and 22 because the model was unavailable. Nothing failed, and the busy fallback answered in a client median of 1.271 seconds. Still, a free VM with one slot can't promise the model for every concurrent question.

What it did after the fix
CheckResult
Sequential requests within the 16 s deadline58 of 58
Sustained pass: median, p95, maximum6.027 s, 8.749 s, 8.993 s
Peak memory (RSS)441,900 KiB (431.5 MiB)
Five live model-backed calls, server side3.877 to 7.741 s, median 4.489 s
Four test accounts for ten minutes, then a reboot514 of 514 responses passed their checks

Why the on-device version stays switched off

We also tried Qwen3-0.6B as a 397 MB Q4_K_M GGUF running in the browser on one CPU thread and in a native mobile runtime on two. The runtime parts worked: download, hash check, load, cancel and unload. The model itself passed only one case of a fresh three-case probe, a record lookup. On another lookup it wrote 'parameters' where the schema wanted 'arguments', and for the third it returned a bare array.

One out of three is a clear no, so both feature flags stay off until a representative held-out evaluation and real phone testing pass. For scale, the same 0.6B model's server process peaked at 902.4 MiB on our workstation. That wasn't measured on the VM, but on a 1 GB machine the 350M model's 431.5 MiB leaves far more room.

The licence, and when this setup fits

LFM2.5-350M ships under the LFM Open License v1.0, which grants commercial use only to organisations below US$10 million in annual revenue, so check that before you build on it. Qwen3-0.6B is Apache 2.0.

This setup suits a narrow job with a safe fallback: the model picks from a fixed menu, the server checks the pick, and something deterministic answers when the model is busy or wrong. If you're weighing a small model on cheap hardware against an API, Rubix can help test the routing on your own requests. Our pricing page lists LLM fine-tuning and on-device AI under custom models, and we've written about splitting work between model sizes.