Run this model with HF Jobs
Run naver-ai/ReadPoint-2B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/naver-ai/ReadPoint-2B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/naver-ai/ReadPoint-2B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/naver-ai/ReadPoint-2B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/naver-ai/ReadPoint-2B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use naver-ai/ReadPoint-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use naver-ai/ReadPoint-2B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
ReadPoint-2B: adapter, read_config.json, fast_read.py, model card
Browse filesFiles changed (5)
- README.mdAdded+100
- adapter_config.jsonAdded+43
- adapter_model.safetensorsAdded+3
- fast_read.pyAdded+187
- read_config.jsonAdded+9
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---license: cc-by-nc-4.0base_model: Qwen/Qwen3.5-2Blibrary_name: peftpipeline_tag: image-text-to-texttags: [pointing, grounding, vision-language, qwen3.5, lora]---
# ReadPoint-2B
A LoRA adapter for [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) that turns it into a fast, self-checking **pointing decisionmodel**. From one image and "Point to <target>." it returns, in one forward pass:
- the **point** and the exact probability of every value 000..999 of x and of y (no sampling, nothing written),- the target's **box** (left, top, right, bottom edges, read the same way),- a **self-check**: P(yes) for "Can you point to it precisely at this image resolution?".
Paper: [Small Vision-Language Models Are Fast Self-Checking Pointing Decision Models](https://arxiv.org/abs/2611.38866) ·[Project page](https://naver-ai.github.io/ReadPoint/) · [Code](https://github.com/naver-ai/ReadPoint) (training, evaluation,agents and the on-device read: coming with the code release)
## Quick start
```bashpip install torch transformers peft pillow flash-linear-attention causal-conv1dpython fast_read.py --adapter naver-ai/ReadPoint-2B --image photo.jpg --target "the red mug" [--all] # --all: also the box and the self-check```
```pythonfrom fast_read import FastReaderfrom PIL import Imagereader = FastReader("naver-ai/ReadPoint-2B")out = reader.read(Image.open("photo.jpg").convert("RGB"), "the red mug", full=True)out["point"] # (x, y), each 0..999 across the image width / heightout["dist"]["x"] # probability of each of the 1,000 values of x (also "y", "x1", "y1", "x2", "y2")out["box"] # (x1, y1, x2, y2), 0..999out["p_yes"] # self-check```
`fast_read.py` (one file) is a minimal version: plain transformers, one forward per read, replayed as a CUDA graph.It gives the same read as the paper's reference reader (same argmax on every answer in fp32). The image preprocessing and thevision encoder run eagerly here, so it is slower than the paper's engine. **To reproduce the paper's numbers, load the model withthe engine in [naver-ai/ReadPoint](https://github.com/naver-ai/ReadPoint)** (GPU resize, vision graph, Raspberry Pi read,evaluation), which comes with the code release.
## Speed (A100, bf16, 384², image preprocessing included)
| | read with `fast_read.py` (one forward) | written with `generate` ||---|---|---|| point (x and y) | 61.8 ms | 167 ms || point + box + self-check | 106.8 ms | |
`generate`: plain transformers, the x and y answers written greedily as one batch. With the paper's engine the read takes40.3 ms, against 83.3 ms for writing the point in vLLM.
## Results (paper)
Mean over the five pointing benchmarks (Point-Bench, ScreenSpot-v2, Where2Place, RoboRefIt, RefCOCO), 384², mean ofthe paper's runs. "writes" = the same base fine-tuned on the same data to write the point.
| | point acc. ↑ | wrong@70% ↓ | AUROC ↑ ||---|---|---|---|| writes | 69.4 | 20.1 | 0.74 || **ReadPoint-2B** | **73.4** | **14.1** | **0.81** |
wrong@70%: error rate on the 70% of images the model is surest about; AUROC: how well its confidence separates right fromwrong points.
## Training
LoRA rank 64 on the language model of Qwen/Qwen3.5-2B (vision encoder frozen), 6,000 steps × 96 examples, half pointing records andhalf multiple-choice questions. Pointing targets are label sets (the box, or a window around a point), plus the four boxedges and the self-check. Training data:
- **Pointing:** PixMo-Points / PixMo-Count, ShowUI (web, desktop), RefCOCO / RefCOCO+ / RefCOCOg (COCO images), RICO Widget Captioning, RoboPoint, Visual Genome regions, WaveUI.- **Multiple choice:** questions from MAmmoTH-VL, COCO, VQAv2, A-OKVQA, TallyQA, DVQA, ChartQA, DocVQA, InfographicVQA, AI2D, TQA, ScienceQA, ScreenQA, VSR, and questions we generated from the pointing records.
Training data is not redistributed; image rights stay with their owners.
## License and intended use
**CC BY-NC 4.0, research use.** Some training sources allow only non-commercial or research use, so these weights arereleased for non-commercial research. The base model Qwen/Qwen3.5-2B is Apache-2.0 (© Alibaba Cloud). `fast_read.py` is releasedwith these weights under the same license; the code release will carry its own license.
The model points at what an instruction names in an image; it can be wrong, and the self-check is a confidence, not aguarantee. Do not use it alone to control a physical system where an error can harm people.
## Citation
```bibtex@article{kim2026readpoint, title = {Small Vision-Language Models Are Fast Self-Checking Pointing Decision Models}, author = {Kim, Geewook}, journal = {arXiv preprint arXiv:2611.38866}, year = {2026}}```12345678910111213141516171819202122232425262728293031323334353637383940414243{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Qwen3_5ForConditionalGeneration", "parent_library": "transformers.models.qwen3_5.modeling_qwen3_5" }, "base_model_name_or_path": "Qwen/Qwen3.5-2B", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 128, "lora_bias": false, "lora_dropout": 0.0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "peft_type": "LORA", "peft_version": "0.19.1", "qalora_group_size": 16, "r": 64, "rank_pattern": {}, "revision": null, "target_modules": ".*language_model.*\\.(q_proj|k_proj|v_proj|o_proj|out_proj|gate_proj|up_proj|down_proj|in_proj_qkv|in_proj_z|in_proj|w1|w2|w3)", "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false}123version https://git-lfs.github.com/spec/v1oid sha256:7299f9ba324937cf1141f1544f8224ee85ea8acce97dffb1caaed90635daeb0fsize 250130664123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187# ReadPoint# Copyright (c) 2026-present NAVER Cloud Corp.# Released with the ReadPoint adapters under their license (CC BY-NC 4.0); the code release will carry its own license."""Minimal ReadPoint inference for Qwen3.5 adapters: ONE forward pass reads the point (and, optionally, the box and the self-check).
Each coordinate answer is three digits, and every digit prefix the model could write is known in advance: per axis thequestion, 10 one-digit prefixes and 100 two-digit prefixes. They are packed with the image and "Point to <target>." into onesequence and run through the model once. Full-attention layers use a tree mask (each token sees only its own path), and theGated-DeltaNet layers continue every branch from its parent's state inside the same layer. The outputs give the exactdistribution over 000..999 for each axis; nothing is sampled or written.
This file is the minimal version (plain transformers + one CUDA graph). The image preprocessing and the vision encoder still runeagerly here, so it is slower than the numbers in the paper. To reproduce the paper, load the model with the engine ofhttps://github.com/naver-ai/ReadPoint (GPU resize, vision graph, Raspberry Pi read, evaluation), which comes with the code release.
pip install torch transformers peft pillow flash-linear-attention causal-conv1d python fast_read.py --image cat.jpg --target "the cat's left ear" [--adapter naver-ai/ReadPoint-0.8B] [--all]"""import argparse, json, os, timeimport numpy as npimport torchimport torch.nn.functional as Ffrom PIL import Image
def _gdn(model): return [m for m in model.modules() if type(m).__name__.endswith("GatedDeltaNet")]
def _run(mod, x, conv, rec, chunk): """Gated-DeltaNet layer on rows x (B, n, d) continuing from conv / recurrent states (the module's own weights and kernels).""" B, n, _ = x.shape mixed = mod.in_proj_qkv(x).transpose(1, 2) z = mod.in_proj_z(x).reshape(B, n, -1, mod.head_v_dim); b, a = mod.in_proj_b(x), mod.in_proj_a(x) K = mod.conv_kernel_size; xe = torch.cat([conv[..., 1:].to(mixed.dtype), mixed], -1); new_conv = xe[..., -K:].contiguous() mixed = F.silu(F.conv1d(xe, mod.conv1d.weight, mod.conv1d.bias, groups=xe.shape[1])).transpose(1, 2) q, k, v = torch.split(mixed, [mod.key_dim, mod.key_dim, mod.value_dim], dim=-1) q, k = q.reshape(B, n, -1, mod.head_k_dim), k.reshape(B, n, -1, mod.head_k_dim); v = v.reshape(B, n, -1, mod.head_v_dim) g = -mod.A_log.float().exp() * F.softplus(a.float() + mod.dt_bias) if mod.num_v_heads > mod.num_k_heads: r = mod.num_v_heads // mod.num_k_heads; q, k = q.repeat_interleave(r, 2), k.repeat_interleave(r, 2) rule = mod.chunk_gated_delta_rule if chunk else mod.recurrent_gated_delta_rule o, last = rule(q, k, v, g=g, beta=b.sigmoid(), initial_state=rec, output_final_state=True, use_qk_l2norm_in_kernel=True) o = mod.norm(o.reshape(-1, mod.head_v_dim), z.reshape(-1, mod.head_v_dim)).reshape(B, n, -1) return mod.out_proj(o), new_conv, last
def _patch(model, plan): """Gated-DeltaNet layers run the packed sequence as a tree: prefix, then each question tail, then the digit nodes.""" for mod in _gdn(model): def fwd(hidden_states, cache_params=None, attention_mask=None, _m=mod, **kw): p = plan; h = hidden_states[0]; out = torch.empty_like(h) conv0 = h.new_zeros(1, _m.conv1d.weight.shape[0], _m.conv_kernel_size) rec0 = h.new_zeros(1, _m.num_v_heads, _m.head_k_dim, _m.head_v_dim, dtype=torch.float32) o, cP, sP = _run(_m, h[None, :p["Lp"]], conv0, rec0, True); out[:p["Lp"]] = o[0] ends_c, ends_s = [None] * len(p["tails"]), [None] * len(p["tails"]) for idx in p["groups"]: # tails of equal length run as one batch s, n = p["tails"][idx[0]]; x = torch.stack([h[p["tails"][i][0]: p["tails"][i][0] + n] for i in idx]) o, c, st = _run(_m, x, cP.expand(len(idx), -1, -1), sP.expand(len(idx), -1, -1, -1), True) for j, i in enumerate(idx): out[p["tails"][i][0]: p["tails"][i][0] + n] = o[j]; ends_c[i], ends_s[i] = c[j], st[j] pc, ps = torch.stack(ends_c), torch.stack(ends_s) for (s, cnt, par) in p["levels"]: # one-token digit nodes, each from its parent's end state o, pc, ps = _run(_m, h[s: s + cnt, None], pc.index_select(0, par), ps.index_select(0, par), False) out[s: s + cnt] = o[:, 0] return out[None] mod.forward = fwd
class FastReader: def __init__(self, adapter="naver-ai/ReadPoint-0.8B", max_pixels=147456, device="cuda", dtype=torch.bfloat16): from transformers import AutoProcessor, AutoModelForImageTextToText from peft import PeftConfig, PeftModel from huggingface_hub import snapshot_download path = adapter if os.path.isdir(adapter) else snapshot_download(adapter) base = PeftConfig.from_pretrained(path).base_model_name_or_path self.dev = device self.proc = AutoProcessor.from_pretrained(base, max_pixels=max_pixels); self.tok = self.proc.tokenizer m = AutoModelForImageTextToText.from_pretrained(base, dtype=dtype, device_map=device, attn_implementation="sdpa") self.model = PeftModel.from_pretrained(m, path).merge_and_unload().eval() self.plan = {}; _patch(self.model, self.plan) self.lm = self.model.model.language_model; self.lm._update_linear_attn_mask = lambda *a, **k: None # avoids a host sync self.graphs = {} if device == "cuda" else None # one CUDA graph per sequence layout: no per-kernel launch cost cfg = json.load(open(os.path.join(path, "read_config.json"))) self.qtext = {n: cfg[n] for n in ("x", "y", "x1", "y1", "x2", "y2", "check")} self.q = {n: self._ids(t) for n, t in self.qtext.items()} self.yes, self.no = self._ids("Yes")[0], self._ids("No")[0] self.D = [self._ids(str(d))[0] for d in range(10)]; self.dig = torch.tensor(self.D, device=device) vocab = self.tok.get_vocab() # an answer may also end after 1 or 2 digits: count those terminators as the reference reader does ends = {i for s, i in vocab.items() if s[:1] in (",", "}")} ends |= {self._ids(s)[0] for s in ("<|im_end|>", "<|endoftext|>", "\n", "\n\n", ".", " .") if len(self._ids(s)) == 1} self.term = torch.tensor(sorted(ends), device=device)
def _ids(self, s): return self.tok(s, add_special_tokens=False)["input_ids"]
def prompt(self, target): t = target.strip().rstrip("."); t = t[len("point to "):] if t.lower().startswith("point to ") else t msgs = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": f"Point to {t}."}]}] text = self.proc.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False, enable_thinking=False) return text[:text.rfind("<|im_end|>")] # the shared prefix: the questions start where the user turn ends
def _lm(self, emb, pos, mask, key): """The language model on the packed sequence; on CUDA, captured once per layout and replayed (same kernels, same output).""" run = lambda e, p, m: self.lm(inputs_embeds=e, position_ids=p, attention_mask=m, use_cache=False).last_hidden_state if self.graphs is None: return run(emb, pos, mask) if key not in self.graphs: st = [emb.clone(), pos.clone(), mask.clone()]; s = torch.cuda.Stream(); s.wait_stream(torch.cuda.current_stream()) with torch.cuda.stream(s): for _ in range(2): run(*st) torch.cuda.current_stream().wait_stream(s); g = torch.cuda.CUDAGraph() with torch.cuda.graph(g): out = run(*st) self.graphs[key] = (g, st, out, dict(self.plan)) # keeps the captured plan tensors alive g, st, out, _ = self.graphs[key] for a, b in zip(st, (emb, pos, mask)): a.copy_(b) g.replay(); return out
@torch.no_grad() def read(self, image, target, full=False): """One forward (full=True also reads the box edges and the self-check, still in the same forward). Sequence = [prefix | tail of each question | 10 one-digit nodes per axis | 100 two-digit nodes per axis].""" names, check = (("x", "y", "x1", "y1", "x2", "y2"), True) if full else (("x", "y"), False) inp = self.proc(text=[self.prompt(target)], images=[image], return_tensors="pt").to(self.dev) P = inp["input_ids"][0]; Lp = len(P); qs = list(names) + (["check"] if check else []) ids, tails, par = [P], [], [] o = Lp for n in qs: tails.append((o, len(self.q[n]))); ids.append(torch.tensor(self.q[n], device=self.dev)); o += len(self.q[n]) s1 = o; n1 = 10 * len(names); ids.append(self.dig.repeat(len(names))); o += n1 s2 = o; n2 = 100 * len(names); ids.append(self.dig.repeat(10 * len(names))); o += n2 ids = torch.cat(ids)[None]; N = ids.shape[1] # tree mask (True = may attend) and positions M = torch.zeros(N, N, dtype=torch.bool, device=self.dev); M[:Lp, :Lp] = torch.ones(Lp, Lp, device=self.dev).tril().bool() pos3, _ = self.model.model.get_rope_index(inp["input_ids"], inp["mm_token_type_ids"], image_grid_thw=inp["image_grid_thw"]) base = int(pos3.max()) + 1; tp = torch.zeros(N, dtype=torch.long, device=self.dev) for (s, n) in tails: M[s:s + n, :Lp] = True; M[s:s + n, s:s + n] = torch.ones(n, n, device=self.dev).tril().bool(); tp[s:s + n] = base + torch.arange(n, device=self.dev) par1 = torch.arange(len(names), device=self.dev).repeat_interleave(10) # node1 -> its tail last = torch.tensor([s + n - 1 for s, n in tails[:len(names)]], device=self.dev) r1 = s1 + torch.arange(n1, device=self.dev); M[r1] = M[last[par1]]; M[r1, r1] = True; tp[r1] = tp[last[par1]] + 1 par2 = torch.arange(n1, device=self.dev).repeat_interleave(10) # node2 -> its node1 r2 = s2 + torch.arange(n2, device=self.dev); M[r2] = M[r1[par2]]; M[r2, r2] = True; tp[r2] = tp[r1[par2]] + 1 pos = tp[None, None].repeat(3, 1, 1); pos[:, :, :Lp] = pos3 mm = torch.zeros_like(ids); mm[:, :Lp] = inp["mm_token_type_ids"] lens = sorted({n for _, n in tails}); groups = [[i for i, (_, n) in enumerate(tails) if n == L] for L in lens] self.plan.clear(); self.plan.update(Lp=Lp, tails=tails, groups=groups, levels=[(s1, n1, par1), (s2, n2, par2)]) emb = self.model.model.get_input_embeddings()(ids) img = self.model.model.get_image_features(inp["pixel_values"], inp["image_grid_thw"]).pooler_output emb = emb.masked_scatter((ids == self.model.config.image_token_id)[..., None], torch.cat(img).to(emb.dtype)) h = self._lm(emb, pos, M[None, None], (Lp, tuple(tails)))[0] out = {} for i, name in enumerate(names): rows = torch.cat([last[i:i + 1], r1[10 * i: 10 * i + 10], r2[100 * i: 100 * i + 100]]) Pr = torch.softmax(self.model.lm_head(h[rows]).float(), -1) root, Q1, Q2 = Pr[0], Pr[1:11], Pr[11:] # after the question / after the 1st digit / after 2 digits r = root[self.dig] / root[self.dig].sum() def split(p): d, e = p[:, self.dig], p[:, self.term].sum(-1); z = d.sum(-1) + e; return d / z[:, None], e / z g1, t1 = split(Q1); g2, t2 = split(Q2) m = torch.zeros(1000, device=self.dev, dtype=torch.float64); two = (r[:, None] * g1).reshape(-1) m[:10] += (r * t1).double(); m[:100] += (two * t2).double(); m += (two[:, None] * g2).reshape(-1).double() out[name] = (m / m.sum()).cpu().numpy() res = {"dist": out, "point": (int(out["x"].argmax()), int(out["y"].argmax())), "passes": 1} if "x1" in out: res["box"] = tuple(int(out[e].argmax()) for e in ("x1", "y1", "x2", "y2")) if check: pc = torch.softmax(self.model.lm_head(h[tails[-1][0] + tails[-1][1] - 1]).float(), -1) res["p_yes"] = float(pc[self.yes] / (pc[self.yes] + pc[self.no])) return res
def main(): ap = argparse.ArgumentParser() ap.add_argument("--image", required=True); ap.add_argument("--target", required=True) ap.add_argument("--adapter", default="naver-ai/ReadPoint-0.8B"); ap.add_argument("--max-pixels", type=int, default=147456) ap.add_argument("--all", action="store_true", help="also read the box and the self-check (still one forward)") ap.add_argument("--repeat", type=int, default=20) a = ap.parse_args() R = FastReader(a.adapter, a.max_pixels); img = Image.open(a.image).convert("RGB"); W, H = img.size def timed(f): f(); f(); ts = [] for _ in range(a.repeat): torch.cuda.synchronize(); t = time.perf_counter(); out = f(); torch.cuda.synchronize(); ts.append(1000 * (time.perf_counter() - t)) return out, float(np.median(ts)) res, ms = timed(lambda: R.read(img, a.target, full=a.all)) x, y = res["point"] print(f"point ({x:03d}, {y:03d}) /1000 = ({x * W / 1000:.0f}, {y * H / 1000:.0f}) px") if a.all: print(f"box {tuple(res['box'])} /1000"); print(f"P(yes) {res['p_yes']:.3f} (self-check: can it point precisely at this resolution?)") print(f"read {ms:.1f} ms (one forward, image included; full distributions over 000..999)")
if __name__ == "__main__": main()123456789{ "x": " What is the x coordinate of its center? Answer with a three-digit number from 000 (left edge) to 999 (right edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "y": " What is the y coordinate of its center? Answer with a three-digit number from 000 (top edge) to 999 (bottom edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "x1": " What is the x coordinate of its left edge? Answer with a three-digit number from 000 (left edge) to 999 (right edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "y1": " What is the y coordinate of its top edge? Answer with a three-digit number from 000 (top edge) to 999 (bottom edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "x2": " What is the x coordinate of its right edge? Answer with a three-digit number from 000 (left edge) to 999 (right edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "y2": " What is the y coordinate of its bottom edge? Answer with a three-digit number from 000 (top edge) to 999 (bottom edge) of the image.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: ", "check": " Can you point to it precisely at this image resolution? Answer yes or no.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nAnswer: "}README.mdAdded+100
adapter_config.jsonAdded+43
adapter_model.safetensorsAdded+3
fast_read.pyAdded+187
read_config.jsonAdded+9