Presets & autotune
Longpipe ships five model presets covering different speed/quality tradeoffs. The default ('auto') picks one for the user’s hardware automatically. All five get frame-to-frame stability from the optical-flow head — previous outputs are warped along the predicted motion and blended, with no recurrent state in the network (see Architecture).
The presets
| Preset | Output resolution | Base resolution | Base network | Frame cadence | Named shortcut |
|---|---|---|---|---|---|
xs | 384×240 | 128×80 | Small | 1-in-3 frames | fast |
small | 384×224 | 192×112 | Small | 1-in-2 frames | — |
medium | 512×320 | 256×160 | Large | 1-in-2 frames | balanced |
large | 640×400 | 256×160 | Large | every frame | — |
xl | 1280×768 | 320×192 | XL | every frame | quality |
Output resolution is where the matte is produced and composited (the network’s refinement input); base resolution is what the encoder runs at internally (the wrapper strides the input down to it). Frame cadence is how often the model re-runs — skipped frames reuse the previous matte while still compositing every frame, so a 1-in-2 preset costs roughly half the per-source-frame inference of an every-frame one.
large is the design reference tier; the others sit around it as cheaper/heavier variants. Weights are f16 on hardware that supports it (most WebGPU + WebGL2), f32 otherwise — the runtime decides, regardless of preset. All tiers are trained on the same data and exported with the same op fusions. See Architecture for how the encoder, heads and frame skipping fit together.
preset takes a tier name ('xs'…'xl', the same names ready.preset reports) or a shortcut: 'fast', 'balanced', 'quality' map to xs, medium, xl.
Presets, autotune and the adaptive controller apply to Longpipe’s own models only. With model: 'mediapipe-selfie' there is one fixed model: nothing is benchmarked or swapped, and an explicit preset throws.
Autotune (preset: 'auto')
On init, the worker microbenchmarks the candidate presets on the real device and picks the largest one whose measured per-frame model cost fits the frame budget — roughly half of a 30fps source frame (~16 ms; WebGL is more conservative, since it has no live upgrade path). The benchmark uses zero-filled weights of the correct shapes (GPU cost is shape-driven), so it runs before any weights are fetched.
Autotune runs once at startup and adds a small amount to init time for the sweep.
Audio denoise auto-selects separately.
presetand autotune here govern the video model only. Whenaudio: 'denoise'is set, the denoiser runs its own analogous weight-free probe at init — timing the denoise network on the device (no weights downloaded) to pickdfn/dfnint8/rnnoise— independent of the video preset. See Audio denoise → Models.
Adaptive (runtime)
When preset: 'auto' and adaptive: true (the default), Longpipe also adjusts at runtime:
- Downgrade if the actual framerate drops below the target (typically because another tab started doing heavy work, the user plugged into a battery-saver power plan, etc.).
- Upgrade if
modelMsshows consistent headroom (WebGPU only — WebGL upgrades are too expensive to be worth doing live).
Disable with adaptive: false.
Pinning a preset
new EffectsPipeline(stream, { preset: 'large' }) // disables autotune & adaptive
new EffectsPipeline(stream, { preset: 'auto', adaptive: false }) // autotune once, then stay
await pipeline.setPreset('small') // switch tiers at runtime
Tier names need longpipe 0.0.20 or later; on 0.0.19 use 'fast' / 'balanced' / 'quality'.