Create and explore imaginative 3D worlds with our new product Dreamfield (opens in a new tab)
Papers
Topics
Authors
Recent
Search
2000 character limit reached

Pixel as Code: Encoding, Generation, and Applications

Updated 26 November 2026
  • Pixel as Code refers to the paradigm where pixels function as encoded data, instructions, intermediate representations, or rendered outputs, enabling various computational tasks.
  • This framework can be applied to numeric data as grayscale images, source code as pixel-generating medium, and visual object states as programming references.
  • Examples include converting numeric tables to images, using pixels to detect vulnerabilities in source code, and treating visual states as programming references for physical objects.

“Pixel as Code” is an interdisciplinary paradigm in which pixels function as encoded data, executable instructions, intermediate representations, or rendered consequences of structured programs. The term encompasses several technically distinct operations: mapping numerical records to grayscale intensities, using pixel-wise predictions as relational codes for object formation, translating screenshots into GUI programs, representing source code or physical objects through images, generating images through executable drawing procedures, and treating visual states as computational workspaces. Across these uses, the common principle is that a pixel arrangement is assigned a recoverable or operational semantics rather than being treated solely as an end-product of visual rendering.

1. Conceptual foundations and representational regimes

Pixel as Code does not denote a single algorithm or formal standard. It is an interpretive umbrella for methods that assign computational or semantic meaning to pixels. The relevant representations differ in what a pixel encodes and where executable semantics reside.

In numeric-to-pixel encoding, each pixel stores a transformed scalar. A numeric table is converted into an image matrix by applying global min–max normalization. In pixel-wise predictive systems, each pixel emits a local code, such as a semantic class, a centroid-voting distribution, or an abstention signal. In pixel-to-code systems, the image is an input from which a structured program, DSL, or executable artifact is recovered. In code-to-pixel systems, source code directly generates a raster, vector image, webpage, diagram, or 3D scene. In pure pixel-space reasoning, the canvas itself is the model’s input, intermediate memory, and output interface.

These regimes can be summarized as follows:

Regime Pixel-level role Computational result
Numeric encoding Normalized scalar container Grayscale matrix for neural-network input
Pixel-wise prediction Local semantic or geometric code Segmentation, voting heatmap, or instance mask
Screenshot-to-code Visual evidence of structure DSL, frontend code, or executable artifact
Code-to-pixel generation Rendered consequence of a program Image, diagram, webpage, or 3D scene
Pixel-space reasoning Writable visual state Intermediate computation and final answer

The distinction between representation and execution is central. A pixel array may be invertible numerically but lack semantic metadata; it may encode a relational belief but require deterministic aggregation; or it may serve as a visual reference whose meaning is supplied by object recognition and a programming runtime. Consequently, “pixel” can refer to raw sensor data, a symbolic raster value, a visual token, a program trace, or the output of a renderer.

Recent work explicitly frames raster and structured representations as complementary. “Nemotron-Labs-VisualCreation: Pixel as Code for Agentic Visual Creation” defines a general pipeline of representation generation, rendering, inspection, and revision, using both learned raster tokens and explicit programs (Chen et al., 23 Nov 2026). Under that formulation, the key abstraction is:

generate representation⟶render visual output⟶inspect and revise.\text{generate representation} \longrightarrow \text{render visual output} \longrightarrow \text{inspect and revise}.

The structured representation may be SVG, HTML/CSS/JavaScript, plotting code, document markup, or a presentation object. The raster representation may be a sequence of learned visual tokens decoded into pixels. The resulting framework treats visual creation as manipulation of discrete codes with renderers rather than as direct, opaque bitmap synthesis.

2. Numerical tables, source code, and objects as pixel representations

Numeric data as grayscale images

“Pixel Normalization from Numeric Data as Input to Neural Networks” converts a numeric customer-record table into a grayscale image suitable for neural-network input (Sane et al., 2017). The experiment uses the BigML “churn in telecom’s dataset,” containing 3,334 customer records, 17 numeric attribute columns, and one excluded binary churn-label column.

For a numeric value XX, the paper applies min–max scaling to the 8-bit grayscale interval:

X′=(X−Xmin⁡)255Xmax⁡−Xmin⁡.X'=\frac{(X-X_{\min})255}{X_{\max}-X_{\min}}.

The resulting pixel array is:

Pi,j=(xi,j−Xmin⁡)255Xmax⁡−Xmin⁡.P_{i,j}=\frac{(x_{i,j}-X_{\min})255}{X_{\max}-X_{\min}}.

The natural matrix representation is approximately 3334×173334\times17, with row position identifying a customer, column position identifying an attribute, and intensity encoding normalized magnitude. The paper reports a 17-input pattern-recognition network using scaled conjugate-gradient backpropagation and 10 hidden layers. It reports overall churn-prediction accuracy of 94.9% and best validation performance at approximately epoch 42.

The method’s “Pixel as Code” interpretation is that each pixel acts as a coded numerical container. Under ideal conditions, the mapping is invertible if Xmin⁡X_{\min}, Xmax⁡X_{\max}, row ordering, column ordering, and numerical precision are preserved:

X=Xmin⁡+X′(Xmax⁡−Xmin⁡)255.X=X_{\min}+\frac{X'(X_{\max}-X_{\min})}{255}.

However, the paper does not specify whether extrema are computed globally or per feature, nor whether normalized values are rounded, truncated, or retained as floating point before conversion to 8-bit pixels. Quantization may therefore prevent exact recovery. The image also does not inherently preserve attribute names, units, categorical semantics, missing-value conventions, or label meaning.

The method should not be confused with arbitrary natural-language-to-image transformation. The experiment does not process natural-language strings, tokens, or general categorical variables. It processes numeric attributes from a labeled customer-churn dataset. The neural network itself is not run on the GPU; GPU acceleration concerns the image-transformation stage, for which the reported custom-PC timing is 0.001553 seconds on CPU and 0.001051 seconds on GPU.

Source code as pixel-generating material

VulMCI treats source code as an image-generating medium for vulnerability detection (Peng et al., 2024). Each normalized code line is embedded with sent2vec into a 128-dimensional vector, which becomes a pixel row. Functions are padded or truncated to produce approximately 100×128100\times128 grayscale images.

VulMCI modifies the code before embedding. It extracts a Code Property Graph with Joern, uses the CFG component, and inserts additional rows for CFG-linked lines. If an edge connects code lines LiL_i and LjL_j, the method forms:

Li,j=Li+LjL_{i,j}=L_i+L_j

and embeds the concatenated source string into a new pixel row. The objective is to place execution-related statements closer in the image so that CNN convolution and pooling are less likely to discard semantically important but spatially isolated rows.

The resulting workflow is:

function code→normalization→CFG extraction→code splicing→sent2vec embedding→100×128 image→CNN classification.\text{function code} \rightarrow \text{normalization} \rightarrow \text{CFG extraction} \rightarrow \text{code splicing} \rightarrow \text{sent2vec embedding} \rightarrow 100\times128\text{ image} \rightarrow \text{CNN classification}.

The paper reports CFG-based complete concatenation accuracy of 97.199% in one ablation and F1 of 98.035%. On NVD real-world data, it reports average F1 of 89.07% and average accuracy of 90.41%. The principal limitation is that image geometry reflects the learned embedding and CFG ordering rather than intrinsic visual structure. The approach also depends on static analysis quality, function-length truncation, sent2vec representations, and C/C++-style source code.

Visual object states as programming references

SnapNCode uses captured physical-object images as programming references rather than as directly executable pixel streams (Wei et al., 15 May 2025). Its browser-based IDE combines a CodeMirror editor, an Object State Panel, an Information Panel, a live video stream, a Python Flask backend, Firestore storage, and YOLOv8 object recognition.

The operational pipeline is:

camera frame→YOLOv8 detection→object category and bounding box→database matching→Python execution.\text{camera frame} \rightarrow \text{YOLOv8 detection} \rightarrow \text{object category and bounding box} \rightarrow \text{database matching} \rightarrow \text{Python execution}.

A captured image can be inserted into code as a variable-like reference. Spatial predicates such as In(), On() or Upon(), and Distance() are evaluated from detected bounding boxes. A program can subsequently be attached to a physical object and triggered when a camera recognizes it.

Raw pixels are not directly executable in SnapNCode. Their computational meaning is mediated by object recognition, database associations, spatial predicates, and Python semantics. The paper therefore exemplifies a layered form of Pixel as Code:

pixels→recognized object/state→object reference→event condition→Python execution.\text{pixels} \rightarrow \text{recognized object/state} \rightarrow \text{object reference} \rightarrow \text{event condition} \rightarrow \text{Python execution}.

The user study involved 12 participants and reported a mean SUS score of 66.5. Participants generally valued visual correspondence between code and live objects, although the system remains limited by object-recognition coverage, 2D bounding-box geometry, camera dependence, state-recognition ambiguity, and the absence of a complete professional IDE feature set.

3. Pixel-wise computational codes in vision

Pixel Consensus Voting demonstrates a different interpretation: pixels are local computational agents whose outputs are composed into global instance structures (Wang et al., 2020). The method performs panoptic segmentation using a Generalized Hough-transform formulation.

PCV has two pixel-wise branches:

  1. A semantic branch predicts a category for every pixel.
  2. An instance-voting branch predicts a discrete spatial voting class or an abstention class.

For an instance with center of mass cc, a pixel pip_i has ideal displacement:

δi=c−pi.\delta_i=c-p_i.

Rather than regressing δi\delta_i directly, PCV classifies the displacement into one of KK spatial cells. The default voting region is 243×243243\times243 at one-quarter input resolution, divided into K=233K=233 radially expanding cells. Nearby cells are small and distant cells are larger, allowing fine precision for nearby centroids and greater tolerance for distant predictions.

Each pixel therefore emits a probability distribution:

P(vi∣pi),vi∈{1,…,K,abstain}.P(v_i\mid p_i), \qquad v_i\in\{1,\ldots,K,\text{abstain}\}.

The voting distributions are aggregated into a centroid heatmap. Fixed dilated transposed convolutions move channel-specific votes to their spatial offsets, while average pooling distributes votes across cell regions. Peaks are obtained by thresholding the heatmap and finding connected components. A Query Filter then backprojects peak regions into instance masks by checking compatibility between predicted pixel voting classes and the voting classes implied by each candidate centroid.

The complete computational pattern is:

{pixel codes}→{centroid peaks}→{instance masks}.\{\text{pixel codes}\} \rightarrow \{\text{centroid peaks}\} \rightarrow \{\text{instance masks}\}.

Under the Pixel as Code interpretation, each pixel encodes a relational statement: it supports an object whose centroid lies in a particular spatial region, or it abstains. Object instances emerge from consensus among these local codes.

PCV reports COCO validation PQ of 37.5, SQ of 77.7, and RQ of 47.2, with thing PQ of 40.0 and stuff PQ of 33.7. On Cityscapes it reports PQ of 54.2, thing PQ of 47.8, stuff PQ of 58.9, and mIoU of 74.1. The reported runtime is approximately 176.5 milliseconds on COCO and 182.8 milliseconds on Cityscapes, or roughly five frames per second. The method is proposal-free, but its instance grouping remains dependent on accurate pixel-wise predictions and the chosen discretization.

Pixel-wise Deep Image Stitching uses pixels as individually addressable geometric units rather than forcing them to share one homography (Kweon et al., 2021). Its Pixel-wise Warping Module predicts a dense target-to-reference displacement field:

xi′=xi+WT→R(xi).\mathbf{x}'_i=\mathbf{x}_i+W_{T\rightarrow R}(\mathbf{x}_i).

The field has shape HT×WT×2H_T\times W_T\times2. Forward warping relocates target pixels into the reference domain using differentiable softmax splatting. A Stitched Image Generating Module then blends the reference image and warped target while repairing holes, seams, and misalignments.

The warp loss distinguishes overlap and non-overlap regions:

LPWM=∥Wov−Wovgt∥1+α∥Wnov−Wnovgt∥1,\mathcal{L}_{PWM} = \lVert W_{ov}-W^{gt}_{ov}\rVert_1 + \alpha \lVert W_{nov}-W^{gt}_{nov}\rVert_1,

with α=0.3\alpha=0.3. The authors report that the method improves PSNR over deep homography stitching from 19.4275 to 23.5784 on the synthetic dataset and from 23.1821 to 23.5258 on UDIS real data.

Here “code” is a dense local displacement instruction. Each pixel carries a two-dimensional relocation command, and the complete image is transformed by executing those commands. The approach is more flexible than a global homography for large parallax and non-planar scenes, but non-overlap regions remain ambiguous and forward warping can produce holes.

4. From pixels to executable programs

GUI screenshots and structured code generation

PixCoder addresses screenshot-to-code generation through an intermediate GUI DSL rather than direct autoregressive source-code generation (Huang et al., 2020). Its pipeline is:

I→δD→βC,I \xrightarrow{\delta} D \xrightarrow{\beta} C,

where II is the screenshot, DD is a GUI DSL, and CC is platform-specific frontend code. The complete mapping is α=β∘δ\alpha=\beta\circ\delta.

The vision model maps a standardized 256×256256\times256 screenshot to a manually designed vector. Vector dimensions correspond to known GUI regions, components, and style choices. A deterministic parser converts the vector to DSL, and a compiler generates web, iOS, or Android code.

For the iOS dataset, a one-hot representation initially requiring 176 bits is reduced to a 72-bit vector by exploiting layout constraints. The system uses 1,500 training examples and 250 test examples for each of web, iOS, and Android interfaces. Reported DSL-tree similarities are 98.699% for web UIs, 95.562% for iOS UIs, and 98.177% for Android UIs.

These results are measured using Simple Tree Matching rather than rendered-image similarity, functional correctness, or exact source-code equality. PixCoder succeeds partly because it imposes a domain-specific grammar. Its artificial attention mechanism is not a general learned spatial attention map; it is a hand-designed region-to-vector correspondence. Consequently, it performs best on regular layouts with a restricted component vocabulary and does not reconstruct application logic, backend behavior, event handlers, or arbitrary responsive interfaces.

Figure reproduction

FigCodeBench evaluates the inverse relationship: an MLLM receives a figure and generates executable code that reproduces it (Chen et al., 7 Oct 2026). The task is:

image→program→rendered image.\text{image} \rightarrow \text{program} \rightarrow \text{rendered image}.

Inputs include the reference image, programming language, canvas dimensions, package requirements, dataset information, and random seed. Outputs use Python, Matlab, R, or LaTeX through TikZ/PGFPlots. The benchmark contains 6,194 figure-code pairs, 2,548 unique prototypes, seven functional categories, and four programming languages.

Evaluation combines execution rate, PSNR, SSIM, LPIPS, CIEDE2000, CodeBERTScore, CrystalBLEU, AST similarity, plotting-API F1, Figure-Code Fidelity, and MMOS. Twelve experts evaluated 1,000 generated-reference pairs, and MMOS correlates with human evaluation at r=0.826r=0.826.

The benchmark reports a universal non-linear performance cliff from medium to hard examples. Python execution is generally stronger than R, Matlab, and LaTeX. LaTeX is especially difficult because it requires explicit coordinates, anchors, paths, styles, nested environments, and typographic control. Geospatial and conceptual figures are also difficult because they require external geographic structure or abstract spatial relations.

FigCodeBench demonstrates that visual similarity and code similarity are not equivalent. Claude Opus 4.7 has high execution rates and strong visual reproduction but low CrystalBLEU, AST similarity, and API F1, indicating that alternative executable programs can reproduce a figure without resembling the reference source. Conversely, code that resembles a reference can render an incorrect figure.

Visual artifact operation

VAO-Bench treats charts, dashboards, webpages, diagrams, documents, circuits, mathematical figures, and chemical diagrams as executable or structured visual artifacts (Guo et al., 12 Oct 2026). It distinguishes:

  • Direct edits requested explicitly;
  • Derived updates that follow from dependencies;
  • Invariant content that must remain unchanged.

The benchmark contains 1,573 tasks across nine artifact categories and evaluates pixel editors, native code-generating systems, and tool-using agents. Its source artifacts use HTML, DOT, Python, TikZ, and CircuitikZ, with deterministic rendering.

The key result is that executable-code systems better support dependent updates, whereas pixel-space editors are faster and often achieve stronger visual quality. GPT-Image-2 has execution time of 154.2 seconds and VQ of 4.47, but Derived score of 0.527. Codex-GPT-5.6-Sol reaches Direct 0.825, Derived 0.698, Invariant 0.957, VQ 4.43, and DQ 4.28, at 810 seconds.

Explicitly stating dependencies dramatically improves performance. In a 316-task ablation, GPT-Image-2’s Derived score rises from 0.551 to 0.868 when the instruction specifies consequences such as changed warning states and alert counts. For DeepSeek-Flash, access to true source code yields Derived 0.696, while explicit dependency instructions yield 0.886.

The benchmark therefore identifies dependency inference as a central limitation. A screenshot may show a threshold, chart, or diagram, but it does not necessarily reveal the latent variables and relations that govern derived elements. “Pixel as Code” systems must reconstruct or infer these dependencies if they are to perform reliable nonlocal edits.

5. Executable visual generation and 3D representations

Coding agents as visual generators

“How Far Can Coding Agents Go in Visual Generation?” evaluates coding agents that construct images through executable programs rather than specialized image generators (Zhou et al., 13 Oct 2026). Tested interfaces include individual pixels, geometric shapes, Canvas 2D, SVG, GUI drawing, Blender Cycles, and medium-specific stroke workflows.

The transformation is:

prompt→program→execution→image.\text{prompt} \rightarrow \text{program} \rightarrow \text{execution} \rightarrow \text{image}.

Coding agents show strong structural fidelity but weak perceptual richness. On AgentDrawBench, Canvas 2D Astra achieves an overall structural pass rate of 85.8%, compared with 68.8% for GPT-image-1. On design and symbolic tasks, Canvas 2D Astra reaches 94.6%. Its perceptual wins against GPT-image-1 are strongest for typography, at 77.6%, but weak for anatomy, material, perspective, light transport, and scene physics.

The visual-code representation serves as an external language of thought. It supports planning, construction, inspection, measurement, and revision. In a visual question-answering experiment, original images yield 74.0% accuracy, SVG source code 69.0%, and rendered SVG reconstructions 65.0%. Code preserves substantial compositional and symbolic information, although it loses texture and natural appearance.

Cross-harness drawings show related layouts and palettes across Canvas 2D, SVG, Shapes, GUI, and Blender conditions. Independent single-pixel queries also recover broad spatial arrangements and tones. These results suggest reusable internal visual organization, but they do not prove the existence of a literal symbolic scene graph or image-like latent variable.

3DCodeVerse

3DCodeVerse extends executable visual generation from 2D images to editable 3D worlds (Gao et al., 15 Oct 2026). A program ff runs in a declared environment ee to produce an artifact aa and execution feedback ℓ\ell:

(a,ℓ)=Ee(f).(a,\ell)=\mathcal{E}_e(f).

Rendering then produces an observation:

o=R(a).o=\mathcal{R}(a).

The artifact may be a static mesh, articulated asset, complete scene, animation, shader output, or browser-based graphics composition. Supported environments include Blender, CadQuery, OpenSCAD, URDF, Three.js, GLSL, and moderngl.

The 3DCodeVerse Harness performs planning, DAG-based task decomposition, code generation, execution, geometric measurement, rendering, VLM inspection, and bounded repair. It checks dimensions, bounding boxes, connectivity, contacts, collisions, grounding, kinematics, camera framing, animation motion, and graphics-frame validity.

The corpus reports approximately 269,597 unique executable programs, 768,596 deduplicated prompt–code training pairs, approximately 891 million tokens in benchmark training pairs, and 2,028,286 rows in the unified text export. DeepCAD conversion produces 128,201 unique executable programs with mean voxel IoU of 0.985. Articraft conversion achieves 99.9% verification success under its reported criteria.

Fine-tuning Qwen models substantially improves execution. Qwen 9B rises from 0.0% to 84.9% on 3DCodeBench after supervised fine-tuning; Qwen 27B reaches 92.9% after SFT and DPO. The harness reports a 90% human win rate against Claude Design (3D Object) when both use Claude Opus 5.5.

In this setting, pixels are the final evidence of an executable world model. The code preserves geometry, topology, materials, cameras, animation, and physical relationships that a raster image does not expose. The representation is editable and verifiable, but it remains dependent on runtimes, APIs, assets, renderers, and environment configuration.

Pixel-art programs

PixelBench evaluates Python programs that directly construct native-resolution, palette-indexed pixel art (Hong et al., 16 Nov 2026). An artwork is represented as:

A=(G,P,M),A=(G,P,M),

where GG is an H×WH\times W matrix of palette indices, PP is the palette, and MM contains metadata such as canvas size, background policy, and frame structure.

Unlike SVG, the program operates directly on the native integer grid. Primitives such as pixels, lines, rectangles, circles, polygons, Bézier curves, flood fills, mirroring, dithering, text rendering, layers, and selections are rasterized without automatic antialiasing. The environment guarantees canvas and palette constraints, supports .ase and .ora export, and allows iterative inspection through image previews and textual matrix representations.

PixelBench contains 75 generation tasks and 25 editing tasks across objects, scenes, characters, creatures, icons, materials, and effects. Ten professional art raters ranked 1,200 evaluation artworks. The automated judge achieves per-task Kendall agreement of τb=0.557\tau_b=0.557 with human consensus, while model-configuration rankings correlate at Spearman ρ=0.958\rho=0.958.

GPT-6 Astra achieves the highest average judge score, 83.76, and mean human rank of 3.34. Its agentic tool workflow scores 83.8 compared with 76.9 for direct answer generation. Image observation is especially important for editing: removing image observation reduces editing from 88.0 to 77.8.

The results show that code improves exact editability, palette control, reproducibility, layer management, and larger-canvas composition. It does not guarantee artistic quality. Lower-ranked systems often execute successfully but produce flat fills, weak shading, generic geometry, and insufficient pixel cleanup.

Pure pixel-grid generation

A more literal raster-program representation is studied in “PixelBench: Can LLMs Understand and Generate Images Pixel by Pixel?” (Zhang et al., 2 Nov 2026). Models generate a JSON palette and an index grid. If PP is a palette and GG is the grid, rendering is:

I[y,x]=PG[y,x].I[y,x]=P_{G[y,x]}.

The representation uses two to eight opaque RGB colors, hexadecimal palette values, and one digit per pixel. It contains no learned image decoder, SVG primitive, or geometric abstraction.

The benchmark evaluates text-to-pixel generation, image-to-pixel reconstruction, and pixel understanding at 16×1616\times16, 32×3232\times32, and 64×6464\times64. GPT-6 Astra achieves average T2P 500-way Top-1 of 91.0 and VLM-judge average of 90.7. In I2P, GPT-6 Astra achieves aggregate score 80.45, outperforming the listed algorithmic baselines in aggregate at low resolutions, although PIA becomes stronger on several metrics at 64×6464\times64.

Pixel-understanding accuracy for GPT-6 Astra is 67.5%, and descriptive correlations between understanding and generation are high: Pearson r=.871r=.871 for T2P and r=.930r=.930 for I2P. Pixel Reconstruction Tuning produces modest but positive gains across 16 visual benchmarks, with Molmo2-4B’s benchmark average increasing from 54.1 to 54.6 after adding 2,000 reconstruction examples.

This representation is more direct than SVG but less abstract. It offers deterministic semantics and exact spatial correspondence while imposing a quadratic sequence-length burden as resolution grows. Higher resolution can improve expressiveness while causing repetition, omission, effective-resolution collapse, invalid output, and global spatial drift.

6. Computational substrates, systems implications, and limitations

Pixels as writable computational state

“Pixel is All You Need” tests whether models trained entirely on raw pixels can perform symbolic and cross-modal reasoning without text pathways (Chu et al., 17 Nov 2026). The models receive rendered questions and output rendered intermediate steps and answers. They are flow-matching transformers operating on 8×88\times8 patches, with no tokenizer, text encoder, VAE, language-model head, or external prompt rewriter.

The task canvas contains rendered text, visual scenes, answer regions, mazes, curves, and dot patterns. In frame-by-frame mode, the output frame is fed back as the next input. The canvas therefore serves as computational workspace and external memory.

Frame-by-frame reasoning substantially outperforms single-frame answering. At 130 million parameters, frame-by-frame accuracy reaches 88.3% on Expressions, 78.6% on Word Problems, 49.2% on Trace Then Sum, and 98.1% on Compute Then Paint. Direct answering at the same scale reaches 33.2%, 1.2%, 17.2%, and 31.1%, respectively.

The paper reports per-step scaling laws. For text tasks:

L(N)=49.6N−0.360,L(N)=49.6N^{-0.360},

where L(N)L(N) is per-step visual error and NN is the number of non-embedding parameters. For Curve Tracing:

L(N)=111N−0.340.L(N)=111N^{-0.340}.

Reinforcement learning further improves performance. On Word Problems, GRPO increases accuracy from 23.7% to 84.6% at 130 million parameters. On Trace Then Sum, RL reaches 43.7%, and on Compute Then Paint it reaches 73.2%.

These results support a narrow claim: a visual canvas can function as a writable computational substrate when training explicitly teaches sequential state transformation. They do not establish unrestricted visual reasoning, general-purpose programming, or universal replacement of text tokens. The tasks are synthetic, the layouts are constrained, the models are small, and the available operations are prescribed.

Portability and heterogeneous pixel reconstruction

“Porting CMS Heterogeneous Pixel Reconstruction to Kokkos” treats detector pixels as inputs to a portable accelerator-oriented reconstruction pipeline (Childers et al., 2021). The Patatrack workflow transforms raw CMS pixel data into clusters, 3D hits, tracks, and vertices through five modules.

Kokkos expresses the reconstruction using portable execution spaces, parallel_for, parallel_scan, parallel_reduce, TeamPolicy, RangePolicy, and Kokkos::View. The algorithmic representation is portable, but performance depends on data layout, memory initialization, event concurrency, synchronization, compilation, linking, and framework integration.

In a matched one-event, no-memory-pool configuration, Kokkos CUDA reaches 115.7 events per second compared with direct CUDA at 159 events per second, or approximately 72.8% of direct CUDA throughput. Optimized direct CUDA reaches 1,840 events per second using nine concurrent events and a memory pool. Kokkos Threads reaches 28 events per second at peak, compared with 539 events per second for the direct 40-thread CPU version.

The study shows that “Pixel as Code” can also refer to portable source code for pixel-detector computation. The central engineering issue is not merely expressing algorithms in common syntax. Successful execution requires portable structure-of-arrays layouts, memory ownership, execution policies, event scheduling, synchronization, and framework-aware build systems.

Adversarial pixel programs

RFPAR treats sparse pixel modifications as executable attack instructions (Song et al., 10 Feb 2025). An action specifies pixel coordinates and channel values:

(X,Y,R,G,B).(X,Y,R,G,B).

Write sets channels to maximum brightness and Erase sets them to zero. A reinforcement-learning policy selects a complete set of sparse pixel operations, queries a black-box victim, and uses the reward to update its policy.

The Remember process retains the highest-reward perturbation. The Forget process resets the policy and memory while carrying forward the best image, enabling renewed exploration. On ImageNet classification, RFPAR reports success rates from 64.1% to 95.3% across evaluated models, with lower query counts and lower L0L_0 than the principal baselines in the reported comparisons.

For object detection, RFPAR removes 0.91 of YOLO detections and 0.83 of DDQ detections at attack rate α=.05\alpha=.05. Against PRFA and GARSDC, it matches GARSDC’s mAP reduction of 0.29 while using 1,270 queries instead of 2,691.

This application illustrates the dual-use nature of Pixel as Code. Pixels can be addressed as low-level instructions for testing or manipulating model behavior. The resulting security implications include sparse attacks against classification and detection systems, while defenses include query-rate limiting, adversarial training, sparse-corruption testing, anomaly detection, and sensor validation.

Token accounting and system-level tradeoffs

“Pixels for Programs?” evaluates whether rendered source code receives fewer provider-reported input tokens than raw source text (Bhalgami, 23 Jul 2026). The study compares text requests with compact PNG renderings across five languages, nine source lengths from 20 to 2,000 lines, and 15 API aliases from Anthropic, OpenAI, and Google Vertex AI.

Weighted image-to-text ratios are 0.135 for Anthropic, 0.194 for OpenAI, and 0.242 for Gemini, corresponding to reported reductions of 86.5%, 80.6%, and 75.8%. These figures are accounting measurements, not evidence of semantic fidelity, lower latency, lower monetary cost, lower computation, or improved coding-agent efficiency.

Anthropic and OpenAI images are below parity at all tested sizes. Gemini images require 6.951 times as many reported input tokens at 20 lines and first fall below parity at the tested 200-line point. Page-boundary behavior can be non-monotonic: one Gemini audit reports 2,322 image tokens at 800 lines and 516 at 1,200 lines.

The experiment also changes indentation representation by replacing four-space levels with markers and prepending a legend. It therefore does not isolate rasterization from textual compression. No results are reported for exact transcription, compilation, debugging, patch generation, test passing, latency, or price.

Limitations common to Pixel as Code

Several limitations recur across the research:

  • Semantic underdetermination: a raster may preserve appearance while omitting object identity, dependencies, units, syntax, or causal relations.
  • Quantization and resolution: mapping values or symbols to pixels can introduce rounding, truncation, palette limits, or spatial aliasing.
  • Ordering dependence: row and column placement, layer order, coordinate systems, and page layout often carry meaning.
  • Structured reconstruction cost: recovering programs from images requires parsing, execution, repair, and verification.
  • Representation mismatch: pixel-level codes are precise but verbose; high-level programs are compact but may omit visual details.
  • Evaluation ambiguity: pixel similarity, code similarity, semantic correctness, execution success, and human preference measure different properties.
  • Runtime dependence: executable visual artifacts depend on fonts, renderers, libraries, APIs, hardware, and version-pinned environments.
  • Generalization limits: strong results often rely on regular datasets, constrained grammars, synthetic tasks, fixed object categories, or domain-specific interfaces.
  • Security and reliability: pixel-level addressability can support both diagnostic testing and adversarial manipulation.
  • Scaling constraints: higher-resolution grids, longer source contexts, multi-page artifacts, and complex scenes increase sequence length, memory use, cost, and opportunity for structural drift.

Pixel as Code is therefore best understood not as a universal replacement for language, geometry, or conventional image generation, but as a family of representation strategies. Pixels can be storage cells, relational messages, spatial instructions, visual variables, executable raster programs, learned tokens, intermediate reasoning states, or rendered evidence of a structured world model. The most robust systems combine these roles: pixel perception for visual evidence, structured intermediate representations for objects and dependencies, executable programs for transformation, deterministic renderers for verification, and iterative visual feedback for repair.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Pixel as Code.