Lune

ICML2025Top-tier venue

ConText: Driving In-context Learning for Text Removal and Segmentation

Fei Zhang, Pei Zhang, Baosong Yang, Fei Huang, Yanfeng Wang, Ya Zhang

Abstract

This paper presents the first study on adapting the visual in-context learning (V-ICL) paradigm to optical character recognition tasks, specifically focusing on text removal and segmentation. Most existing V-ICL generalists employ a reasoningas-reconstruction approach: they turn to using a straightforward image-label compositor as the prompt and query input, and then masking the query label to generate the desired output. This direct prompt confines the model to a challenging single-step reasoning process. To address this, we propose a task-chaining compositor in the form of image-removal-segmentation, providing an enhanced prompt that elicits reasoning with enriched intermediates. Additionally, we introduce context-aware aggregation, integrating the chained prompt pattern into the latent query representation, thereby strengthening the model's in-context reasoning. We also consider the issue of visual heterogeneity, which complicates the selection of homogeneous demonstrations in text recognition. Accordingly, this is effectively addressed through a simple self-prompting strategy, preventing the model's in-context learnability from devolving into specialist-like, contextfree inference. Collectively, these insights culminate in our ConText model, which achieves new state-of-the-art across both in-and out-of-domain benchmarks. The code is available at https: //github.com/Ferenas/ConText .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Segment Anything cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Segment Anything cites Language Models are Few-Shot Learners
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • EgoHandICL: Egocentric 3D Hand Reconstruction with In-Context Learning cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • EgoHandICL: Egocentric 3D Hand Reconstruction with In-Context Learning cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. EgoHandICL: Egocentric 3D Hand Reconstruction with In-Context LearningBinzhu Xie, Shi Qiu, Sicheng Zhang, Yinqiao Wang et al.ICLR 2026 · 4 citations

Builds on38

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  3. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  4. Segment AnythingAlexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao et al.ICCV 2023 · 13,211 citations
  5. High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser et al.CVPR 2022 · 13,123 citations

Related papers

  1. CDICS: Delving Into Fine-Grained Attribute for In-Context Segmentation via Compositional Prompts and Phased DecouplingZhiyu Li, Dianmo Sheng, Qi Chu, Shilong Chen et al.CVPR 2026
  2. Towards Global Optimal Visual In-Context Learning Prompt SelectionChengming Xu, Chen Liu, Yikai Wang, Yuan Yao et al.NeurIPS 2024 · 19 citations
  3. OLIVE: Object Level In-Context Visual EmbeddingsTimothy Ossowski, Junjie HuACL 2024
  4. UPOCR: Towards Unified Pixel-Level OCR InterfaceDezhi Peng, Zhenhua Yang, Jiaxin Zhang, Chongyu Liu et al.ICML 2024 · 14 citations
  5. Towards More Unified In-Context Visual UnderstandingDianmo Sheng, Dongdong Chen, Zhentao Tan, Qiankun Liu et al.CVPR 2024 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines