Predicting Human Visual Attention on Words in Source Code
Abstract
This paper presents a computational model to predict human visual attention over words in software source code. The visual attention of software engineers when reading source code has long been studied as a means to understand human cognitive processes during software engineering tasks. Predicting this visual attention is important for perfecting user interface design and understanding what information human programmers need. We propose a model of programmer visual attention in which we design a novel loss function that computes similarity between human attention measured during eye tracking experiments and the internal attention of the artificial neural network. We evaluate our model by comparing its outputs to actual eye tracking data from three separate datasets. Two are in the Java programming language and one is in the C programming language. Our model outperforms the baseline in software engineering by 64%, 16%, and 467% in each of these studies according to Pearson correlation. We used scanpath prediction as an example to demonstrate that our model is more capable of the task that requires the understanding of human thought process. Our model achieves a statistically significant improvement over the close baseline in the reading task according to normalized Levenshtein distance and outperforms both Claude and GPT-5 on both reading and writing tasks.
Create a lesson
Metadata
- Comments
- 13 pages, 1 figure, preprint under review
Related papers
Generating Property-Based Regression Tests from Source Code Semantics
Shared title terminologycs.SEClemens Bauer, Johann Glock, Martin Pinzger
fx(hash): Salvaging The Source Code of 28k Generative Artworks
Shared title terminologycs.SEBenoit Baudry, Valeriia Bezklynska, Martin Monperrus
Structural Validation of LLM-Generated Microservice Decompositions Using Source-Code Dependencies
Shared title terminologycs.SEDaniel Silva, Renan Alves, Emanuel Dantas Filho et al.
A First Look at Coding Agents' Compliance with AI Contribution Rules in Open-Source Communities
Shared title terminologycs.SEWenhao Yang, Runzhi He, Minghui Zhou
ATLAS: Multi-View Code Representation Tool for C and C++ Source Programs
Shared title terminologycs.SEJaid Monwar Chowdhury, Ahmad Farhan Shahriar Chowdhury, Humayra Binte Monwar et al.
Pixels for Programs? A Cross-Provider Case Study of Input-Token Accounting for Source Code as Text and Images
Shared title terminologycs.SERonak Bhalgami