Running a Large Language Model on a Printer: Edge Inference with 14 MB of Memory
An experimental setup ran a 270-million-parameter language model inside an office laser printer with approximately 14.1 MB of memory. By compiling a lightweight Transformer inference engine and quantized model weights into PostScript, the printer executed inference and printed the generated text directly on paper. This article explains the role of PostScript, quantization, layer streaming, prefill and decoding, and the practical limits of running language models on extremely constrained hardware.
Introduction: Getting a Printer to Generate Text
Large language models typically run on GPU-equipped servers or, at minimum, on phones with several gigabytes of memory. But can an office laser printer run a language model? Its memory is measured in megabytes, its CPU runs at only a few hundred megahertz, and it has no floating-point acceleration unit.
An engineer from a major AI lab demonstrated that the answer can be yes. On a printer using approximately 14.1 MB of memory, the engineer ran a small language model with 270 million parameters. The generated text was printed directly onto paper. The experiment’s most obvious limitation was speed: generating a single token took about 60 seconds.
The value of this experiment is not practical throughput, but the boundary it demonstrates. It shows one way to test whether inference is feasible when no dedicated inference hardware is available. This article breaks down the key techniques and summarizes methods that can be applied to other constrained devices.
1. Core Idea: Use a Page Description Language for Computation
1.1 Why PostScript?
Many laser printers include a PostScript interpreter. PostScript was originally designed to describe page layouts, fonts, and graphics before driving rasterization and output. Because PostScript is Turing-complete, it can theoretically express arbitrary computations. On real devices, however, the available computation is constrained by memory, execution time, and security policies.
The experiment did not modify the printer’s firmware or attach an external computing board. Instead, the researchers compiled a small Transformer inference engine and quantized model weights into a PostScript print job and sent it to the printer.
When the printer interpreted the job, it executed the inference program. The input prompt first went through a prefill stage, after which the model decoded tokens one at a time. The final text was rendered as page objects and printed.
1.2 The Broader Value of This Approach
Many embedded devices include some form of programmable execution environment, such as a router’s scripting engine, a printer interpreter, or the scripting system in certain appliances. When the target device lacks dedicated inference hardware, compiling an inference engine for an interpreter that already exists on the device can provide a low-cost way to validate feasibility.
Performance is usually limited, but this approach can answer the initial question—“Can it run at all?”—without requiring new hardware.
2. How Memory Usage Was Reduced to 14.1 MB
A 270-million-parameter model would require approximately 540 MB even when stored in FP16, far beyond the printer’s memory limit. The experiment therefore depended on a combination of techniques.
2.1 Quantization: Using Fewer Bits per Weight
Quantization reduces the number of bits used to store model weights. With 8-bit quantization, the model is approximately half the size of an FP16 version. With 4-bit quantization, it is approximately one quarter of the size. Lower bit widths generally introduce greater accuracy loss.
Small models performing relatively simple tasks can often tolerate moderate quantization while still producing basically coherent text.
For 270 million parameters, all weights would occupy approximately 270 MB at 8 bits and 135 MB at 4 bits. Both figures are still far above 14.1 MB, so the memory limit also required the layer-loading strategy described below.
2.2 Dynamic Layer Loading: Trading Time for Space
Even after quantization, the entire model could not remain in the printer’s memory at once. The experiment used a dynamic layer-loading, or layer-streaming, strategy:
- The model contains 18 Transformer layers.
- During inference, the weights for one layer are loaded and used for computation.
- After the layer finishes, its memory is released before the next layer is loaded.
- The weights are delivered as a PostScript job byte stream from the host and parsed by the interpreter as needed.
This is a common approach for running large models on memory-constrained devices: weights are repeatedly moved in and out instead of being kept resident.
The cost is equally direct. For every generated token, the system must repeat the process of loading, computing, and releasing all 18 layers. As a result, performance is heavily affected by weight movement.
A rough even-distribution estimate gives approximately 15 million parameters per layer. At 4-bit precision, that is about 7.5 MB per layer; at 8-bit precision, it is about 15 MB. Under the 8-bit estimate, a single layer would already exceed the 14.1 MB limit. Therefore, the actual quantization level or parameter distribution across layers was likely different from this simplified calculation.
This estimate also excludes the token embedding layer, whose size depends on the vocabulary. Peak memory additionally includes activations, the attention KV cache, and interpreter runtime overhead. The exact figures would require consulting the original experiment report.
2.3 Prefill and Decoding: Which Stage Should Be Optimized First?
The experiment reported that prefill for the prompt “Read the fine” took approximately 184 seconds. Prefill processes the entire input sequence at once, so it requires substantially more weight movement than a single decoding step. As a result, it took significantly longer.
During decoding, the system still has to traverse the model layers again for every generated token, so performance remains limited by weight movement.
This article does not describe single-step decoding as taking only 0.1 seconds. That figure is inconsistent with the overall rate of approximately 60 seconds per token, and the measurement methodology is not specified.
For streaming inference of this kind, optimization should first focus on weight movement during prefill. Possible directions include shortening the input, reducing repeated layer access, or combining the loading of adjacent layers. The actual benefit must be measured on the target workload.
3. A Practical Deployment Decision Sequence
The experiment’s lessons can be organized into the following decision sequence. The exact process depends on the model architecture, memory limit, and latency target, so every step should be tested against the intended workload.
Inventory the device’s existing capabilities. Check whether the device already includes an interpreter, scripting engine, or general-purpose CPU execution environment. If it does, begin by validating the workload there instead of immediately adding hardware.
Quantize before considering structural reduction. Quantization is usually the lower-risk compression method. Removing layers or shrinking the vocabulary directly reduces model capability, so these measures should be considered only when quantization alone is insufficient. After each structural change, use task-specific metrics to verify that quality has not declined beyond an acceptable level.
Use dynamic loading as a fallback. When the model cannot remain in memory, loading it layer by layer can satisfy the memory limit, but throughput will drop sharply. Weight movement may take one or two orders of magnitude longer than the actual computation, so this cost should be estimated early in the design process.
Define “usable” according to the task. At one token every 60 seconds, the system cannot support continuous conversation. However, if the task generates only a sentence, a label, or a small configuration, latency measured in minutes—or even hours—may be acceptable.
The following estimates assume 60 seconds per token and are provided for reference:
| Task type | Approximate output length | Estimated time at 60 seconds per token |
|---|---|---|
| Classification label | About 5 tokens | About 5 minutes |
| One-sentence summary | About 30 tokens | About 30 minutes; suitable for offline tasks |
| Configuration snippet generation | Several hundred tokens | Several hours or more; suitable for background batch processing |
4. Limits and Lessons
The engineering significance of this experiment is greater than its immediate practical value. A PostScript interpreter is far less efficient than native code, and the CPU lacks floating-point acceleration. Overall performance is therefore suitable mainly for a proof of concept.
The main lessons are as follows:
Small models may still run within extremely small memory budgets. The combination of quantization and streaming can fit a model into memory measured in megabytes. This offers a useful reference for lightweight AI deployment on IoT and embedded devices.
Compiler technology can reduce the cost of adapting to heterogeneous environments. Compiling an inference engine into a PostScript program shows that, when a target environment provides sufficient computational expressiveness, software can cross the boundaries between very different device types.
Slow inference can still be relevant in specific offline scenarios. When no additional hardware is available, data must remain on the device, and the task is not latency-sensitive, a very slow local system may still be useful for feasibility testing or infrequent batch jobs.
