From Tokens to Structure: Investigating Visual Attention in Progressive Code Rendering
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.
Tom: I'm Tom.
Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.
Tom: We're looking at the paper: "From Tokens to Structure".
Jane: Here's the gist of the paper. Structure-Aware Rendering: How Code Reveal Shapes Programmers’ Visual Attention is an eye-tracking study that investigates how different ways of revealing code—static, character-based, and structured—shape programmers’ visual attention and comprehension strategies.
Tom: The paper argues that rendering is an active organizer of program comprehension rather than a passive wrapper around code output.
Jane: Understanding source code is a core and cognitively demanding activity in software development, requiring programmers to construct mental models of program behavior in order to debug, modify, and extend systems.
Tom: Current code presentation formats often follow model generation processes, revealing code in the speed and order it is produced rather than in ways optimized for human comprehension.
Paper summary: Tom: So we're looking at a paper called "From Tokens to Structure: Investigating Visual Attention in Progressive Code Rendering." Basically, it’s about how the way code is shown to you actually changes how you look at and understand it.
Jane: That sounds really relevant right now, Tom. What’s the main idea here? Is it just saying that putting code in a certain format makes people read better?
Tom: It goes deeper than that. The authors claim that rendering—how the code is revealed—is an active organizer of program comprehension, not just some passive way to wrap up the final output. They're looking at static, character-based, and structured ways of revealing code.
Lu: What’s interesting is their definition of structured rendering. It’s when you reveal the code piece by piece based on its nodes in the abstract syntax tree. Instead of just showing characters sequentially, it reveals the shape of the construct first to help you see its boundaries.
Meng: So, if you show someone a whole block at once, they get overwhelmed? What does this structured approach actually do differently for their brain when they're trying to figure out what's going on?
Jane: Well, the paper is testing this by using eye-tracking with fifty-three participants <ref:2609.24616#pg2>. They measured attention metrics like fixation rate and fixation duration, plus linearity metrics that check how the gaze flows across the code.
Tom: And they found some pretty distinct patterns depending on which rendering you used. The static rendering condition led to more frequent but shorter fixations, suggesting a faster global scan, maybe superficial attention.
Jane: But then there's the dynamic condition and structured rendering, which showed lower fixation rates and longer fixation durations compared to the character-based approach. That points toward deliberate reading when you present things in chunks based on structure.
Lu: The paper argues that this suggests structured rendering aligns better with how programmers build mental models of a program, because it shows the hierarchical organization directly in the presentation, which matches their chunking strategies <ref:2609.24616#pg3>.
Meng: From a deployment standpoint, if we use a character-by-character reveal like ChatGPT does, that seems to force the reader into following the generation order. That might not match how a programmer mentally processes dependencies or structure <ref:2609.24616#pg2>.
Tom: Exactly. The authors say that methods in progressive rendering—revealing code character by character—don't align with the structural cues programmers rely on, unlike static rendering where you get complete blocks <ref:2609.24616#pg2>.
Jane: So, what’s the practical implication for us right now, Tom? If this is true, how should we be designing the interfaces for code tools?
Tom: The big idea is that interfaces should align with human cognitive models of code comprehension instead of just mirroring how language models generate text <ref:2609.24616#pg2>. They suggest structured rendering is a promising way to guide attention and enhance understanding by leveraging the program structure itself.
Lu: They also pointed out that comprehension itself is a fundamental cognitive challenge, defined as constructing a mental model of the program being studied eighteen, and chunking statements into meaningful higher-level units helps with that process <ref:2609.24616#pg3>.
Meng: If we’re shipping tools, this means we need to design rendering strategies that encourage chunk-based understanding, not just sequential display, especially when dealing with long outputs <ref:2609.24616#pg3>. What costs us is if the interface forces us into a mode that doesn't match our natural cognitive flow.
Jane: It really shifts the focus from just getting the code to get it displayed to designing an interaction that actively supports comprehension, which is what this paper suggests we need for better software development tools.
Tom: So, to wrap up, "From Tokens to Structure: Investigating Visual Attention in Progressive Code Rendering" shows that revealing code based on its structural nodes helps programmers pay more attention and read differently than just seeing characters one after the other <ref:2609.24616#pg1>.
Lu: It moves us toward interfaces that respect the hierarchical organization of software, making it easier for people to build those mental models they need <ref:2609.24616#pg3>.
Meng: And from an engineering side, it means we have to think about how the output is presented at scale and ensure we aren't just presenting things in a way that favors the generation order over structural understanding <ref:2609.24616#pg2>.
Jane: It’s a call for interfaces that support interaction over rendering itself, shaping the output into forms that fit human cognition and what programmers actually need to do <ref:2609.24616#pg3>.
Conclusion: Tom: So we've been looking at how showing code differently changes how programmers actually look at it and what they focus on in their heads.
Jane: Right, so this paper is called "From Tokens to Structure," and it’s about a study comparing static, character-based, and structured ways of revealing source code.
Lu: The core idea is that the way you present the code—whether it’s all at once or piece by piece based on its structure—actually organizes the programmer's attention differently.
Meng: So it’s not just about making things look pretty; it’s about whether that presentation helps or hurts how someone understands what they're looking at.
Tom: Exactly. They found that structured rendering, which breaks code down into its tree nodes, seemed to get programmers to focus more deeply on the structure and boundaries of the code units.
Jane: And it contrasted with character-based rendering, which they thought was okay for quick scanning but didn't hold attention as well.
Lu: The authors suggest that this happens because revealing a construct's shape first aligns better with how programmers build mental models of the program’s behavior.
Tom: So, if you were designing a coding interface, this study suggests you should probably lean into showing those structural relationships instead of just spitting out the raw text.
Jane: It points toward interfaces that actively support comprehension by matching human cognition, rather than just mimicking how language models generate text.
XIAOTIAN SU, JAN BRASSER, DAVID ROBERT REICH, LENA A. JÄGER, APRIL YI WANG
ETH Zurich
cs.HC
Submitted: 2026-09-21
Updated: 2026-10-29
License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
Importance score: 87/100
The gist: Structure-Aware Rendering: How Code Reveal Shapes Programmers’ Visual Attention is an eye-tracking study that investigates how different ways of revealing code—static, character-based…
Key concepts
- Structured Rendering
- A presentation technique that shows code by progressively revealing it at the level of syntactic nodes in the program's abstract syntax tree (AST). This method highlights the inherent structure of the program, which researchers believe better matches how programmers naturally think about and understand code organization.
- Attention Metrics
- These are measurements used to quantify how programmers look at the code. The study used metrics like Fixation Rate (how often a programmer looks at a specific spot) and Fixation Mean Duration (how long they look there) to see how different rendering styles affected visual focus.
- AST Hierarchy
- The abstract syntax tree is a hierarchical representation of the program's code structure. Structured rendering uses this hierarchy to reveal code, meaning it shows the relationships between different parts of the program rather than just a flat sequence of characters.
Terminology
Summary
Structure-Aware Rendering: How Code Reveal Shapes Programmers’ Visual Attention is an eye-tracking study that investigates how different ways of revealing code—static, character-based, and structured—shape programmers’ visual attention and comprehension strategies. p. 5 The paper argues that rendering is an active organizer of program comprehension rather than a passive wrapper around code output. p. 1
Introduction to the Problem
Understanding source code is a core and cognitively demanding activity in software development, requiring programmers to construct mental models of program behavior in order to debug, modify, and extend systems. Current code presentation formats often follow model generation processes, revealing code in the speed and order it is produced rather than in ways optimized for human comprehension. p. 0 Prior work shows expert programmers read code in a non-linear, selective manner, guided by semantic cues and mental models rather than a strict left-to-right sequence. p. 0
The Structured Rendering Technique
Structured rendering is defined as a presentation technique that progressively reveals code at the granularity of syntactic nodes in the program’s abstract syntax tree. The design rationale suggests that revealing code through its AST hierarchy better aligns with programmers’ mental models. p. 3 The formal algorithm involves traversing the AST, and when it encounters a non-token node with a defined rule, it first calls MakeSkeleton to append the node’s skeleton to R, thereby revealing the construct’s shape and boundaries. p. 3
Experimental Setup and Metrics
The study conducted an eye-tracking study with 53 participants comparing static, character-based, and structured rendering. Dependent variables were categorized into two metric classes: Attention Metrics, which include Fixation Rate and Fixation Mean Duration, and Linearity Metrics, which characterize the sequential structure of gaze during code reading. p. 7 These metrics allowed researchers to compare how rendering conditions affected visual attention and reading behavior. p. 8
Key Findings on Attention Allocation
The findings revealed that static and dynamic rendering evoked fundamentally different attention allocation patterns and reading strategies. The static condition produced more frequent but shorter fixations, reflecting faster global scanning and more distributed but potentially superficial attention. p. 8 In contrast, the dynamic condition promoted deliberate reading and attention to detail. p. 9 Structured rendering exhibited a lower fixation rate and longer fixation durations compared to the character-based condition. p. 9
Conclusion and Implications
The study suggests that structured rendering was favored over character-based approaches by presenting complete syntactic units that facilitated deeper processing and better structural awareness. The work concludes that interfaces should align with human cognitive models of code comprehension rather than mirroring the statistical generation process of language models. p. 2 Structured rendering represents a promising step toward this alignment by leveraging program structure to guide attention and enhance understanding. p. 0 The authors also developed a VS Code prototype that demonstrates how rendering can be treated as a user-controllable interaction. p. 1 The findings suggest that waiting in generative systems should be designed, not merely tolerated, to reduce cognitive costs. p. 1 The final conclusion is that interfaces should support interaction over rendering itself to shape the output into forms that better fit human cognition and task demands. p. 1 The paper also addresses limitations, noting the need for process-sensitive measures to capture comprehension quality rather than just outcomes. p. 6 The authors release the anonymized dataset to support future research. p. 0 The paper also provides an interactive demo to support future research. p. 0
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Adaptive code rendering for AI assistants should dynamically adjust presentation based on user expertise to optimize cognitive load. This allows interfaces to move beyond fixed modes toward
user-controlled structured rendering,
enabling developers tomove fluidly between passive viewing, immediate access, and fine-grained stepwise inspection.
-
Implement a mechanism that prioritizes structural elements of the Abstract Syntax Tree (AST) during code reveal. By following the rule
skeleton first, components later,
the AI system can align presentation withthe hierarchical organization that programmers naturally use in comprehension,
thereby providingcognitive anchors that facilitate pattern recognition.
-
Develop an interactive stepping mode for dynamic code reveals, allowing users to control the flow through keyboard commands. This feature directly addresses the Goldilocks Problem by giving users agency, as they can
clear the current block and enter a manual stepping mode
to manage pacing and avoid being overwhelmed or bored. -
Create a system that assesses rendering style in real-time to guide attention toward critical regions. By observing
dynamic rendering appeared to encourage more effortful, detail-oriented inspection,
the AI can scaffold inspection modes better suited for tasks requiring careful scrutiny, such as defect detection. -
Design pacing mechanisms that adapt output speed based on inferred user reading difficulty and task demands. Instead of streaming at a fixed rate, the system should modulate
granularity and sequence to users, tasks, and content,
ensuring that the presentation supportshuman-centered generation
rather than just mirroring model throughput.
Sources
Related papers
- EmoPhone: A Multi-Wave Dataset for In-the-Wild Mobile and Wearable Affect Sensing
- Tasteply: Externalizing Stable and Situational Preference as Manipulable Spatial Objects
- Shielded Trajectory Sampling for Personalized Relational Safety in Conversational AI
- From Tasks to Turns: Measuring Human Labor Contributions in Human-Agent Joint Production
- Reconstruction and Reflection of Positive Experiences through Resurfacing Laughter-indexed Everyday Moments
- LLM-Assisted Reranking to Operationalize Nuanced Objectives in Recommender Systems