Invent

Low-level primitives: forward passes, device epilogues, KV cache control, scheduling policies, and Poem models.

You can implement new inference algorithms and model architectures in Pie without modifying the engine. Built-in features such as the OpenAI API, speculative decoding, and cache-aware routing are written using the same primitives described in this section.

inferletsthe loopepiloguessampling on deviceruntimebatches passes · keeps cache pages · moves statepolicieswho runs, wherePoem modelthe forward pass, as a programeta compilertraces → device codeCUDAROCmMetalVulkanWebGPUTPU
Dashed outlines are programs you can write: inferlets, epilogues, policies and models.

As the figure above shows, four programmable pieces meet here:

  • Inferlets control the generation loop: what each ForwardPass reads and writes, and how its outputs are used.
  • Epilogues run on the GPU right after each forward pass, compiled from Python, JavaScript, or Rust.
  • Policies configure which process runs next, which KV pages stay cached, and how requests route across a cluster.
  • Models are Poem files that define the forward pass itself.

The Cookbook contains more than fifty complete inferlets covering samplers, guidance, tree search, speculative decoding, KV eviction, and watermarks.