2026-11-26 15:40 UTC

Folate releases a 107 MB CPU model for ranking browser DOM elements

state: seedheat: mediumuncertainty: mediumrelevance: mediumbrowser-agents small-models local-inferencefigranium

What is this?

Folate is an Apache-2.0-licensed browser-automation model and Python package from GitHub maintainer figranium. The project says it fine-tunes Google’s ELECTRA-base on Mind2Web to rank DOM elements against a natural-language action, then distributes an INT8 ONNX version of about 107 MB for CPU inference. Its repository, package, Hugging Face model and demo are linked from the supplied Show HN listing. The maintainer reports 88.90%–93.31% Top-1 on Mind2Web test splits and roughly 180–250 MB runtime RAM; these are project-reported results, with no independent confirmation in the supplied evidence.

Why it matters

Folate points to a useful alternative to sending every browser interaction to a large cloud model: a specialized, small local ranker could make DOM-based automation cheaper, more private and feasible on RAM-constrained machines. The reported benchmark is promising but is for single-step DOM grounding, not complete browser-agent tasks; latency and the comparison with a multimodal frontier model limit what can be inferred about practical end-to-end performance.

Current assessment

New evidence: the figranium/folate repository describes a released, usable CPU-oriented DOM element ranker, with a PyPI package, Hugging Face weights and demo linked in the Show HN post. It says the default INT8 ONNX artifact is about 107 MB and uses about 180–250 MB RAM; inference uses ONNX Runtime and does not require PyTorch or Transformers. The stated use is ranking up to roughly 50 candidate DOM elements for a single action, not planning a multi-step workflow. The maintainer reports Mind2Web Top-1 of 93.31% on test_task, 88.90% on test_website and 92.08% on test_domain across 6,037 steps; reported CPU latency on 2 vCPUs is about 2.3–4.3 seconds per step. These are first-party benchmark claims, not independently verified in the supplied sources. The repository’s comparison to GPT-6 Luna is not a like-for-like test: Folate uses text-based DOM candidates, while the cited GPT results are multimodal/screenshot-based. Its claim of zero selector hallucination is narrowly about returning selectors for actual extracted DOM nodes; it does not establish that the selected node is correct. If the reported results transfer, Folate could lower compute, memory and API costs for local browser automation, but real-world reliability, speed and generalization beyond the stated evaluation remain open questions. The supplied search results add no corroborating Folate evidence.

Measured heat

now 0 pts/hpeak 2 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 263h
points/hour across evidence Β· reading as of 2026-11-27 02:23:58.509736+11:00 Β· deterministic, not a model opinion

How the heat travelled

11-15 16:24 (minted)⭐ origin echo-reconstructedThe repository README presents Folate as an original project, describing it as a lightweight, CPU-efficient neural DOM element ranker fine-t
Figranium on github (echo) Β· attributed from hn.story.50507874 Β· published time unknown
β€”
11-15 15:55first on hacker news Β· published Β· lag ?Show HN: Folate – Local DOM selector model that beats 7B VLMs at 1/60th the size
asernasr
β€”
11-15 15:55amplified on hacker news πŸ‘‘hn.story.50507874
asernasr
peak 2 Β· 0 comments Β· 103% of case engagement
11-15 16:21our radar first saw it Β· lag ?discovery anchor: hn.story.50507874β€”
pace: p13 vs 2096 stories at the 168h mark (now 263h old) β€” behind adobe-max-ai-agents-creative-tools-mcp (0.5x)

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: Folate – Local DOM selector model that beats 7B VLMs at 1/60th the size
Retrieved article excerpt

Open article Β· Retrieved 2026-11-15T16:22:19.846665+00:00

[Folate](https://raw.githubusercontent.com/figranium/folate/main/banner.png)

[Model on Hugging Face](https://huggingface.co/figranium/folate)

[PyPI](https://pypi.org/project/folate/) β€’
[Hugging Face](https://huggingface.co/figranium/folate) β€’
[Demo](https://huggingface.co/spaces/figranium/folate-demo) β€’
[Apache 2.0](https://github.com/figranium/folate/blob/main/LICENSE)

A lightweight, CPU-efficient neural DOM element ranker built for browser automation within tight memory constraints (<2 GB total footprint alongside a headless browser).

Fine-tuned from [`google/electra-base-discriminator`](https://huggingface.co/google/electra-base-discriminator) on [`osunlp/Mind2Web`](https://huggingface.co/datasets/osunlp/Mind2Web) and dynamically quantized to **INT8 ONNX (~107 MB)**, Folate runs purely via `onnxruntime` and `tokenizers`β€”requiring no PyTorch or `transformers` at inference time.

---

## Model Overview

Folate operates as a discriminative cross-encoder that scores `(natural_language_query, serialized_dom_element)` pairs in a single batched forward pass on CPU.

| Variant / Artifact | Backbone | Precision / Format | Disk Size | Runtime RAM |
| --- | --- | --- | --- | --- |
| **`folate-int8` (Default)** | `google/electra-base-discriminator` | Dynamic `QUInt8` ONNX | ~107 MB | ~180–250 MB |
| **`folate-base`** | `google/electra-base-discriminator` | `float32` Safetensors | ~418 MB | ~1.4+ GB (PyTorch) |

### Key Capabilities

- **Zero-Hallucination Selector Grounding** β€” Ranks real interactive DOM nodes extracted via `lxml` XPath (`<a>`, `<button>`, `<input>`, `<select>`, `<textarea>`, ARIA interactive roles, and `onclick`/`tabindex` elements), guaranteeing every returned CSS/XPath selector exists on the live page.
- **Compact Structured Serialization** β€” Serializes each element into a concise `96`-token representation:
  `[TAG] ... [ID/NAME/TYPE/ROLE/ARIA-LABEL/PLACEHOLDER/TITLE/ALT/HREF/DATA-TESTID] ... [TEXT] ... [PARENT] ...`
- **Edge & Low-Memory Deployment** β€” Designed to run alongside Chromium on resource-constrained laptops and containers without GPU acceleration.

---

## Quickstart

### Installation

```
pip install folate
```

Or install from source:

```
git clone https://github.com/figranium/folate
cd folate
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
```

To run the live browser examples with Playwright:

```
python -m pip install -r examples/requirements.txt
python -m playwright install chromium
```

### Usage

`FolateSelectorFinder` automatically downloads and caches [`figranium/folate`](https://huggingface.co/figranium/folate) on first run (or loads `./folate-int8` if present locally):

```
from folate import FolateSelectorFinder

finder = FolateSelectorFinder()
matches = finder.rank("click Search Flights button", html_source, top_k=3)

for match in matches:
    print(f"{match['score']:.4f} | {match['selector']} | {match['element']}")
```

To load weights from a custom local directory:

```
finder = FolateSelectorFinder(model_dir="./folate-int8")
```

### Programmatic Model Download

If you want to pre-fetch the quantized model weights via `huggingface_hub`:

```
hf download figranium/folate --local-dir ./folate-int8
```

---

## Repository Structure

```
folate/
β”œβ”€β”€ folate/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── ranker.py                  # Lightweight CPU inference engine & DOM serializer
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ prepare_data.py            # Streaming Mind2Web serializer (lxml)
β”‚   β”œβ”€β”€ train.py                   # Fine-tuning script (bf16/fp16/CPU)
β”‚   β”œβ”€β”€ export_onnx.py             # FP32 ONNX export + INT8 dynamic quantization
β”‚   β”œβ”€β”€ eval_mind2web.py           # Official Mind2Web evaluator (Precision/Recall/F1, Top-1/3/5 & MRR)
β”‚   └── eval_precision.py          # Playwright DOM-resolved selector Precision & Recall benchmark
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ test_google.py             # Live Playwright search box grounding on google.com
β”‚   β”œβ”€β”€ test_amazon.py             # E-commerce element ranking on amazon.com (+ offline snapshot)
β”‚   β”œβ”€β”€ test_github.py             # Repository navigation grounding on github.com
β”‚   └── requirements.txt           # Optional Playwright dependency for live browser tests
β”œβ”€β”€ requirements.txt               # Lightweight CPU runtime dependencies
β”œβ”€β”€ requirements-train.txt         # Training & ONNX export dependencies
└── LICENSE
```

---

## Evaluation & Benchmarks

Folate is evaluated on the three standard generalization splits of **Mind2Web** (`test_task`, `test_website`, and `test_domain`) across **6,037 action steps** on real-world webpages.

### Mind2Web Results (INT8 ONNX Β· CPU)

| Split | Description | Steps | Avg Candidates | Top-1 | Top-3 | Top-5 | MRR | Avg Latency (2 vCPU) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| **`test_task`** | Unseen tasks on seen websites | 1,256 | 50.0 | **93.31%** | 97.61% | 98.33% | 0.9566 | 2,309.9 ms/step |
| **`test_website`** | Completely unseen websites | 955 | 50.0 | **88.90%** | 95.92% | 96.65% | 0.9274 | 4,328.2 ms/step |
| **`test_domain`** | Unseen domains & verticals | 3,826 | 49.8 | **92.08%** | 97.28% | 98.61% | 0.9491 | 2,431.0 ms/step |

### Methodology & Setup

- **Task Formulation:** At each step, the model receives the natural-language task instruction, action history context, and up to **50 candidate DOM elements** (`Avg Candidates β‰ˆ 50.0`) extracted from the page snapshot, and outputs a relevance logit per candidate.
- **Metrics:**
  - **Top-1 / Top-3 / Top-5:** Percentage of steps where a ground-truth target node (`pos_candidates`) appears within the top *k* ranked elements.
  - **Precision / Recall / F1:** Selective Top-1 precision (`TP / (TP + FP)`) and recall (`TP / Total`) across confidence probability thresholds (`--confidence-threshold`, `--thresholds`), plus candidate-level binary precision/recall.
  - **MRR (Mean Reciprocal Rank):** Average reciprocal rank for the highest-ranked ground-truth element across all evaluated steps.
- **Hardware & Runtime:** Latency is measured end-to-end per step on **2 vCPUs** with **no GPU acceleration**, using the exported INT8 quantized ONNX artifact (`onnxruntime`). Variance between `test_website` (`4,328.2 ms/step`) and `test_domain` (`2,431.0 ms/step`) reflects longer tokenized DOM attribute sequences on unseen site templates rather than candidate count.

### Comparison with GPT-6 Luna

For context against a fast, cost-efficient frontier LLM, **GPT-6 Luna** (via OpenAI's Decisions API) scores **81.8%** on **Mind2Web Multimodal** (Google Gemini Decision 1 evaluation, Nov 2026) and **81.2%** on **Mind2Web** in the Decision Index Vision suite (Nace.AI, Nov 2026), with ~326 ms median cloud API latency and ~$0.10 per 1,000 decisions (or $0.10 / $0.50 per 1M input/output tokens in standard API usage).

| Model | Type | Mind2Web Accuracy | Deployment & Runtime | Cost |
| --- | --- | --- | --- | --- |
| **Folate (`folate-int8`)** | Specialized DOM Cross-Encoder (~107 MB) | **88.90% – 93.31%** Top-1 (91.83% overall across 6,037 steps) | 100% local CPU (`onnxruntime`, 180–250 MB RAM) | **$0** (self-hosted) |
| **GPT-6 Luna** | Frontier LLM (Decisions API) | 81.2% – 81.8% (Mind2Web Multimodal / Vision) | Cloud API (~326 ms median latency) | ~$0.10 / 1k decisions |

> **Note:** Folate is evaluated on text-based Mind2Web DOM candidates (50 candidates/step), whereas GPT-6 Luna's 81.2%–81.8% scores are on multimodal/screenshot-based Mind2Web action selection. While GPT-6 Luna is a general-purpose frontier model capable of broad reasoning and multi-step planning, Folate's task-specific ELECTRA cross-encoder achieves higher single-step DOM element grounding accuracy locally on CPU with zero API cost, zero network dependency, and zero selector hallucination.

---

## Examples

Run any of the included live browser examples from the repository root:

```
python examples/test_google.py
python examples/test_amazon.py --offline
python examples/test_github.py
```

---

## Training & Quantization Pipeline

To reproduce data preparation, fine-tuning, INT8 ONNX export, and evaluation from scratch on [`osunlp/Mind2Web`](https://huggingface.co/datasets/osunlp/Mind2Web):

```
python -m pip install -r requirements-train.txt

# 1. Stream and serialize Mind2Web pairs
python scripts/prepare_data.py --output-dir ./data

# 2. Fine-tune ELECTRA cross-encoder
python scripts/train.py --data-dir ./data --save-dir ./folate-base

# 3. Export to FP32 ONNX and quantize to INT8 (~107 MB)
python scripts/export_onnx.py --model-dir ./folate-base --output-dir ./folate-int8

# 4. Evaluate Mind2Web test splits (Precision, Recall, F1, Top-1/3/5 & MRR)
python scripts/eval_mind2web.py --confidence-threshold 0.5 --json-out mind2web_results.json

# 5. Run Playwright DOM-resolved selector Precision & Recall benchmark
python scripts/eval_precision.py --confidence-threshold 0.5 --json-out precision_results.json
```

---

## Intended Use & Limitations

- **Intended Use:** Single-step natural-language UI element grounding (`click`, `type`, `select`, `hover`) in local browser automation pipelines where RAM and CPU budgets are constrained.
- **Limitations:**
  - **No Multi-Step Planning:** Folate ranks candidate elements for a single action query; it does not plan multi-step workflows or parse unstructured page content.
  - **Local DOM Context Only:** Elements are serialized using their own attributes, inner text, and immediate `[PARENT]` tagβ€”identical sibling elements without distinguishing attributes or text cannot be disambiguated visually.

---

## License

Folate is released under the [Apache 2.0 License](https://github.com/figranium/folate/blob/main/LICENSE).
asernasr20
🟧 echo.github ⭐The repository README presents Folate as an original project, describing it as a lightweight, CPU-efficient neural DOM element ranker fine-tFigraniumβ€”β€”

Interpretation history

Decision trace