Output DOM size percentage compared to input DOM size (per raw bytes).
Estimated LLM input token count of the output DOM.
Downsampling is a technique to reduce data through local, lossy consolidation, such that encoded features are largely preserved. A digital image can be locally consolidated by averaging an n-tile of pixels – the depicted object would remain recognisable. We transfer this principle to the DOM: it can analogously be locally consolidated by merging n-subtrees of nodes into a single ‘average’ node.
D2Snap is an algorithm to downsample the DOM, designed for use with LLM-based web agents. It consolidates user interface (UI) features. At reduced size, the DOM (in serialised form: HTML) shall facilitate eliciting targeted action suggestions from LLMs to progress a specified task. For instance: "Add a Pizza Margherita to a delivery order".
Downsampling is the inverse of quality, governed by ratios: 0: no downsampling. 1: maximum downsampling, i.e., the DOM in its most compressed form at potential cost of certain UI features. D2Snap provides three different downsampling ratios:
rE: Element downsampling ratio – folding elements in the DOM into each other.
rT: Text downsampling ratio – truncating text at the ranked sentence level.
rA: Attribute downsampling threshold – removing attributes by UI-relevance score. With the default attribute scores, which are distributed over UI-relevance and use-frequency, this threshold latently represents an absolute ratio (idempotent).
Actionable elements and minimal text are preserved throughout.
Output DOM size percentage compared to input DOM size (per raw bytes).
Estimated LLM input token count of the output DOM.