Blyx
← Engineering articles

One checkpoint, two processors

We trained BlyxTorch on handwritten digits and simulated buildings, then timed the same weight update on a laptop CPU and GPU.

What has to travel with a model?

A developer who trains a ticket classifier on a workstation should be able to copy its weights to a laptop and make the same decision. Our starting point was deliberately small. Given a table of numerical features, fit a class label or a set of continuous targets, save the weights, and load them through a different execution path. Pixel intensities, sensor readings and fixed text embeddings can all enter through this interface.

The checkpoint holds a format identifier, the input and output dimensions, a matrix of weights and a bias vector. It is small enough to inspect in a text editor. It does depend on an external agreement about the features. If column zero meant air temperature during training, sending humidity at prediction time still produces a perfectly ordinary number. Our experiments therefore preserve the column order, fit preprocessing only on training examples and record checksums of the resulting CSV files.

The native Blyx trainer uses 64-bit floats. For a device, Blyx emits a StableHLO graph for the same forward pass, gradients and SGD update in 32-bit floats. An optional host reads a batch, puts it on the device and keeps the updated weights there until training ends. A final batch of seven rows receives an update averaged over seven rows. This matters when comparing two implementations over many epochs. StableHLO operation definitions

A test you can read with your eyes

Each digit is an 8 × 8 grayscale image. We divided its 64 pixel values by 16 and trained a ten-class linear classifier from zero weights. The split kept class proportions approximately equal. It gave us 1,437 training images and 360 evaluation images. All three implementations saw the same examples in the same order for 12 epochs, with a batch size of 64 and a learning rate of 0.3.

First twelve held-out digit images, with the true class and Intel GPU prediction written above each
The first twelve evaluation rows in their fixed split order. The number on the left is the dataset label and the number on the right is the GPU-trained model’s prediction.

The native Blyx CPU model, the Intel GPU model and the PyTorch CPU model each classified 332 of 360 digits correctly (92.22%). A model predicting only the most frequent training class scored 10.00%. The linear classifier therefore learned useful structure, with 28 mistakes left to investigate. This is a sample-level split. Performance on handwriting from entirely new writers calls for a writer-separated evaluation. Digits dataset and provenance

Hold out a building shape

The UCI Energy Efficiency dataset asks a different question. Eight descriptors of a simulated building, including its geometry, orientation and glazing, predict heating and cooling load. Related designs share the same relative compactness. We reserved three whole compactness groups for testing so that a model could not encounter those shapes during training. That left 576 training and 192 evaluation rows.

We standardized inputs with the training means and standard deviations and fit both targets together. After 30 epochs, all three implementations reached a pooled root mean squared error of 1.8013 target units. Always predicting the two training means gave 11.0146. The GPU-trained model’s heating RMSE was 1.9840 and its cooling RMSE was 1.5978. Reporting both helps a developer spot a weak target that a single pooled score might hide.

Predicted versus reference heating and cooling loads for 192 held-out simulated designs with a diagonal for exact predictions
Each panel shows 192 held-out predictions. The dashed diagonal marks perfect agreement. Simulated energy loads give a reproducible regression problem. Field deployment would need measurements from actual buildings.

The data are by A. Tsanas and A. Xifara. The split, feature scaling and fit are available in the reproduction script. UCI Energy Efficiency dataset and license

When the CPU wins

We timed one manageable operation on an Intel Core i5-12450H laptop with Intel UHD Graphics. Each update used 128 rows, 64 features and ten classes. We fixed the input, labels and starting weights. Each timing sample performed 100 consecutive float32 SGD updates, then synchronized by reading back the weights and bias. Each engine ran two warm-up samples and seven measured samples. Model compilation, disk I/O and initial device transfers took place outside the clock.

Median time for 100 SGD updates was 2.45 ms for compiled BlyxTorch CPU, 11.85 ms for eager PyTorch CPU and 79.86 ms for the Intel Vulkan GPU
Median of seven runs. Both CPU routes used one thread. BlyxTorch used an IREE-compiled graph with explicit gradients. The PyTorch baseline used eager autograd. PyTorch compilation and PyTorch GPU training were outside this comparison.

The compiled CPU path took 2.45 ms, eager PyTorch CPU took 11.85 ms and Vulkan took 79.86 ms. That is a 4.83× CPU speedup for this particular update. A developer shipping this small head on similar hardware has a good reason to try the CPU first. A larger matrix, a dedicated GPU or a compiled PyTorch model changes the experiment. Timing just the call that submits GPU work would also have hidden the cost we measured here.

Why a sparse checkpoint took six seconds

A different delay appeared before any training began. Version 0.3 rebuilt a growing row buffer and scanned previously seen row IDs as it parsed each entry. In 0.4 the loader sizes its buffers first and indexes exact integer IDs while decoding. It still validates every row and rejects duplicates, including keys that land in the same initial hash slot. Existing checkpoints retain their layout and row order.

Sparse checkpoint lookup time increases from 17 ms to 6,302 ms in 0.3 and from 10 ms to 128 ms in 0.4 as the number of stored rows grows
One new process loads a shuffled text checkpoint, validates its contents, reads the last stored row and prints four values. Each point is the median of seven runs after two warm-ups. Both axes use logarithmic scales.

At 16,384 stored rows the median fell from 6,302 ms to 128 ms, a 49.15× improvement over BlyxTorch 0.3.0. At 512 rows it fell from 17.2 ms to 10.3 ms. These times include startup, text parsing and the final lookup. The checkpoint still has to fit in memory. Model training throughput is measured by the preceding experiment.

What a developer can build with it

For product search or support routing, compute a fixed embedding for each labelled example and fit a small local classification head. Keep the encoder version and preprocessing with the checkpoint. The bundled bridge exposes the local head as an OpenAI Responses function or an Anthropic client tool. An application selects the executable and checkpoint. The model supplies feature values and receives probabilities. Both tool-call formats were tested offline against the real local executable, including a 1,536-feature input. Hosted requests require a provider account. The weights updated by BlyxTorch are the local head’s weights. OpenAI function calling · Anthropic tool use

For image or sequence work there are also independent forward and backward exports for strided and padded 2D convolution and causal or full multi-head attention. We compared 545 output and gradient values per backend with PyTorch autograd on two convolution configurations and two attention masks. The maximum absolute difference was 2.39 × 10⁻⁷ or less on IREE CPU, Intel Vulkan and OpenXLA CPU. These are operator checks. The digit experiment above used a linear head.

Choose what to hold out

A useful first experiment in another sector begins with a deployment question. These are candidate projects for the released interfaces. Each needs its own labels and evaluation.

ProjectModel input and outputUseful holdout
Factory maintenanceClassify a fixed window of vibration features by machine state.Machines absent from training.
Retail and logisticsEstimate delivery time from order size, depot and route features.A later operating period, split before fitting preprocessing.
AgriculturePredict two soil-sensor readings from a calibrated sensor array.Whole plots or seasons.
Customer supportRoute a fixed ticket embedding to a team and examine low-confidence cases.New conversations, grouped by thread.

For a small offline service the published Windows executable measures 820,736 bytes (about 802 KiB). It can fit, predict and score on CPU without a Python installation. Device training adds a Python host, NumPy, a compiler and a compatible runtime. A TPU selector is available for a single PJRT device, but physical TPU execution still needs verification. Distributed pretraining and a dense trillion-parameter run have likewise yet to be demonstrated. In a new industry application, choose a representative dataset, split along the way it will actually be used and measure the cost of its mistakes.

Run the experiment

Start with the six labelled rows in the release. These commands train a three-class model and return an ordered list of probabilities for one input. Change a label, train again and inspect the checkpoint to see how the decision changes.

./blyxtorch probe-init 2 3 > initial.bt
./blyxtorch probe-fit initial.bt fixtures/probe-routing.csv 40 0.2 4 > routing.bt
./blyxtorch probe-predict routing.bt 1,0

For the full study, the verification repository prepares both datasets using seed 20261123. Run the native, Vulkan and PyTorch passes against the same directory. The measurement file includes the input and holdout checksums, the seven raw timing samples, per-output gradient deviations and package versions. Reproduction scripts · Download the measurements (JSON)

Download BlyxTorch 0.4.0 · Framework installation · BlyxTorch handbook