Select Page
Grey hexagonal mosaic with five discs growing from left to right, alternating dark and light, and two neighbouring hexagons outlined in orange

Adversarial attacks and a visual illusion exploit the same weakness in a fly vision model

26 November 2026 | CRM News

In FlyNet, a model wired like the fruit fly’s visual system, both turn out to break the same correlation used to detect motion.

A sphere approaching the viewer, frame by frame, sampled on a hexagonal grid as FlyNet’s input is. Its contrast flips between frames, as in reverse-phi, and the two orange hexagons mark neighbouring points that a motion detector compares. Image: CRM

At NeurIPS 2026, CRM PhD student Alexandre Garcia-Duran will present a study of FlyNet, a model of the fruit fly's visual system that copies the wiring of real fly neurons. Textures designed to fool the model turn out to exploit the same motion computation as reverse-phi, a visual illusion that also misleads real flies and people.

Alexandre Garcia-Duran, a PhD student in the CRM’s Computational and Mathematical Neuroscience group, will present a study on a model of the fruit fly’s visual system at NeurIPS 2026, where he shares first authorship with Alejandro Rodriguez-Garcia of Newcastle University. The paper tests how well FlyNet, a model that copies the wiring of the fly’s visual system, resists patterns designed to deceive it. The attacks that fool it turn out to exploit the same motion computation as reverse-phi, an illusion that also misleads real flies and people.

That link was not what the team set out to find.

The project began at the 2025 Cajal NeuroAI summer school in Lisbon, where participants team up on projects the teachers usually propose. “You have one or two weeks to do it, so you don’t expect anything big to come out of it,” Garcia-Duran says. This group kept going after the school.

The goal was to measure something that eyes and brains seem to manage. “Biological vision is very robust,” he says. “You can still instantly recognise a friend’s face in the dark, from the side, or half-hidden behind a coffee cup.” To quantify that for the fly, “you need this kind of model, where you use the brain’s real connections.”

FlyNet, the model they needed, already existed. It comes from a 2024 Nature paper whose first author, Janne K. Lappalainen of the Allen Institute in Seattle, also participated in the project. Its 45,669 neurons and 1.51 million connections come from the connectome of the fly’s optic lobe, the map of how its neurons are wired. “With this model alone, you can already recover a lot of the data and results from experiments done with real flies,” Garcia-Duran says.

“You can still instantly recognise a friend’s face in the dark, from the side, or half-hidden behind a coffee cup.”

Alexandre Garcia-Duran

Real flies also guided the choice of test. The team picked collision detection because “it’s a very important behaviour for the fly, and one that has been studied a lot.” In a 3D simulation, a sphere or a cube heads towards the observer and either hits or misses, while a small decoder reads FlyNet’s 5,768 motion-detecting neurons to tell which.

Telling hit from miss is what the attacks try to spoil. An attack, in Garcia-Duran’s words, “basically means you take a stimulus and change it a little to try to create an illusion for the model, so that it thinks it’s something other than what it’s seeing.” Here the change is a texture painted on the approaching object and optimised in the 3D scene until the model gets the answer wrong.

Grid of black-and-white adversarial textures, five attack methods by five strengths

Textures optimised to fool FlyNet. Each row is a different attack method, and the change grows stronger from left to right. Image: Garcia-Duran, Rodriguez-Garcia et al., arXiv:2611.14498

The optimised textures did their job, FlyNet’s accuracy plummeted, and the model concluded that objects on a collision course would miss. Everyday damage to the video, such as noise, flicker, jitter or fog, left its answers largely intact.

What the attacks share with reverse-phi

A visual illusion caught it out as well. Reverse-phi appears when the contrast of a moving pattern is inverted from one frame to the next. Some animals such as humans, macaques and flies then perceive the motion reversed, and flies turn their bodies the wrong way. In FlyNet’s scenes, flipping the object’s contrast at regular intervals made the model’s estimated probability of a collision drop sharply at each flip.

Animation: black and white dots on a grey background that seem to drift to the rightAnimation: black and white dots on a grey background that swap colour as they step to the right, and seem to drift to the left

Phi and reverse-phi, with random dots. In both movies the dots change on every frame, and half of them reappear in the next frame a short step to the right. In the upper movie they keep their colour and seem to drift right. In the lower one they come back with black and white swapped, and seem to drift left. Movies: Clark Lab, Yale University

That drop was meant as a check. “We first used reverse-phi to validate the model against an illusion,” Garcia-Duran says. The question that joins the two came later: “Which computation are both of them breaking?”

Plots of FlyNet's hit probability over time under flicker, an adversarial texture and reverse-phi, with position and speed errors

FlyNet’s estimated probability of a hit as an object approaches, in red, with the unaltered stimulus in black. Under flicker it still reaches the right answer (a). An adversarial texture drives it close to zero (b), and reverse-phi pulls it down while the contrast is inverted, in the grey window (c), when its estimates of position and speed also go wrong (d). Image: Garcia-Duran, Rodriguez-Garcia et al., arXiv:2611.14498

“What we see is that it’s the same path, and that’s what’s interesting,” he says. In his words, both break “an estimate of whether the object is coming or not”, and the calculation underneath is basically a correlation. “You look at where I am now and where I am afterwards, and if I see that I’m here now and a few metres to the right afterwards, then I’ve moved to the right. It’s that simple.” It is the correlation at the heart of the motion detector that Bernhard Hassenstein and Werner Reichardt proposed in 1956, a model that compares neighbouring points of the image a short time apart. It was already known that reverse-phi inverts it, and the study shows that the adversarial textures do too.

Tuning textures to push that correlation down, without consulting the network at all, was enough to fool the model. For objects on a collision course, it cut the estimated probability of a hit to about 0.3, while pushing the correlation up kept it above 0.8. To the authors’ knowledge, no perceptual illusion had been tied before to an adversarial stimulus in the same system, at the level of a computation both exploit.

Cartoon of a looming ball over two frames, with inner and outer pixel signals and the correlation formula

The correlation behind both effects. As the ball looms, its edge reaches an inner pixel (In) a moment before its outer neighbour (Out). Delaying the inner signal by that moment lines the two up, and g(τ) multiplies them, subtracts the reverse pairing and averages over time and pixel pairs. Image: Garcia-Duran, Rodriguez-Garcia et al., arXiv:2611.14498

The fly’s wiring pays off elsewhere, in efficiency. Each time it processes its input, FlyNet needs 0.186 billion arithmetic operations, against 27,402 billion for RAFT-12, a standard network for estimating motion in video. “We’re talking about 45,000 neurons but only 1.5 million connections, which is very few,” Garcia-Duran says.

The wiring itself does not seem to make FlyNet harder to fool, though. Networks that work the same way but without the fly’s detailed wiring held up better under almost every perturbation tested, and one of them, pruned to FlyNet’s number of connections, ran at almost the same cost. The authors see this as a tentative reading of limited evidence, and more comparisons will be needed to confirm it. For them, the results also suggest that the efficiency of sparse wiring may not be unique to the fly’s own circuit.

Illusions in flies and in people

Garcia-Duran’s thesis at the CRM, supervised by Alexandre Hyafil and Manuel Molano-Mazón, both co-authors of the study, works with people instead of flies, and it also turns on an illusion. It deals with bistable perception, which occurs when an image has two interpretations that alternate. “Perceptual illusions are useful because they reveal the hidden shortcuts and rules your brain uses to make sense of the world,” he says. The fly study is “the same kind of analysis”, with very different systems and methodology.

For projects like this one, he explains, the mathematics comes mainly from dynamical systems and from machine learning, which leans heavily on calculus and algebra. His own route into it ran through biomedical engineering at the Universitat de Barcelona and a master’s degree in mathematics at the Universitat Politècnica de Catalunya (UPC), completed in 2023. With both supervisors he has also co-authored a 2024 Nature Communications paper on how rats and people adjust their movements as evidence for a decision builds up.

“Perceptual illusions are useful because they reveal the hidden shortcuts and rules your brain uses to make sense of the world.”

Alexandre Garcia-Duran

At NeurIPS, presenting the fly paper will mean choosing what to leave out. “You have to know how to get your message across without going into the details,” he says, “and still have people remember what you want them to remember.” Conferences also bring outside feedback. “Sometimes you’re so deep into your project that you lack a bit of abstraction, of zooming out and seeing where you’re doing things right.”

The authors see models like FlyNet as a way to turn adversarial attacks into predictions that experiments can test, and since mammals share the same correlation-based motion motif, larger connectome models could point to candidate illusions in mammals too. “Now, with these stimuli we’ve made, the next step is to talk to an experimental group to test this approach,” Garcia-Duran says.

Reference

Alexandre Garcia-Duran, Alejandro Rodriguez-Garcia, Manuel Molano-Mazón, Alexandre Hyafil, Srikanth Ramaswamy and Janne K. Lappalainen (2026). Measuring Robustness and Efficiency in a Connectome-Constrained Fly Visual System Model: Linking an Adversarial and a Perceptual Illusion. NeurIPS 2026. arXiv:2611.14498

More from the CRM

The CRM Mentoring Programme, as Told by One of Its Pairs

PhD student Joaquim Duran and mathematician Robert Cardona, one of the pairs in the CRM Mentoring ProgrammeJoaquim Duran (left) and Robert Cardona.CRM CommPau VarelaCRMComm@crm.catGet the latest CRM news and activities in your inbox.Recent...