Abstract — 摘要
We present VisProg, a neuro-symbolic approach to solving complex and compositional visual tasks given natural language instructions. VisProg avoids the need for any task-specific training. Instead, it uses the in-context learning ability of large language models to generate Python-like modular programs, which are then executed to get both the solution and a comprehensive and interpretable visual rationale. Each line of the generated program may invoke one of several off-the-shelf computer vision models, image processing routines, or Python functions to produce intermediate outputs that may be consumed by subsequent steps. We demonstrate the flexibility of VisProg on four diverse tasks — compositional visual question answering, zero-shot reasoning on image pairs, factual knowledge object tagging, and language-guided image editing.
本文提出 VisProg,一種神經符號式方法,用於根據自然語言指令解決複雜的組合式視覺任務。VisProg 無需任何特定任務的訓練。取而代之的是,它利用大型語言模型的情境學習能力來產生類似 Python 的模組化程式,然後執行這些程式以獲得解答以及全面且可解釋的視覺推理依據。產生之程式的每一行都可呼叫若干現成的電腦視覺模型、影像處理例程或 Python 函式之一,以產出中間輸出供後續步驟使用。我們在四項多元任務上展示了 VisProg 的靈活性——組合式視覺問答、影像對的零樣本推理、事實知識物件標記,以及語言引導的影像編輯。
段落功能
全文總覽——以遞進方式從「複雜視覺任務」到「無需訓練」再到「程式化執行」,最終列舉四項應用場景。
邏輯角色
摘要承擔「問題定義與解決方案預告」的雙重功能:先界定組合式視覺推理的難題,再以一句話概述 VisProg 如何透過程式產生與執行回應該問題,並以四項任務展現其通用性。
論證技巧 / 潛在漏洞
「無需任何特定任務訓練」的主張極具吸引力,但需注意 VisProg 依賴的各個子模組(如 ViLT、CLIP、Stable Diffusion)本身皆經過大規模訓練。此處的「無需訓練」是就整合層面而言,而非全系統層面。此外,情境學習本身依賴精心設計的提示範例,這在某種程度上是一種隱性的「工程式訓練」。
1. Introduction — 緒論
The dominant paradigm in contemporary AI involves building end-to-end trainable models that undergo extensive unsupervised pretraining followed by supervised multitask training. However, this approach demands carefully curated datasets for each task, making it challenging to scale to the "long tail" of complex, compositional tasks. In this work, we investigate an alternative: leveraging large language models to decompose natural language task descriptions into simpler steps that can be executed by specialized models or programs.
當代人工智慧的主流範式是建構端對端可訓練模型,先進行大規模的非監督式預訓練,再接以監督式多任務訓練。然而,此方法需要為每項任務精心策劃資料集,使其難以擴展至複雜組合式任務的「長尾」分布。本研究探索另一條路徑:利用大型語言模型將自然語言任務描述分解為更簡單的步驟,再由專業化模型或程式加以執行。
段落功能
建立研究場域——指出端對端範式的成就與其在組合式任務上的根本性侷限。
邏輯角色
論證鏈的起點:先肯定主流範式的成功,再以「長尾分布」的概念揭示其盲點,為程式化分解的替代方案鋪路。
論證技巧 / 潛在漏洞
「長尾」一詞借用自分布統計學,具有直覺性的說服力。但作者未提供量化證據說明「長尾」究竟有多長——亦即端對端方法在哪些具體的組合式任務上確實失敗。此處的動機論證偏向定性。
VisProg accepts visual data along with a natural language instruction, generates a sequence of computational steps (a visual program), and executes these steps to produce the desired output. Each line of the program invokes a module from a library of pre-existing computer vision models, language models, image processing routines from OpenCV, or arithmetic/logical operators. Modules consume outputs from preceding lines and produce intermediate results for subsequent consumption. This design enables VisProg to flexibly compose diverse capabilities without requiring any task-specific training or fine-tuning.
VisProg 接受視覺資料與自然語言指令,產生一系列計算步驟(即視覺程式),然後執行這些步驟以產出期望的輸出。程式的每一行呼叫一個來自模組庫的模組,涵蓋現有的電腦視覺模型、語言模型、OpenCV 影像處理例程,或算術邏輯運算子。模組消耗前序行的輸出,並產出供後續步驟使用的中間結果。此設計使 VisProg 能夠靈活地組合多元能力,無需任何特定任務的訓練或微調。
段落功能
提出核心方案——概述 VisProg 的輸入-產生-執行管線。
邏輯角色
承接上段的問題陳述,此段扮演「轉折」角色:從「端對端方法不足」過渡到「程式化組合方案」。模組庫的多樣性(CV 模型、LM、OpenCV、Python 運算子)直接回應「長尾任務」的多元需求。
論證技巧 / 潛在漏洞
將系統描述為「模組庫 + 直譯器」的架構,使技術門檻看似很低。但隱藏的複雜度在於:如何確保 LLM 產生的程式語法正確、語意合理、且所呼叫的模組確實能處理該子任務?程式產生的品質高度依賴提示範例的設計。
The system improves upon previous approaches like Neural Module Networks (NMN) in several key ways: it employs GPT-3 for program generation without requiring training, uses higher-level abstractions, and invokes state-of-the-art pre-trained models alongside non-neural Python subroutines. VisProg also exhibits strong interpretability through readable programs that allow users to verify logical correctness and inspect intermediate step outputs for diagnosis and intervention. Key contributions include: (i) a system utilizing large language model in-context learning for visual program generation from natural language instructions; (ii) demonstration of flexibility on complex visual tasks including factual knowledge object tagging and language-guided image editing; and (iii) generation of visual rationales showing utility for error analysis and instruction tuning.
本系統在幾個關鍵面向上改進了先前的神經模組網路(NMN)等方法:它使用 GPT-3 進行程式產生而無需訓練,採用更高階的抽象層次,並同時呼叫最先進的預訓練模型與非神經的 Python 子程式。VisProg 還透過可讀的程式展現出強大的可解釋性,允許使用者驗證邏輯正確性並檢查中間步驟輸出以進行診斷與介入。主要貢獻包括:(i) 利用大型語言模型的情境學習,從自然語言指令產生視覺程式的系統;(ii) 在複雜視覺任務上展示靈活性,包括事實知識物件標記與語言引導的影像編輯;(iii) 產生視覺推理依據,展現其在錯誤分析與指令調校方面的實用價值。
段落功能
差異化定位——明確區分 VisProg 與 NMN 的關鍵差異,並列舉三項貢獻。
邏輯角色
此段在論證鏈中扮演「比較論證」角色:透過與 NMN 的對比,突顯 VisProg 的三大優勢(無需訓練、高階抽象、可解釋性),使讀者理解其相對於既有方法的增量貢獻。
論證技巧 / 潛在漏洞
三項貢獻的列舉結構清晰,但第三項「視覺推理依據」的貢獻程度相對模糊——它更像是系統的附帶產物而非獨立的技術突破。此外,與 NMN 的比較可能有些不公平,因為 NMN 設計於 GPT-3 出現之前,技術基礎截然不同。
2. Related Work — 相關工作
Neural Module Networks pioneered modular, compositional approaches for visual question answering by composing neural modules into differentiable networks. Early attempts employed off-the-shelf parsers, while recent methods learn layout generation jointly with neural modules using reinforcement learning and weak answer supervision. VisProg differentiates itself by generating high-level programs invoking trained state-of-the-art neural models and Python functions at intermediate steps, enabling incorporation of symbolic, non-differentiable modules. It leverages large language models' in-context learning to generate programs via prompting with natural language instructions and similar examples, eliminating the need for specialized task-specific program generators.
神經模組網路率先提出模組化、組合式的視覺問答方法,將神經模組組合為可微分的網路。早期嘗試採用現成的語法分析器,而近期方法則以強化學習和弱答案監督聯合學習版面產生與神經模組。VisProg 的差異化在於產生高階程式,在中間步驟呼叫經訓練的最先進神經模型與 Python 函式,從而能夠納入符號式、不可微分的模組。它利用大型語言模型的情境學習,透過自然語言指令與相似範例的提示來產生程式,消除了對特定任務程式產生器的需求。
段落功能
文獻回顧——將 VisProg 置於神經模組網路的學術脈絡中。
邏輯角色
建立學術譜系:NMN -> 可微分組合 -> VisProg 的非可微分組合。關鍵轉折在於「符號式、不可微分」——這是 VisProg 相對於 NMN 系列的根本性範式轉移。
論證技巧 / 潛在漏洞
將 NMN 的「可微分組合」與 VisProg 的「不可微分組合」對立,使後者看似更靈活。但不可微分也意味著無法端對端最佳化——當程式邏輯正確但子模組輸出有誤時,系統缺乏自動校正機制。作者未討論此權衡。
Recent work applies LLMs and in-context learning to visual tasks. PICa utilizes LLMs for knowledge-based VQA by representing visual information as text (captions, objects, attributes) and feeding textual representations to GPT-3 alongside questions and in-context examples. Socratic Models compose pre-trained models from different modalities (language, vision-language, audio-language) for zero-shot tasks including image captioning and video-to-text retrieval. Unlike Socratic Models where composition is task-predetermined, VisProg determines per-instance model composition through program generation based on instructions. ProgPrompt, a concurrent work, demonstrates LLM capability for generating Python-like robot action plans from natural language, though VisProg programs accommodate more general inputs including strings, numbers, expressions, and arbitrary Python objects.
近期研究將大型語言模型與情境學習應用於視覺任務。PICa 透過將視覺資訊表示為文字(圖說、物件、屬性),並將文字表示與問題及情境範例一併輸入 GPT-3,來處理基於知識的視覺問答。蘇格拉底模型組合來自不同模態(語言、視覺-語言、聽覺-語言)的預訓練模型,用於零樣本任務,包括影像圖說生成與影片至文字檢索。與蘇格拉底模型的組合方式為任務預定不同,VisProg 透過基於指令的程式產生來決定逐實例的模型組合。ProgPrompt 是一項同期研究,展示了 LLM 從自然語言產生類 Python 機器人行動計畫的能力,但 VisProg 的程式能容納更通用的輸入,包括字串、數值、表達式,以及任意的 Python 物件。
段落功能
文獻定位——將 VisProg 放置於 LLM 應用於視覺的快速發展脈絡中。
邏輯角色
此段以「組合的靈活度」為軸心進行比較:PICa 僅做文字轉換、蘇格拉底模型是任務級預定組合、ProgPrompt 限於機器人動作。VisProg 的「逐實例動態組合」被定位為最靈活的方案。
論證技巧 / 潛在漏洞
以三個層次遞進的比較對象(PICa < Socratic < ProgPrompt < VisProg)巧妙地建構了 VisProg 的優越定位。但「逐實例組合」的靈活性是把雙面刃——它也意味著更高的錯誤率,因為每次都由 LLM 即時決定組合方式。
A growing literature explores LLM-based language reasoning through prompting. Chain-of-Thought (CoT) prompting demonstrates impressive capabilities for math reasoning by prompting models with input-rationale-output examples. While CoT relies on LLMs generating and executing reasoning paths internally, VisProg similarly employs decomposition approaches where initial decomposition generates sub-tasks handled by specialized sub-task processors. The key distinction is that VisProg externalizes execution to dedicated vision modules rather than relying on the LLM's own reasoning capacity for perceptual tasks.
基於提示的大型語言模型推理研究正快速成長。思維鏈(CoT)提示透過向模型提供「輸入-推理過程-輸出」的範例,在數學推理方面展現出令人印象深刻的能力。CoT 依賴 LLM 在內部產生並執行推理路徑,而 VisProg 同樣採用分解策略——先進行初始分解以產生子任務,再由專業化的子任務處理器加以處理。關鍵差異在於,VisProg 將執行外部化至專門的視覺模組,而非依賴 LLM 本身的推理能力來處理感知任務。
段落功能
區分推理範式——將 VisProg 的「外部化執行」與 CoT 的「內部化推理」對比。
邏輯角色
此段完成相關工作的最後一塊拼圖:VisProg 不僅與視覺方法不同(比 NMN 更靈活),也與純語言推理方法不同(比 CoT 更接地)。「外部化執行」是核心論點的重要支撐。
論證技巧 / 潛在漏洞
「外部化執行」的論點精準地擊中了 LLM 的弱點——語言模型在感知推理上的可靠性遠不及專門的視覺模型。但此論點也暗示 VisProg 的上限受制於子模組的能力。若底層視覺模型不夠好,再精妙的程式也無法產出正確答案。
3. Visual Programming — 視覺程式設計
3.1 Large Language Models for Visual Programming — 以大型語言模型進行視覺程式設計
VisProg exploits GPT-3's remarkable generalization ability from limited input-output demonstrations. Following the translation paradigm, VisProg prompts GPT-3 with instruction-program pairs, enabling visual program generation for novel natural language instructions without fine-tuning. In-context examples feature manually written, high-level programs constructed independently of accompanying images. Each program step comprises a module name, input argument names with values, and an output variable name. Programs typically employ output variables from prior steps as inputs for subsequent steps.
VisProg 利用 GPT-3 從有限的輸入-輸出示範中進行卓越泛化的能力。遵循翻譯範式,VisProg 以指令-程式配對作為提示輸入 GPT-3,使其能夠為新穎的自然語言指令產生視覺程式,無需微調。情境範例中的程式為手動撰寫的高階程式,獨立於對應影像而構建。每個程式步驟包含一個模組名稱、輸入引數名稱及其值,以及一個輸出變數名稱。程式通常將前序步驟的輸出變數作為後續步驟的輸入。
段落功能
方法推導第一步——描述如何利用 GPT-3 的情境學習來產生視覺程式。
邏輯角色
這是整個方法的基礎設施。「指令-程式配對」的提示設計將自然語言理解問題轉化為序列到序列的翻譯問題,巧妙地利用了 LLM 最擅長的能力。
論證技巧 / 潛在漏洞
「獨立於影像而構建」是一個重要的設計選擇——意味著提示範例的程式是純語言層面的模板,不依賴特定影像內容。這大幅簡化了提示設計,但也意味著 LLM 在產生程式時無法「看到」影像,所有視覺感知都被推遲到執行階段。
The system uses descriptive naming conventions — module names like "Select" or "ColorPop," argument names like "image" or "query," and variable names like "IMAGE" or "OBJ" — enabling GPT-3 to comprehend input-output types and module functions purely from naming. During execution, output variables store arbitrary data types — for instance, "OBJ" instances contain lists of image objects with associated masks, bounding boxes, and text categories. This flexible type system allows modules to pass rich, structured intermediate representations between steps.
系統採用描述性的命名慣例——模組名稱如「Select」或「ColorPop」,引數名稱如「image」或「query」,變數名稱如「IMAGE」或「OBJ」——使 GPT-3 僅從命名即可理解輸入輸出型別與模組功能。在執行期間,輸出變數儲存任意資料型別——例如「OBJ」實例包含影像物件的清單,附帶遮罩、邊界框與文字類別。這種靈活的型別系統允許模組在步驟之間傳遞豐富的結構化中間表示。
段落功能
設計細節——解釋命名慣例如何使 LLM 在無需形式化型別系統的情況下理解模組語意。
邏輯角色
此段回答了一個潛在的懷疑:「LLM 如何知道要呼叫哪個模組、傳什麼引數?」答案是透過語意透明的命名——這是一種將程式語言設計原則應用於提示工程的巧思。
論證技巧 / 潛在漏洞
依賴命名慣例而非形式化規範是一個優雅但脆弱的設計。它在 GPT-3 的語意理解能力範圍內運作良好,但若模組數量大幅增長或出現語意相近的模組名稱,可能導致 LLM 產生錯誤的呼叫。此外,「任意資料型別」缺乏型別檢查,增加了執行期錯誤的風險。
3.2 Modules — 模組
VisProg currently supports 20 modules enabling image understanding, image manipulation including generation, knowledge retrieval, and arithmetic-logical operations. Each module implements a Python class with three core methods: (i) parse — extracting input argument names, values, and output variable names from a program line; (ii) execute — performing necessary computations involving trained neural models while updating the program state; and (iii) html — visually summarizing step computations via HTML for visual rationale creation. Adding new modules requires only implementing and registering a module class; the VisProg interpreter automatically handles program execution.
VisProg 目前支援 20 個模組,涵蓋影像理解、包含生成在內的影像操作、知識檢索,以及算術邏輯運算。每個模組實作為一個 Python 類別,包含三個核心方法:(i) parse——從程式行中提取輸入引數名稱、值與輸出變數名稱;(ii) execute——執行涉及已訓練神經模型的必要計算,同時更新程式狀態;(iii) html——透過 HTML 視覺化摘要步驟計算,用於建立視覺推理依據。新增模組僅需實作並註冊一個模組類別;VisProg 直譯器即自動處理程式執行。
段落功能
技術規格——定義模組的三方法介面與擴展機制。
邏輯角色
此段是系統架構的核心規範。三方法介面(parse/execute/html)定義了明確的模組契約,使系統具備開放式的擴展能力——這是 VisProg 宣稱「靈活性」的技術基礎。
論證技巧 / 潛在漏洞
「僅需實作並註冊」的說法使擴展看似輕而易舉,但實際上新增模組還需更新提示範例以讓 LLM 知道新模組的存在與用法。此外,20 個模組的覆蓋範圍是否足以處理「長尾」任務,仍是一個開放問題。
The module library spans two broad categories. Neural modules leverage state-of-the-art pre-trained models: OWL-ViT for open-vocabulary object localization, DSFD for face detection, MaskFormer for semantic segmentation, CLIP for zero-shot image classification, ViLT for visual question answering, and Stable Diffusion for image generation and inpainting. Non-neural modules include image processing subroutines from OpenCV (cropping, overlaying, color manipulation), arithmetic and logical Python operators (counting, comparison, expression evaluation), and knowledge retrieval via GPT-3 prompting. This hybrid design ensures that each sub-task is handled by the most appropriate tool — neural models for perception, symbolic routines for precise computation.
模組庫涵蓋兩大類別。神經模組利用最先進的預訓練模型:OWL-ViT 用於開放詞彙物件定位、DSFD 用於人臉偵測、MaskFormer 用於語意分割、CLIP 用於零樣本影像分類、ViLT 用於視覺問答,以及 Stable Diffusion 用於影像生成與修復。非神經模組包括來自 OpenCV 的影像處理子程式(裁切、疊加、色彩操作)、算術與邏輯 Python 運算子(計數、比較、表達式求值),以及透過 GPT-3 提示進行知識檢索。此混合設計確保每個子任務由最適當的工具處理——神經模型負責感知,符號例程負責精確計算。
段落功能
列舉技術堆疊——展示模組庫的具體組成與所覆蓋的能力範圍。
邏輯角色
此段為系統的「能力宣言」:透過列舉六個神經模型與三類非神經工具,展示 VisProg 的感知-計算-知識三位一體架構。「最適當的工具」原則是神經符號式方法的核心哲學。
論證技巧 / 潛在漏洞
列舉知名模型(OWL-ViT、CLIP、Stable Diffusion 等)增強了讀者對系統能力的信心。但這也暴露了對特定模型的依賴——若這些模型被更新或替換,提示範例和模組介面可能需要同步修改。系統的穩健性與底層模型的版本耦合度值得關注。
3.3 Program Execution and Visual Rationale — 程式執行與視覺推理依據
An interpreter manages program execution by initializing program state (a dictionary mapping variable names to values) with inputs, then stepping through the program line-by-line while invoking appropriate modules with specified inputs. Following each step execution, the program state updates with the step's output name and value. This sequential execution model ensures that each module has access to all previously computed results, enabling complex multi-step reasoning chains where later steps build upon earlier computations.
一個直譯器負責管理程式執行,它以輸入初始化程式狀態(一個將變數名稱映射至值的字典),然後逐行遍歷程式,同時以指定的輸入呼叫對應的模組。每個步驟執行完畢後,程式狀態會以該步驟的輸出名稱和值進行更新。此循序執行模型確保每個模組都能存取所有先前計算的結果,從而支援複雜的多步驟推理鏈,讓後續步驟得以建構在先前的計算之上。
段落功能
執行機制——描述直譯器的狀態管理與逐行執行流程。
邏輯角色
此段將系統從「程式產生」推進到「程式執行」。字典式狀態管理是經典的直譯器設計模式,讀者熟悉其語意,降低了理解門檻。
論證技巧 / 潛在漏洞
循序逐行執行是最簡單的執行模型,但也最缺乏容錯能力——若某一行出錯,後續所有依賴該輸出的行都會失敗。作者未討論錯誤處理機制(如 try-catch、回退策略),這在實際部署中可能是一個顯著的工程障礙。
Beyond computation, each module class implements an HTML method summarizing module inputs and outputs. The interpreter concatenates HTML summaries from all program steps into a visual rationale enabling analysis of logical program correctness and inspection of intermediate outputs. Visual rationales facilitate understanding failure reasons and minimal instruction tweaking for performance improvement. This transparency is a fundamental advantage over end-to-end neural approaches that operate as opaque black boxes, offering users a concrete mechanism for diagnosis, debugging, and iterative refinement.
除了計算之外,每個模組類別還實作了一個 HTML 方法,用於摘要模組的輸入與輸出。直譯器將所有程式步驟的 HTML 摘要串接成一份視覺推理依據,使使用者能夠分析程式的邏輯正確性並檢查中間輸出。視覺推理依據有助於理解失敗原因,並以最小幅度的指令調校來改善效能。相較於作為不透明黑箱運作的端對端神經方法,這種透明性是一項根本性的優勢,為使用者提供了診斷、除錯與迭代改進的具體機制。
段落功能
可解釋性論證——闡述視覺推理依據的機制與價值主張。
邏輯角色
此段回應摘要中的第三項貢獻。「透明性」的論點不僅是技術特性,更是對端對端範式的哲學批判——在 AI 可解釋性日益受重視的背景下,此優勢具有高度的時代契合性。
論證技巧 / 潛在漏洞
將端對端方法貶為「不透明黑箱」是有效的修辭策略,但過於簡化——近年來的可解釋性研究(如注意力視覺化、LIME、SHAP)已為神經模型提供了多種解釋工具。VisProg 的可解釋性確實更直覺,但並非唯一能提供解釋的範式。
4. Tasks — 任務
4.1 Compositional Visual Question Answering — 組合式視覺問答
VisProg demonstrates compositional suitability for the GQA multi-step visual question answering task. Task modules include open vocabulary localization, VQA functionality, image region cropping using bounding box coordinates or spatial prepositions ("above," "left"), box counting, and Python expression evaluation. For example, addressing "Is the small truck to the left or to the right of the people that are wearing helmets?" involves localizing helmet-wearing individuals, cropping left and right regions, checking for small trucks, and returning the appropriate direction. The evaluation creates a GQA subset by randomly sampling approximately 100 diverse question types from balanced validation and test-dev sets.
VisProg 在 GQA 多步驟視覺問答任務上展示了其組合式能力的適用性。任務模組包括開放詞彙定位、視覺問答功能、使用邊界框座標或空間介系詞(「上方」、「左側」)進行影像區域裁切、邊界框計數,以及 Python 表達式求值。例如,回答「小型卡車在戴安全帽的人的左邊還是右邊?」需要定位戴安全帽的人、裁切左右區域、檢查是否有小型卡車,並回傳適當的方向。評估方式為從平衡驗證集和測試開發集中隨機取樣約 100 種多元問題類型,建構 GQA 子集。
段落功能
任務示範——以 GQA 為例展示 VisProg 如何將複雜問題分解為可執行步驟。
邏輯角色
此段從抽象的方法描述過渡到具體的任務應用。卡車定位的範例使讀者能夠直覺地理解「視覺程式」的運作方式:複雜的空間推理被分解為定位、裁切、偵測、回傳四個步驟。
論證技巧 / 潛在漏洞
具體範例極具說服力,但所選範例可能偏向 VisProg 的優勢場景。「隨機取樣約 100 種問題類型」的評估方式也相對粗略——相比 GQA 完整的數十萬筆測試集,此子集的代表性可能不足。
Zero-shot reasoning on image pairs demonstrates VisProg's ability to solve multi-image tasks using single-image VQA systems without multi-image training. Applied to NLVRv2 (Natural Language Visual Reasoning on image pairs), the system decomposes complex statements into simpler single-image questions and Python expressions involving arithmetic-logical operators. For example, verifying "Both images contain exactly one dog" requires asking each image "How many dogs are in this image?" and evaluating whether both answers equal one. The approach achieves statement verification through image-level question answering using ViLT-vqa and expression evaluation using Python operators.
影像對的零樣本推理展示了 VisProg 使用單影像視覺問答系統解決多影像任務的能力,無需多影像訓練。應用於 NLVRv2(影像對的自然語言視覺推理),系統將複雜陳述分解為更簡單的單影像問題與涉及算術邏輯運算子的 Python 表達式。例如,驗證「兩張影像都恰好包含一隻狗」需要分別詢問每張影像「這張影像中有幾隻狗?」並求值兩個答案是否都等於一。此方法透過使用 ViLT-vqa 的影像層級問答與使用 Python 運算子的表達式求值來實現陳述驗證。
段落功能
跨影像推理——展示 VisProg 如何將多影像問題歸約為單影像子問題。
邏輯角色
此段展現了 VisProg 的「零樣本遷移」能力:透過程式化分解,單影像模型可以解決多影像推理任務。這是「組合式方法」相對於「端對端方法」的獨特優勢。
論證技巧 / 潛在漏洞
「零樣本」的說法引人注目,但嚴格而言,ViLT-vqa 是在 VQAv2 上訓練過的,只是未在 NLVRv2 上訓練。此外,將多影像推理分解為獨立的單影像問答,可能無法處理需要跨影像比較(如「左邊那張影像的狗比右邊那張大」)的細微推理。
Factual knowledge object tagging involves identifying image objects whose names require external knowledge — celebrities, politicians, TV show characters, flags, corporate logos, organism species, etc. VisProg leverages GPT-3 as an implicit knowledge base queried through natural language prompts (e.g., "List the main characters on the TV show Big Bang Theory separated by commas"). Generated category lists feed into CLIP image classification modules applied to localization and face detection results. For language-guided image editing, VisProg handles complex instructions like "Hide the face of Daniel Craig with an emoji" (de-identification), "Create a color pop of Daniel Craig and blur the background" (object highlighting), and "Replace Barack Obama with Barack Obama wearing sunglasses" (object replacement requiring identification, masking, and inpainting).
事實知識物件標記涉及辨識影像中名稱需要外部知識的物件——名人、政治人物、電視劇角色、旗幟、企業標誌、生物物種等。VisProg 將 GPT-3 作為透過自然語言提示查詢的隱式知識庫(例如「列出電視劇乘風破浪的主要角色,以逗號分隔」)。產生的類別清單輸入至 CLIP 影像分類模組,應用於定位與人臉偵測結果。在語言引導的影像編輯方面,VisProg 處理複雜指令,如「用表情符號遮蔽丹尼爾乘克雷格的臉」(去識別化)、「將丹尼爾乘克雷格做色彩突出處理並模糊背景」(物件突顯),以及「將歐巴馬替換為戴太陽眼鏡的歐巴馬」(需要辨識、遮罩與修復的物件替換)。
段落功能
展示應用廣度——以知識標記與影像編輯兩項新穎任務突顯系統的多功能性。
邏輯角色
此段在論證鏈中扮演「廣度論證」角色:前兩項任務(GQA、NLVRv2)證明了組合式問答能力,此段進一步擴展到知識檢索與影像操作,展示 VisProg 的通用性遠超純推理場景。
論證技巧 / 潛在漏洞
將 GPT-3 作為「隱式知識庫」是一個創造性的應用,但 GPT-3 的知識可能過時或含有錯誤。影像編輯範例選擇了具備視覺吸引力的場景(名人去識別化等),但這些範例的數量有限(107 條指令),評估的統計穩健性可能不足。
5. Experiments and Analysis — 實驗與分析
5.1 Effect of Prompt Size — 提示範例數量的影響
Performance progressively improves with increasing in-context examples on both GQA and NLVRv2 validation sets. Each run randomly selects annotated in-context example subsets based on random seeds. Majority voting across random seeds consistently outperforms average run performance, consistent with Chain-of-Thought reasoning literature findings. NLVRv2 performance saturates with fewer prompts than GQA, likely because NLVRv2 programs require fewer modules and demonstrations than GQA. This suggests that prompt diversity matters more than quantity — covering the space of required module combinations is key to strong program generation.
在 GQA 和 NLVRv2 驗證集上,效能隨著情境範例數量的增加而逐步提升。每次執行基於隨機種子隨機選取已標注的情境範例子集。跨隨機種子的多數決投票始終優於平均執行效能,這與思維鏈推理文獻的發現一致。NLVRv2 的效能以較少的提示即趨於飽和,可能是因為 NLVRv2 的程式所需的模組與示範較 GQA 為少。這暗示提示的多樣性比數量更為重要——覆蓋所需模組組合的空間是強程式產生的關鍵。
段落功能
消融分析——探討提示範例數量對效能的影響。
邏輯角色
此段為系統的關鍵超參數(提示範例數量)提供實證支撐。「多數決投票」策略與 CoT 文獻的一致性增強了方法論的可信度。
論證技巧 / 潛在漏洞
「多數決投票始終優於平均」的發現雖然符合預期,但也意味著單次執行的可靠性不夠高——需要多次執行才能獲得穩定的結果。這在實際應用中可能帶來延遲與成本的倍增。
5.2 Generalization — 泛化能力
On GQA, VisProg with a curated 20-example prompt achieves 50.0% accuracy, while the voting strategy across 5 runs with 24 random examples reaches 50.5%. Both configurations outperform ViLT-vqa's 47.8% baseline. The curated prompt matches voting strategy performance while requiring 5x less compute, highlighting the promise of prompt engineering over brute-force scaling. On NLVRv2, VisProg achieves 61.8% accuracy with curated prompts and 62.4% with voting, compared to ViLT-nlvr's fine-tuned upper bound of 76.3%. While several points below the fine-tuned model, this zero-shot performance is achieved without any training on image pairs, using only a single-image VQA model trained on VQAv2.
在 GQA 上,VisProg 以精心策劃的 20 個範例提示達到 50.0% 的準確率,而以 5 次執行、24 個隨機範例的投票策略達到 50.5%。兩種配置均優於 ViLT-vqa 的 47.8% 基準線。策劃提示以五分之一的計算量即達到與投票策略相當的效能,突顯了提示工程相對於暴力擴展的前景。在 NLVRv2 上,VisProg 以策劃提示達到 61.8% 準確率、以投票達到 62.4%,相比 ViLT-nlvr 微調後的上界 76.3%。儘管低於微調模型數個百分點,此零樣本效能是在未經任何影像對訓練的情況下達成的,僅使用在 VQAv2 上訓練的單影像視覺問答模型。
段落功能
核心實驗數據——報告兩大基準測試的定量結果。
邏輯角色
此段是實證支柱,覆蓋兩個維度:(1) GQA 上超越基準線的絕對效能;(2) NLVRv2 上零樣本 vs. 微調的效能差距分析。兩者共同支撐「無需訓練即具競爭力」的核心論點。
論證技巧 / 潛在漏洞
GQA 上 50.5% vs. 47.8% 的改進幅度(2.7 個百分點)在統計上是否顯著?作者未報告信賴區間或顯著性檢定。NLVRv2 上 62.4% vs. 76.3% 的差距(13.9 個百分點)其實相當大,但作者巧妙地用「零樣本」的框架來合理化此差距。
For factual knowledge object tagging, VisProg achieves 63.7% tagging F1 and 80.6% localization F1 on the original instructions. Through instruction tuning informed by visual rationale inspection, performance improves to 75.7% tagging F1 and 84.9% localization F1 — gains of 12.0 and 4.3 points respectively. Modified instructions provide better localization queries ("kitchen appliance" rather than "item"), more informative knowledge retrieval queries, and specified classification category constraints. For image editing, manual semantic correctness evaluation yields 59.8% accuracy on original instructions, improving to 66.4% after instruction tuning. These results demonstrate that visual rationales serve as a practical tool for human-in-the-loop performance improvement.
在事實知識物件標記方面,VisProg 以原始指令達到 63.7% 的標記 F1 與 80.6% 的定位 F1。透過視覺推理依據檢查所啟發的指令調校,效能提升至 75.7% 標記 F1 與 84.9% 定位 F1——分別提升了 12.0 和 4.3 個百分點。修改後的指令提供了更佳的定位查詢(「廚房家電」而非「物品」)、更具資訊量的知識檢索查詢,以及指定的分類類別約束。在影像編輯方面,手動語意正確性評估顯示原始指令的準確率為 59.8%,指令調校後提升至 66.4%。這些結果證明視覺推理依據可作為人機協作式效能改進的實用工具。
段落功能
擴展實驗——報告知識標記與影像編輯的定量結果及指令調校的效果。
邏輯角色
此段同時服務兩個論證目標:(1) 展示 VisProg 在非傳統視覺任務上的能力;(2) 實證視覺推理依據的實用價值——指令調校帶來的效能提升是第三項貢獻的具體驗證。
論證技巧 / 潛在漏洞
指令調校帶來的顯著改進(F1 從 63.7% 到 75.7%)說明原始指令的品質對效能有決定性影響。但這也暴露了一個問題:系統的效能高度依賴使用者的指令撰寫能力與除錯意願。在實際部署中,並非所有使用者都願意或有能力進行這種迭代式調校。
5.3 Utility of Visual Rationales — 視覺推理依據的效用
Visual rationales enable thorough failure mode analysis. For approximately 100 sampled instances per task, manual rationale inspection reveals error sources. On GQA, incorrect programs affect 16% of samples, suggesting performance improvement through additional in-context examples matching currently-failing instruction types or upgraded high-error modules. For NLVR, improved VQA models could improve performance by up to 24%. For knowledge tagging and image editing, improving "List" and "Select" modules represents major error reduction opportunities. This fine-grained error attribution is uniquely enabled by the modular, interpretable nature of VisProg — an advantage that monolithic end-to-end models fundamentally cannot provide.
視覺推理依據使得全面的失敗模式分析成為可能。對每項任務約 100 個取樣實例進行手動推理依據檢查,揭示了錯誤來源。在 GQA 上,不正確的程式影響了 16% 的樣本,暗示可透過新增符合當前失敗指令類型的情境範例或升級高錯誤率模組來改善效能。在 NLVR 上,改進的視覺問答模型可將效能提升至多 24%。在知識標記與影像編輯上,改進「List」和「Select」模組代表著主要的錯誤降低機會。這種細粒度的錯誤歸因是 VisProg 模組化、可解釋本質所獨有的優勢——這是單體式端對端模型從根本上無法提供的。
段落功能
錯誤歸因——展示視覺推理依據如何實現模組層級的錯誤診斷。
邏輯角色
此段將「可解釋性」從抽象概念轉化為具體的工程價值:透過錯誤歸因,開發者可以精準地知道該改進哪個模組或提示。這是「模組化」相對於「端對端」的殺手級應用。
論證技巧 / 潛在漏洞
「16% 的樣本受不正確程式影響」意味著在 84% 的情況下程式是正確的——這是一個令人印象深刻的數字。但「改進 VQA 模型可提升至多 24%」的估計過於樂觀,因為它假設完美的 VQA 模組。實際上,模組間的錯誤可能存在連鎖效應,使得改進一個模組的收益低於獨立計算的理論值。
6. Conclusion — 結論
VisProg demonstrates that visual programming is a straightforward, effective approach for leveraging large language model reasoning capabilities for complex visual tasks. The system generates highly interpretable visual rationales while demonstrating strong performance across four diverse tasks. By composing off-the-shelf models through LLM-generated programs, VisProg avoids the need for task-specific training while maintaining competitive accuracy. Future investigation of enhanced prompting strategies and novel user feedback incorporation methods for neuro-symbolic systems like VisProg represents exciting directions for next-generation general-purpose vision systems.
VisProg 證明了視覺程式設計是一種直截了當且有效的方法,能夠將大型語言模型的推理能力應用於複雜的視覺任務。系統產生高度可解釋的視覺推理依據,同時在四項多元任務上展現強勁效能。透過以 LLM 產生的程式組合現成模型,VisProg 無需特定任務的訓練即可維持具競爭力的準確率。未來對增強提示策略與新穎使用者回饋整合方法的探索,是像 VisProg 這樣的神經符號式系統邁向下一代通用視覺系統的令人振奮的方向。
段落功能
總結全文——重申核心貢獻並指出未來方向。
邏輯角色
結論段呼應摘要的結構,從方法回到願景:神經符號式系統是通用視覺系統的有前景方向。「直截了當且有效」的措辭刻意淡化了系統的技術複雜度,強調其概念上的簡潔性。
論證技巧 / 潛在漏洞
結論適度謙遜(提及「增強提示策略」的未來工作),但未充分討論關鍵局限性:(1) 對 GPT-3 API 的依賴帶來的成本與延遲;(2) 子模組更新時的系統維護問題;(3) 在真正開放世界場景中,20 個模組的覆蓋範圍是否足夠。作為最佳論文,讀者期待更深入的自我批判。
More broadly, VisProg represents a paradigm shift from training monolithic models to orchestrating specialized components. As foundation models continue to improve in both language understanding and code generation, the visual programming approach stands to benefit directly — better LLMs will produce better programs, and better vision modules will produce better intermediate results, without requiring any change to the VisProg framework itself. The modular, interpretable, and extensible nature of the system positions it as a flexible substrate for building increasingly capable vision systems through composition rather than end-to-end retraining.
更廣泛地看,VisProg 代表了一種從訓練單體式模型到編排專業化組件的範式轉移。隨著基礎模型在語言理解與程式碼產生方面持續改進,視覺程式設計方法將直接受益——更好的 LLM 將產生更好的程式,更好的視覺模組將產出更好的中間結果,而無需對 VisProg 框架本身做任何更動。系統模組化、可解釋且可擴展的本質,使其成為透過組合而非端對端重新訓練來建構日益強大的視覺系統的靈活基底。
段落功能
展望願景——將 VisProg 置於更宏觀的 AI 發展趨勢中。
邏輯角色
此段將個別系統的貢獻提升至範式層級的論述:「組合 vs. 端對端」。「更好的 LLM 產生更好的程式」的論點巧妙地將 VisProg 綁定於基礎模型進步的大趨勢。
論證技巧 / 潛在漏洞
「更好的組件自動帶來更好的系統」的論點看似合理,但忽略了組合爆炸的問題——隨著模組數量增加,LLM 需要理解的組合空間呈指數增長。此外,2023 年之後多模態大模型(GPT-4V、Gemini)的出現,使得端對端方法正迅速縮小與程式化方法的差距,VisProg 的長期優勢有待觀察。
論證結構總覽
問題
端對端模型難以擴展
至組合式視覺任務長尾
端對端模型難以擴展
至組合式視覺任務長尾
→
論點
LLM 產生模組化程式
組合現成模型無需訓練
LLM 產生模組化程式
組合現成模型無需訓練
→
證據
四項任務驗證
GQA/NLVR/標記/編輯
四項任務驗證
GQA/NLVR/標記/編輯
→
反駁
視覺推理依據實現
錯誤診斷與指令調校
視覺推理依據實現
錯誤診斷與指令調校
→
結論
神經符號式組合是
通用視覺系統的方向
神經符號式組合是
通用視覺系統的方向
作者核心主張(一句話)
透過大型語言模型的情境學習產生模組化視覺程式,可以在完全無需特定任務訓練的情況下,組合現成的視覺模型與 Python 函式來解決複雜的組合式視覺推理任務,同時提供完整的可解釋推理依據。
論證最強處
範式轉移的概念簡潔性:VisProg 的核心洞見——「讓 LLM 寫程式,讓專業模型執行」——在概念上極為簡潔,卻解鎖了驚人的靈活性。視覺推理依據不僅是附帶產物,更是一個完整的人機協作介面,使使用者能夠診斷錯誤、調校指令並迭代改進,這在端對端模型中幾乎不可能實現。四項截然不同的任務(問答、推理、標記、編輯)以統一框架處理,有力地證明了方法的通用性。
論證最弱處
效能上限受制於子模組與評估規模有限:系統效能的天花板取決於底層視覺模型的能力,而非 VisProg 框架本身。在 NLVRv2 上與微調模型的 13.9 個百分點差距並非微不足道。此外,評估多以小規模子集進行(GQA 約 100 種問題類型、NLVR 250 樣本、知識標記 100 條指令),未在完整基準測試集上報告結果,統計穩健性存疑。對 GPT-3 API 的依賴也引入了成本、延遲與可重現性的問題。