ARTICLE https://doi.org/10.1038/s41467-021-21501-z OPEN Flexible categorization in perceptual decision making Genís Prat-Ortega 1,2 ✉, Klaus Wimmer 2,3,4, Alex Roxin2,3,4,5 & Jaime de la Rocha 1,4,5 ✉ Perceptual decisions rely on accumulating sensory evidence. This computation has been studied using either drift diffusion models or neurobiological network models exhibiting 1234567890():,; winner-take-all attractor dynamics. Although both models can account for a large amount of data, it remains unclear whether their dynamics are qualitatively equivalent. Here we show that in the attractor model, but not in the drift diffusion model, an increase in the stimulus fluctuations or the stimulus duration promotes transitions between decision states. The increase in the number of transitions leads to a crossover between weighting mostly early evidence (primacy) to weighting late evidence (recency), a prediction we validate with psychophysical data. Between these two limiting cases, we found a novel flexible categor- ization regime, in which fluctuations can reverse initially-incorrect categorizations. This reversal asymmetry results in a non-monotonic psychometric curve, a distinctive feature of the attractor model. Our findings point to correcting decision reversals as an important feature of perceptual decision making. 1 Institut dʹInvestigacions Biomèdiques August Pi i Sunyer (IDIBAPS), Barcelona 08036, Spain. 2 Centre de Recerca Matemàtica (CRM), Campus de Bellaterra, Edifici C, 08193 Bellaterra, Barcelona, Spain. 3 Barcelona Graduate School of Mathematics, Barcelona, Spain. 4These authors jointly supervised this work: Klaus Wimmer, Alex Roxin, Jaime de la Rocha. 5These authors contributed equally: Alex Roxin, Jaime de la Rocha. ✉email: genisprat@gmail.com; jrochav@clinic.cat NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 1 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z I ntegrating information over time is a fundamental computa- experiments34,35 and show that the attractor model can quanti- tion that neural systems can adaptively perform in a variety of tatively fit the crossover from primacy to recency with the sti- contexts. The integration of perceptual evidence is an example mulus duration, and the integration and storage of evidence when of such computation, and its most common paradigm is the stimuli are separated by a memory delay. Our characterization of binary categorization of ambiguous stimuli characterized by a the flexible categorization regime in the attractor model reveals stream of sensory evidence. This process is typically modeled with that correcting transitions may be a key property of evidence the drift diffusion model with absorbing bounds (DDMA) which integration in perceptual decision making. integrates the stimulus evidence linearly until one of the bounds is reached1. The DDMA and its different variations have been Results successfully used to fit psychometric and chronometric curves1,2, Canonical models of perceptual decision making result in to capture the speed-accuracy trade-off1–3, to account for history stereotypical psychophysical kernels. We start by characterizing dependent choice biases4, changes of mind5, confidence reports6, the dynamics of evidence integration in standard drift diffusion or the Weber’s law7. Although the absorbing bounds were ori- models during a binary classification task. These models are ginally thought of as a mechanism to terminate the integration described as the evolution of a decision variable x(t) that inte- process, the DDMA has also been applied to fixed duration grates the moment-by-moment evidence S(t) provided by the tasks8–10. In motion discrimination tasks, for instance, it can stimulus, plus a noise term reflecting the internal stochasticity in reproduce the subjects’ tendency to give more weight to early the process1,30,31. rather than late stimulus information, which is called a primacy dx effect8,10–14. However, depending on the details of the task and τ ¼ Sðt Þ þ σ I ξ I ðt Þ; ð1Þ the stimulus, subjects can also give more weight to late rather dt than to early evidence (i.e., a recency effect)15,16 or weigh the where τ is the time constant of the integration process. The evi- whole stimulus uniformly17. In order to account for these dif- dence S(t) fluctuates in time and can be written as a constant ferences, the DDMA needs to be modified by using reflecting mean drift μ, plus a time-varying term, caused by the fluctuations instead of absorbing bounds or by removing the bounds alto- of the input stimulus: S(t) = μ + σSξS(t). We call σS the magnitude gether18. Despite their considerable success in fitting experi- of stimulus fluctuations. Assuming that both fluctuating terms, ξI mental data, the DDMA and its many variants remain purely and ξS are Gaussian stochastic processes, Eq. 1 can be recast as the phenomenological descriptions of sensory integration. This motion of a particle in a potential: makes it difficult to link the DDMA to the actual neural circuit dx dφðxÞ mechanisms underlying perceptual decision making. τ ¼ þ σ S ξ S ðt Þ þ σ I ξ I ðt Þ; ð2Þ These neural circuit mechanisms have been studied with bio- dt dx physical attractor network models that can integrate stimulus where the potential φ(x) = −μx (Fig. 1d–f, inset). The conceptual evidence over relatively long time scales19,20. Attractor network advantage of using a potential relies on the fact that the dynamics models have been used, among other examples, to study the of the decision variable always “roll downward” towards the adjustment of speed-accuracy trade-off in a cortico-basal ganglia minima of the potential with only the fluctuation terms ξS(t) or circuit21, learning dynamics of sensorimotor associations22, the ξI(t) causing possible motion upward. Notice that, although the generation of choice correlated sensory activity in hierarchical term ξS(t) is modeled as a noise term, it represents the temporal networks23–25, the role of the pulvino-cortical pathway in con- variations of the stimulus which are under the control of the trolling the effective connectivity within and across cortical experimenter. The existence of decision bounds can be readily regions26 or how trial history biases can emerge from the circuit introduced in the shape of the potential, which strongly influ- dynamics27. In the typical regime in which the attractor network ences how stimulus fluctuations impact the upcoming decision. was originally used for perceptual categorization19,28, the impact To quantify this impact, we used the Psychophysical Kernel (PK) of the stimulus on the decision decreases as the network evolves which measures the influence of the stimulus fluctuations on the towards an attractor. In this regime, the integration dynamics of decision during the course of the stimulus (see Methods): (1) In the attractor model are qualitatively similar to those of the the DDMA (Fig. 1a), absorbing bounds are implemented as two DDMA as it also shows a primacy effect. Moreover, the attractor vertical “cliffs” such that when the decision variable arrives at one network can also provide an excellent fit to psychometric and of them, it remains there for the rest of the trial. When this chronometric curves19,28. Thus, a common implicit assumption is happens, the fluctuations late in the stimulus are unlikely to affect that the attractor network is simply a neurobiological imple- the decision, yielding a decaying PK characteristic of a “primacy” mentation of the DDMA29,30 and hence there has been more effect8,18,31,33,36. (2) In the Drift Diffusion Model with Reflecting interest in studying the similarities between these two models bounds (DDMR) (Fig. 1b), the bounds are two vertical walls that rather than their differences31 (but see refs. 32,33). set limits to the accumulated evidence; early stimulus fluctuations Here, we show that the attractor model has richer dynamics are largely forgotten once the decision variable bounces against beyond the well known primacy regime. In particular, the model one bound and hence the PK shows a “recency” effect18. (3) In exhibits a crossover from primacy to recency as the stimulus the Perfect Integrator (PI) (Fig. 1c), there are no bounds, the fluctuations or stimulus duration are increased. Intermediate to stimulus is integrated uniformly across time yielding a flat PK17. these two limiting regimes, the stimulus can impact the upcoming Thus, each of these three canonical models performs a qualita- decision nearly uniformly across the entire stimulus duration. tively distinct integration process by virtue of how the bounds are Specifically, if the first attractor state reached corresponds to the imposed. Moreover, the characteristic integration dynamics of incorrect choice, stimulus fluctuations later in the trial can lead to each model is invariant to changes in the stimulus parameters. To a correcting transition, while if the initial attractor is correct, illustrate this, we show how the PKs depended on the magnitude fluctuations are not strong enough to drive an error transition. As of the stimulus fluctuations, σS (Fig. 1). For very weak stimulus a consequence, the model shows a non-monotonic psychometric fluctuations, all three models are trivially equivalent because the curve as a function of the strength of stimulus fluctuations, and bounds are never reached and hence the PKs are flat (Fig. 1d–f). the maximum occurs precisely in this intermediate “flexible As σS increases, in both the DDMA and the DDMR, the bounds categorization” regime. To illustrate the relevance of our theo- are reached faster yielding an increase and a decrease of the PK retical results, we re-analyze data from two psychophysical slope, respectively (Fig. 1h). In these two models, the integration 2 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE Fig. 1 Dynamics of evidence accumulation in the canonical drift diffusion models. a–c Single-trial example traces of the decision variable x(t) for weak (σS = 0.03) and intermediate (σS = 0.28) stimulus fluctuations in the three canonical models. a The DDM with absorbing bounds integrates the stimulus until it reaches one of the absorbing bounds represented in the potential landscape as infinitely deep attractors (see inset in d). The slope of the potential landscape is the mean stimulus strength, in this case μ < 0. b The DDM with reflecting bounds integrates the stimulus linearly until a bound is reached when no more evidence can be accumulated in favor of the corresponding choice option (see inset in e). c The perfect integrator integrates the entire stimulus uniformly, corresponding to a diffusion process with a flat potential (see inset in f). In the three models, the choice is given by the sign of x(t) at stimulus offset. d–f Psychophysical Kernels (PK) for the three canonical models for increasing magnitude of the stimulus fluctuations (from left to right): σS = 0.03, 0.28, and 0.69. The PK measures the time-resolved impact of the stimulus fluctuations on choice (see Methods). g–h Normalized PK area and normalized PK slope as a function of σS for the three canonical models (see inset in g for color code). The area is normalized by the PK area of the perfect integrator with no internal noise (σi = 0) and hence measures the ability of each model to integrate the stimulus fluctuations. In all panels, internal noise was fixed at σI = 0.1 (see arrows in g and h) which was sufficiently small to prevent x(t) from reaching the bounds in the absence of a stimulus. Mean stimulus evidence was μ = 0 in all cases. of evidence becomes more and more transient as σS increases, (Fig. 2a, inset). The three terms of the potential, from left to ultimately causing a decrease of the PK area (Fig. 1g). Including right, capture (1) the impact of the net stimulus evidence μ which, collapsing bounds in the DDMA did not modify the picture as in the canonical models, tilts the potential towards the attractor qualitatively, with the integration becoming more transient as the associated with the correct choice; (2) the model’s internal velocity of the collapsing bounds increased (Supplementary categorization dynamics parameterized by the height of the Fig. 1). The PK for the PI remains flat for all σS (zero PK slope, barrier separating the two attractors (which scales with α2), and Fig. 1h) and its area increases monotonically (Fig. 1g). Thus, the (3) bounds, also arising from the internal dynamics, that limit the dynamics of evidence accumulation are an invariant and distinct range over which evidence is accumulated. We found that the property of each model. DWM had a much richer dynamical repertoire as a function of stimulus fluctuations magnitude than the canonical models. Neurobiological models show a variety of integration regimes. Specifically, the attractors imposed the categorization dynamics, We next characterized the dynamics of evidence accumulation in but these could be overcome by sufficiently strong stimulus the double well model (DWM), which can accurately describe the fluctuations. Thus, for weak σS, the categorization dynamics dynamics of a biophysical attractor network model19,28. The dominated: when the system reached an attractor, it remained in DWM exhibits winner-take-all attractor dynamics defined by the this initial categorization until the end of the stimulus. In this nonlinear potential φ(x): regime, only early stimulus fluctuations occurring before reaching an attractor could influence the final choice, yielding a primacy φðxÞ ¼ μx  αx2 þ x4 : ð3Þ PK19,23 (Fig. 2c, second line from the left). For strong σS, the initial categorization had no impact on the final choice because The resulting energy landscape can exhibit two minima (i.e., transitions between the attractors occurred readily. It was the attractor states) corresponding to the two possible choices fluctuations coming late in the trial which determined the final NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 3 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z Fig. 2 Dynamics of evidence accumulation in the double well model. a, b Single-trial example traces of the decision variable for the DWM with weak (a, σS = 0.1) and intermediate (b, σS = 0.58) stimulus fluctuations σS. Transitions between attractors were only possible for sufficiently strong σS (insets). c PKs for increasing values of σS (from left to right, σS = 0.02, 0.1, 0.58, and 1). d PKs for increasing values of stimulus duration T (from left to right, T = 0.5, 1, and 2.5 with σS = 0.58). e, f Normalized PK slope and PK area as a function of σS. Colored dots indicate the examples shown in panel c. The area peaks at the flexible categorization and it vanishes for small σS because choice is then driven by internal noise. g, h Normalized PK slope and area as a function of T with σS = 0.58. As T increases, the DWM integrates a smaller fraction of the stimulus making the area decrease monotonically. Internal noise was σI = 0.1 in all panels (see arrows in panels e and f). state of the system and hence the PK showed recency (Fig. 2c, P(μ) (Fig. 3a, dark brown curve). As σS increased, this curve orange). For moderate values of σS, there was an intermediate became shallower simply because larger fluctuations implied a regime in which the PK was a mixture between primacy and drop in the signal-to-noise ratio of the stimulus (Fig. 3a, red and recency, but not necessarily flat (Fig. 2c, third line from the left). orange curves). Unexpectedly, however, the decline in sensitivity We called this regime flexible categorization because it repre- of the curve P(μ) was non-monotonic (Fig. 3a), an effect which sented a balance between the internal categorization dynamics was best illustrated by plotting the less conventional psychometric and the ability of the stimulus fluctuations to overcome their curve P(σS) at fixed μ (Fig. 3a, b, black curve). To understand this attraction (Fig. 2b). As a result of this balance, the stimulus non-monotonic dependence, we first defined two transition fluctuations impacted the choice over the whole trial (PK slope = probabilities: the correcting transition probability pC was the 0; Fig. 2e) because both initial fluctuations and later fluctuations probability to be in the correct attractor at the end of a trial, given causing transitions had a substantial impact on choice. Moreover, that the first visited attractor was the error. The error-generating these fluctuations causing transitions were more temporally transition probability pE was the opposite, i.e., the probability to extended than those in the recency regime (Supplementary finish in the wrong attractor given that the correct one was visited Fig. 2a). Thus, the area of the PK reached its maximum first (see Methods). Using Kramers’ reaction-rate theory37 the (maximum area = 0.82; Fig. 2f) implying that the integration of transition probabilities could be analytically computed, and the the stimulus fluctuations carried out by DWM was comparable to accuracy P could be expressed as the probability to initially a PI (which has PK area equal 1). The same crossover from make a correct categorization and maintain it, plus the prob- primacy to recency regimes, passing through the flexible ability to make an initial error and reverse it: categorization regime, could be achieved, at fixed σS, by varying     P ¼ P0 1  pE þ 1  P0 pC ; ð4Þ the stimulus duration (Fig. 2d, g). This occurs because for a fixed magnitude of stimulus fluctuations, the rate of transitions was where P0 was the probability of first visiting the correct attractor constant but the probability to observe a transition increased with (Methods). When the fluctuations were negligible σS ≈ 0, the the stimulus duration changing the shape of the PK accordingly decision variable always rolled down towards the correct choice (Fig. 2d). In sum, depending on the capacity of the stimulus to because the double well potential was tilted to the correct generate transitions between attractors, the DWM model could attractor (e.g., μ > 0), and hence P = 1 (Fig. 3b i). As σS started to operate in the primacy, the recency, or the flexible categorization increase, fluctuations early in the stimulus could cause the system integration regime. to fall into the incorrect attractor but, because fluctuations were not sufficiently strong to generate transitions (pE ≈ pC ≈ 0), accuracy was P = P0 (Eq. 4) and decreased with σS towards Decision accuracy in models of evidence integration. Given that chance (gray line in Fig. 3b). As the stimulus fluctuations grew the DWM changes its integration regime when σS is varied, we stronger, the transitions between attractors became more likely next investigated the impact of this manipulation on the decision but, because the barrier to escape from the incorrect attractor was accuracy. We set the internal noise to σI = 0 and computed the smaller than the barrier to escape from the correct attractor, the psychometric function P(μ,σS) showing the proportion of correct two transition probabilities were very different. Specifically, choices as a function of the mean stimulus evidence μ and the Kramers’ theory shows that the ratio between pC and pE depends strength of stimulus fluctuations σS. For small fixed σS the section exponentially on the barrier height difference (see Methods). of this surface yielded a classic sigmoid-like psychometric curve Thus, pC increased steeply with σS, even before pE reached non- 4 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE Fig. 3 Impact of stimulus fluctuations on choice accuracy in the double well model. a Probability of a righward choice as a function of the mean stimulus evidence (μ) and the stimulus fluctuations (σS). The colored lines show classic psychometric curves, accuracy versus μ (for fixed σS = 0.07, 0.26, 0.46, and 0.90) whereas the black line shows the accuracy versus σS (for fixed μ = 0.15). b Accuracy (P) as a function of the stimulus fluctuations σS obtained from numerical simulations (dots) and theory (line, same as black line in a). Insets show the PK for three values of σS (marked with colored dots). The gray line shows the accuracy of the first visit attractor (P0). c Probability to make a correcting pC (green) or an error transition pE (black) and their difference pC − pE (gray). The local maximum in P coincides with the maximum difference between the two probabilities. Insets: sequence of regimes as transitions become more likely: (i) For negligible σS, the decision variable always evolves towards the correct attractor; (ii) as σs increases, the decision variable can visit the incorrect attractor but neither kind of transition is activated; (iii) for stronger σS, only the correcting transitions (green arrow) are activated; (iv) for strong σS, both types of transition are activated. d Normalized PK slope as a function of σS. The flexible categorization regime, reached when the index is close to zero, coincides with the local maximum in accuracy (a). e Accuracy versus σS for different stimulus durations T (see inset). The accuracy for any finite T shifts as σS increases between the probability to first visit the correct attractor P0 and the stationary accuracy P∞. f Accuracy versus σS for different magnitudes of the internal noise (see inset). g Accuracy versus σS for the three canonical models (see inset). The internal noise was σi = 0 in all panels except in f. negligible values (Fig. 3c) opening a window in which  transitions  local maximum (Fig. 3b–d). Finally, for strong σS, error transi- were only correcting: accuracy became P ’ P0 þ 1  P0 pC and tions also became likely and the net effect of stimulus fluctuations it increased with σS (Fig. 3b iii). The maximum difference was again deleterious, causing a decrease of P. In sum, it was the between pC and pE coincided with the flexible categorization large difference in transition probabilities caused by the double regime in which the PK slope was zero and the accuracy showed a well landscape which led to the non-monotonic dependence of NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 5 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z function of the transition rates and the stimulus duration (see Methods, Eqs. 17 and 18): P ¼ P0 expðkT Þ þ P1 ½1  expðkT Þ; ð5Þ where k is the sum of the transition rates from both attractors and P∞ is the stationary accuracy (i.e., the limit of P when T→∞). As expected, the two psychometric curves P0 and P∞, which decreased monotonically with σS, delimited the region in which P existed: for weak σS, P followed the decay of the psychometric curve P0, whereas for strong σS it tracked the decay of the stationary accuracy P∞. The switching point occurred when the probability to observe a transition was substantial, i.e., when kT ~ 1. For longer stimulus durations, the activation of the transitions occurred for weaker σS and consequently the bump in accuracy was shifted towards the left also becoming more prominent (Fig. 3e, Methods). For very short T, the activation of the transitions occurred for such a large value of σS that the two curves P0 and P∞ have come too close and the psychometric P(σS) was then monotonically decreasing (Fig. 3e). Finally, when we set the internal noise to a nonzero value, it sets a minimal level of fluctuations below which no stimulus magnitude σS could go, effectively cropping the psychometric curve P(σS) from the left (Fig. 3f). Only when the internal noise was larger than a critical value the psychometric curve became monotonically decreasing (Supplementary Fig. 3, see Methods for the computation of the critical noise value). In sum, the non-monotonicity of the psychometric curve was a robust effect, being most prominent Fig. 4 Dependence of choice consistency on stimulus fluctuations. for values of the mean stimulus evidence μ yielding an a Average consistency versus stimulus fluctuations σS for different values of intermediate accuracy (i.e., P ~ 0.75), long stimulus durations the internal noise σI (see inset in b). b Difference between the transition and weak internal noise. probabilities with (pR,L(σS,σI)) and without (pR,L(σS,σI = 0)) internal noise. The drop in consistency coincides with an increase of this difference Consistency in models of evidence integration. In order to revealing the σS-range in which transitions occurred because of the identify further signatures of the nonlinear attractor dynamics cooperation of internal and stimulus fluctuations. c Consistency versus σS that could be tested experimentally, we studied the choice con- for the canonical models. The consistency of the perfect integration is at sistency of the DWM. Choice consistency is defined as the chance level because we used stimuli with exactly zero integrated evidence probability that two presentations of the same exact stimulus, i.e., (see Methods). d–g Temporal evolution of the decision variable probability the same realization of the stimulus fluctuations, yield the same distribution f(x,t) for an example stimulus in the different regimes of σS: for choice. In the absence of internal noise, the decision process in negligible σS the choice is driven by the internal noise and the consistency is the model is deterministic and consistency is 1. In contrast, when very low (53.2%, d). For small σS, when the stimulus determines the first the stimulus has no impact on the choice, the consistency is 0.5. visited attractor but fluctuations are not strong enough to produce We used the double-pass method, which presents each stimulus transitions, the consistency is very high (97.8%, e). For intermediate σS, the twice12,38,39, to explore how consistency in the DWM depended transitions can only occur when σI and σS work together to cause a large on σS and σI (Fig. 4). We only used μ = 0 stimuli with exactly zero fluctuation. Because the internal noise has again impact on the choice, the integrated evidence in order to avoid the parsimonious increase consistency decreases (51.7%, f). For large σS, the stimulus fluctuations are of consistency due to larger deviations of the accumulated evi- strong enough to produce transitions by itself and the consistency is again dence from the mean (see Methods). As expected, consistency very high (100%, g). h Consistency versus σS obtained just using the was close to 0.5 when σS was small compared to σI, and it example stimulus shown in d–g (points mark the σS values shown in d–g). increased with increasing σS (Fig. 4a). However, despite this Mean stimulus evidence was μ = 0 in all panels. general increase, we found a striking drop in consistency for a range of intermediate σS values. Thus, consistency could depend non-monotonically on the strength of stimulus fluctuations, a the psychometric curve. Because the canonical models lacked similar effect as observed for choice accuracy. To understand this attractor dynamics, the accuracy in all of them decayed mono- effect, we studied the time-course of the decision variable x over tonically with the stimulus fluctuations (Fig. 3g). many repetitions of a single stimulus, at different values of σS We next asked whether the non-monotonicity of the psycho- (Fig. 4d–h). For very small σS, consistency was 0.5 because the metric curve was robust to variation of other parameters such as internal noise was the dominant factor making both choices the mean stimulus evidence μ, the stimulus duration T, and the equally likely (Fig. 4d). As σS grew, stimulus fluctuations could internal noise σI. We found that the non-monotonicity was determine the first visited attractor but decision reversals were robustly obtained over a broad range of μ, ranging from small still not activated, yielding a high consistency (Fig. 4e). For larger values just above zero to a critical value beyond which the curve σS, transitions occurred but only when internal noise and the became monotonically decreasing (Supplementary Fig. 3). stimulus fluctuations worked together to produce a large fluc- Because the transition probabilities scale with the stimulus tuation (Fig. 4f). The necessary contribution of the internal noise, duration T, the psychometric curve P(σS) was strongly affected that varied from trial-to-trial, led to the decrease in consistency. by changes in T (Fig. 3e). To understand this dependence, we Once σS was large enough to cause reversals on its own, con- rewrote the transitions probabilities pC and pE from Eq. 4 as a sistency increased again (Fig. 4g). Thus, as with the non- 6 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE Fig. 5 Signatures of flexible categorization dynamics in a spiking network. a Schematic of the spiking network consisting of two stimulus-selective populations (green and purple) made of excitatory neurons that compete through an untuned inhibitory population (white population). b Accuracy PC versus stimulus fluctuations σS obtained from simulations of the spiking network for three values of the stimulus duration T = 2, 4, and 6 s (see inset). c–e Single-trial examples showing spike rastergram from the two excitatory populations (1000 + 1000 neurons) (c), traces of the instantaneous population rates (count window 30 ms) (d) and of the input stimuli (e), for different values of stimulus fluctuations σS = 2 (left), 4.5 (middle), and 9 pA (right). Colored points in (b) indicate the σS used. f Psychophysical kernels obtained for each σS value. The mean stimulus input was μ = 0.015 and the stimulus duration T = 4 s. g Psychophysical kernels for σS = 5 pA and different stimulus duration T = 1, 3, and 5 s, from left to right. monotonicity in the psychometric curve, it was the difference reproduced in a more biophysically realistic network model between two transition probabilities, the transition probability composed of leaky integrate-and-fire neurons (Methods). The with internal noise versus the probability without internal noise, network consisted of two populations of excitatory (E) neurons that was maximal when consistency decreased (Fig. 4b). Also as (NE = 1000 for each population), each of them selective to the before, to observe the non-monotonicity in the consistency, σI evidence supporting one of the two possible choices, and a had to be sufficiently small not to cause transitions on its own nonselective inhibitory population (NI = 500) (Fig. 5a). The (Fig. 4a, b). Notice however that the non-monotonicity here was network had sparse, random connectivity within each population not caused by the asymmetry between correcting versus error (probability of connection between neurons was 0.1) and neurons transitions, as consistency was computed using μ = 0 stimuli (i.e., were coupled through current-based synapses with exponential there was no correct choice). The effect was a result of the decay. The stimulus was modeled as two fluctuating currents, nonlinear attractor dynamics of the DWM and thus it could not reflecting evidence for each of the two choice options and injected occur in any of the canonical models (Fig. 4c). into the corresponding E population. The two currents were parametrized by their mean difference μ and their standard deviation σS (see Methods). In addition, all neurons in the net- Flexible categorization in a spiking network with attractor work received independent stochastic synaptic inputs from an dynamics. Having shown that the DWM generates signatures of external population. As in previous attractor network models attractor dynamics which are qualitatively different from any used for stimulus categorization, the two E populations competed canonical model, we then assessed whether these could be through the inhibitory population19. Thus, upon presentation of NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 7 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z Fig. 6 The double well model accounts for experimentally observed changes in psychophysical kernels. a Psychophysical kernels for different stimulus durations, obtained from human subjects performing a brightness discrimination task (N = 21)34. From left to right, stimulus duration was T = 1, 2, 3, and 5 s. b Psychophysical kernels obtained by fitting the DWM to categorize the very same stimuli presented to the human subjects (i.e., same temporal fluctuations of net evidence; see Methods). Lines represent the kernels obtained from pooling all data across subjects and the error bands represent s.e.m. c–f Example traces of the decision variable of the fitted DWM (c, e) and the stimulus (d, f) for 1 and 3 s trials. Notice that the stimulus fluctuations mimicked the visual stimulus which was made of time frames of 100 ms. an external stimulus, there were two stable solutions: one solu- Changes in PK with stimulus duration in human subjects tion in which one E population fired at a high rate while the other unveiled the flexible categorization regime. We tested whether fired at a low rate and vice versa (Fig. 5). Notice that in contrast the DWM could parsimoniously account for the variations of the with the DWM in which the noise was white (i.e., temporally integration dynamics previously found in a perceptual categor- uncorrelated), in this network the external noise was colored ization task as the stimulus duration was varied34. In the (stimulus was an Ornstein–Uhlenbeck process with τstim = 20 experiment, human subjects had to discriminate the brightness of ms) and the internal fluctuations reflected the stochasticity of the visual stimuli of variable duration T = 1, 2, 3, or 5 s. Confirming spiking network dynamics which are strongly affected by the previous analyzes34, the average PKs across subjects changed synaptic time scales. Similar to the DWM, we found a non- from primacy to recency with increasing stimulus durations monotonic relation between the accuracy and the magnitude of (Fig. 6a). To assess whether these changes in the shape of the PKs the stimulus fluctuations σS provided the stimulus duration T was could be captured by the DWM, we used the DWM to categorize sufficiently long (Fig. 5b). Moreover, as σS increased the inte- the same stimuli (the exact same temporal stimulus fluctuations gration regimes of the network changed from primacy to recency, and number of trials; see Methods) that were presented to the passing through the flexible categorization regime (Fig. 5c–f). In human subjects (Fig. 6c–f). We found that the PKs for different this regime, transitions between attractor states occurred when stimulus durations obtained in the DWM were very similar to the there were input fluctuations that extended over hundreds of experimental data (Fig. 6b). Importantly, these results were milliseconds, indicating that the temporal integration of evidence obtained with fixed model parameters for all stimulus durations continued even after one of the attractors was reached (Supple- suggesting that the variation in PK did not necessarily indicate a mentary Fig. 2b). The crossover between primacy and recency change of the integration mechanism of the model, as previously regimes was also observed at constant σS when we varied the suggested34. Rather, fixed, but nonlinear attractor dynamics in the stimulus duration T (Fig. 5g). We went one step further in DWM parsimoniously accounted for the observed PK changes. including biophysical detail and confirmed that a conductance- based spiking neural network model with explicit AMPA, GABA, and NMDA receptor dynamics19 showed qualitatively the same Stimulus integration across a memory period is consistent with behavior (Supplementary Fig. 4). Thus, the signatures of attractor flexible categorization dynamics. Finally, we tested the DWM in dynamics that we had identified did not depend on the simpli- a task that requires evidence accumulation and working memory. fying assumptions of the DWM and could be replicated in an We used published data from two studies carrying out a psy- attractor network with more biophysically plausible parameters. chophysical experiment in which subjects had to categorize the 8 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE Fig. 7 The flexible categorization regime accounts for the combination of two pulses of evidence during a working memory task. a Visual motion categorization experiment consisting of interleaved double pulse (top) and single pulse trials (bottom)35,40. On double pulse trials, the two motion pulses were separated by a variable delay (duration 0, 120, 360, or 1080 ms). Coherences were randomly selected from trial-to-trial. In two pulse trials, they could be different but the motion direction was always congruent (N = 9). b Traces of the decision variable of the DWM (black), the internal fluctuations (yellow), and the stimulus (orange) for an example double pulse trial. c Accuracy for single (squares) and two pulse trials (dots) versus the coherence of the second pulse observed in the data from35,40 (dots) and the values obtained from the fitted DWM (lines). Because accuracy in the experiment did not depend on delay length, dots show the average accuracy across all delays. Different colors represent different first pulse coherences (see inset). Symbols show mean across subjects and error bars show 95% confidence intervals. d Primacy-recency index (PRI) for the DWM as a function of the barrier height (c2). The black dot marks the PRI for the fitted parameter α* = 0.7. The horizontal line is the PRI computed from the psychophysical data (gray area 95% confidence interval). Inset: accuracy for two pulse stimuli in which coherence is larger in pulse 2 than in pulse 1 (i.e., coh2 > coh1) versus accuracy for the same pulses presented in the reverse order (i.e., coh1 > coh2). Consistent with the recency effect, accuracy is slightly better for coh2 > coh1 stimuli. e Accuracy as a function of the delay duration for DWM and for the Perfect Integrator. In the DWM, which used the fitted parameter α* and σI = 0.32 and σS = 0.40, the accuracy is independent of the delay up to 1 s. In contrast, for the same internal noise σI, the accuracy of the perfect integrator decreases continuously for all delays. motion direction of a random dot kinematogram35,40. Interleaved the DWM could fit the accuracy across conditions quite accu- with the trials showing a single kinematogram (single pulse trials, rately (Fig. 7c). Interestingly, the fitted DWM worked close to the duration 120 ms) there were also trials having two kinemato- flexible categorization regime, matching the slight recency effect grams separated by a temporal delay (two pulse trials). In these coming out from the combination of the two pulses (Fig. 7d). two pulse trials, subjects had to combine information from both Because subjects’ accuracy did not depend on delay pulses in order to categorize the average motion direction. The duration35,40, the model fitting could only determine the value pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi two pulses could have different motion coherence but they always of the sum of the stimulus and internal noises σ ¼ σ 2I þ σ 2S and had the same motion direction (Fig. 7a). Subjects were able to set an upper bound σ max I for the internal noise: for any value combine the evidence from the two pulses and their accuracy did σ I ≤ σ max the transitions during the delay were negligible (<1%) I not depend on the duration of the delay period for durations up and the DWM yielded the same behavior (see Methods). to 1 s, meaning that they were able to maintain the evidence from Choosing the σI to be at the upper bound σ max I ; yielded a the first pulse without memory loss. Overall, subjects gave slightly constant accuracy for delays up to ~1 s. For longer delays, more weight to the second than the first pulse (Primacy-Recency however, transitions during the delay became active causing Index = 0.22; see Methods). Qualitatively, the DWM could in forgetting and accuracy decrease (Fig. 7e) as has been shown in principle capture this behavior because its underlying dynamics experiments using a broader range of delays41. In contrast, the can solve the two parts of the task, the maintenance of infor- perfector integrator did not show a range of delays over which the mation during the working memory period and the combination accuracy remained constant (Fig. 7e): the internal noise had a of the two pulses of evidence (Fig. 7b). The model would cate- much larger impact on the maintenance of stimulus evidence so gorize the first pulse in one of the attractors, which would be that, for any significant level of internal noise, the accuracy stably maintained during the delay because the internal noise is decreased continuously with delay duration. In total, our analysis insufficient to cause transitions. Finally, given the asymmetry in shows that the DWM can quantitatively fit psychophysical data the DWM transition rates (Fig. 3c), the second pulse could from a working memory task, and that longer delays could reverse incorrect initial categorizations while minimizing the risk provide a qualitative test for the model. of erroneously reversing correct ones (Fig. 7b). To assess whether the DWM could indeed fit the data quantitatively, we computed the accuracy for each stimulus condition using Kramers’ transi- Discussion tion rate theory and fitted the parameters using maximum like- We have investigated the attractor model with winner-take-all lihood estimation (solid lines, Fig. 7c; Methods). We found that nonlinear dynamics and we have found new, experimentally NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 9 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z testable signatures that can distinguish it from the other models. potential driven by a periodic signal necessitates of a suitable First, the attractor model exhibits a continuous crossover from magnitude of noise for the system to follow the signal (i.e., escape the primacy regime19,23 to the recency regime. Between these two from the well when it is no longer the global minimum). Similar regimes we found the new flexible categorization regime in which to the effect described with the multistable attractor model46, the the integration of stimulus fluctuations was maximally extended accuracy decreases to chance in the deterministic noiseless case over time (Fig. 2 and Supplementary Fig. 2). Second, in this (σ = 0). In contrast, the accuracy for the DWM is greatest for σ = regime a qualitative asymmetry between correcting and error 0 because the initial position of the decision variable (x0 = 0) transitions gave rise to a non-monotonic psychometric curve belongs to the basin of attraction of the correct attractor and thus (Fig. 3). Third, the rapid activation of transitions between deci- it always rolls down to the correct attractor. However, whether sion states with the stimulus fluctuations also caused an unex- this bump in accuracy produced by the attractor model as a pected non-monotonic dependence of the stimulus consistency function of the stimulus fluctuations (σS) is a local or a global (Fig. 4a). Finally, we used two previous psychophysical experi- maximum, or if it exists at all, depends on internal parameters ments to show that the attractor model can quantitatively fit such as the internal noise (σI) or the height of the barrier. These variations in PK profile with stimulus duration (Fig. 6) and fit internal parameters can be different for different subjects and categorization accuracy in a task with integration of evidence thus, one should expect to find this non-monotonic psychometric across memory periods (Fig. 7). curve only in a fraction of subjects. Indeed, we carried out a Recently, two studies have proposed alternative models that visuospatial binary categorization task in which the fluctuations can explain the differences of PK time-courses found across of the evidence σS were varied systematically from trial-to-trial. subjects and experiments. In the first model, based on approx- Preliminary analysis shows that the majority of subjects display a imate Bayesian inference, the primacy effect produced by bottom- psychometric curve P(σS) with a plateau followed by a decay as σS up versus top-down hierarchical dynamics, was modulated by the increased. A fraction of subjects exhibited however a non- stimulus properties which could yield different PK time-courses, a monotonic dependence but the dependence of PK and other prediction that was tested in a visual discrimination task42. The aspects of their behavior (e.g., idiosyncratic biases) on σS were not second study proposed a model that can produce different PK fully captured by the DWM dynamics. A future study will extend time-courses by adjusting the time scales of a divisive normal- the DWM so that it can capture these data. ization mechanism, which yields primacy, and a leak mechanism, The key mechanism underlying the flexible categorization which promotes recency43. In addition, this model can also regime are the transitions between attractor states which, func- account for bump shaped PKs, a class of PK that was found tionally, can be viewed as changes of mind5,49. Changes of mind together with primacy, recency, and flat PKs, in a study carried have been previously inferred from sudden switches in the direc- out using a large cohort of subjects (>100)44. In the attractor tion of the motor response5,49 but also from decision bound model, the differences in the PK found across subjects or fixed crossings of the decision variable read out from neuronal popu- stimulus properties could be explained by individual differences lation recordings50–53. In reaction time tasks, an extension of the in the shape of the potential. Specifically, differences in the height drift diffusion model can fit the modulation of the probability of of the barrier between the two attractor states would generate a observing a change of mind as a function of the mean stimulus variety of PK time-courses (Fig. 7c) as the integration  regime strength5. In this model, a first crossing of the decision bound ultimately depends on the ratio between the total noise σ 2S þ σ 2I initializes the response that is reversed if the decision variable and the height of the barrier. A natural extension of our approach crosses the opposite bound before the motor response is com- would be to assume that a time-varying process during the trial, pleted. As in the DWM, this model predicts that correcting e.g., an urgency signal45, can progressively modify the shape of changes of mind are more likely than error changes of mind. the potential. In that case, the DWM with an urgency signal that However, this asymmetry does not imply a non-monotonic changed the shape of the potential from a single well at stimulus accuracy with the stimulus fluctuations in a fixed duration task. onset into a double well at stimulus offset could readily reproduce This is because in the linear DDM with changes of mind5, the the bump shaped PKs (not shown) recently reported44. In sum, correcting transition probability pC is not exponentially more likely the attractor model shows a large versatility generating the than error transitions as in the DWM (Eq. 20). Thus, the benefit of diversity of PK shapes reported in the literature8,10,12,15–17,44. having more correcting transitions as σS increases does not offset Although several distinct models can account for the variety of the cost of decreasing the signal-to-noise ratio (not shown). An PK shapes, they rely on a variety of neural mechanisms. Future attractor network has also been used previously to explain changes electrophysiological or psychophysical experiments where the of mind during the motor response54. Our work extends this study different models predict qualitatively different results will help in several ways, by characterizing the full spectrum of integration distinguish between these possible mechanisms. regimes in the attractor model and by showing qualitative It has been previously shown that noise, from the stimulus or experimentally testable signatures of decision state transitions (e.g., internal sources, can increase the accuracy of an attractor model non-monotonicity in the accuracy and coherence versus σS). One with three stable attractors (i.e., with multistability): an undecided interesting question is whether correcting changes of mind could state and two decision states46,47. In this model, the decision generate similar nonlinear effects as those reported here (Fig. 3a, b) variable starts in the undecided state and, if it does not escape in tasks with n > 2 choices. A preliminary analysis using rate-based from this state during the stimulus presentation, the decision is networks suggests that this is in fact the case (Supplementary made randomly. Thus, the noise can allow the decision variable to Fig. 5). We simulated rate networks composed of n excitatory escape from the undecided state and increase the accuracy. Here, populations competing with each other via mutual inhibition and we have studied the attractor model in the winner-take-all regime, found that in the winner-take-all regime, strong stimulus fluc- i.e., without an undecided state, and we have found that it is the tuations causing attractor transitions could have a beneficial effect large difference between the rate of correcting and error- and yield a non-monotonic psychometric curve P(σS) (Supple- generating transitions that produces the increase in accuracy in mentary Fig. 5c). Thus, although a more detailed analysis of these the flexible categorization regime. This is conceptually very dif- multiple-choice networks is needed, these examples suggest that ferent from transitions between the undecided state to the deci- the asymmetry between correcting and error transitions under- sion states. The same mechanism presented here drives the classic lying the raise in accuracy with σS, was a general mechanism that stochastic resonance48 where a particle moving in a double well may be in play in tasks with more than two choices. 10 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE An important question in perceptual decision making is the with its dynamics, and propose a series of testable predictions that extent to which subjects can integrate evidence during the sti- may further shed light onto the brain dynamics during sensory mulus presentation. It has been recently pointed out that differ- evidence integration. entiating between integrating and non integrating strategies may be more difficult than naively thought55. Here we evaluate the Methods degree of evidence integration using the PK area. In the flexible Model simulations. For all simulations, we solve the diffusion Eq. 2 using the categorization regime this area is maximum, and the DWM can Euler method: rffiffiffiffiffi integrate a large fraction of stimulus fluctuations (Fig. 2f). Indeed, Δt Δt   xðt þ 1Þ ¼ xðt Þ  dφðxðt ÞÞ=dx þ σ ξ ðt Þ þ σ S ξ S ðt Þ ; ð6Þ we have shown that in this regime, the spiking network model, τ τ I I built of neural units with time-constants of 20 ms, could generate with Δt = τ/40. The time constant τ of the DWM was chosen to be 200 ms to transitions by integrating fluctuations over hundreds of milli- represent the effective integration time constant that emerges from the dynamics of seconds (Supplementary Fig. 2b). Further work would be required a network19. We summarized the parameters used in each figure in Table 1 (Supplementary to quantitatively characterize the emergence of this slow inte- Information). gration time-scale. The PK area however, is not a measure of R In Fig. 4, we use stimuli with exactly zero integrated evidence, Sðt Þdt ¼ 0. For accuracy, when accuracy is defined as the ability to discriminate each stimulus i, we first created a stream of normal random variables yi(t). Then we the sign of the mean stimulus evidence, μ. Thus, the accuracy in z-score y and we multiplied by σS: the DWM is maximal for σS ≈ 0 (Fig. 3b) but the area is close to yi ðtÞ  by Si ðtÞ ¼ σ S : ð7Þ zero (Fig. 2f). This mismatch simply reflects that, in the absence σy of internal noise, the task does not require integration of the After this transformation, the mean and standard deviation of Si are exactly 0 stimulus fluctuations. However, if we only considered stimuli and σS respectively. with μ = 0 and we defined the stimulus category based on the sign of stimulus integral, the accuracy would be strongly correlated Psychophysical kernel. We measure the impact of stimulus fluctuations during with the PK area and it would be maximal in the flexible cate- the course of the trial on the eventual decision by means of the so-called PK. Put simply, given a fixed mean signal, some stimulus realizations may favor a rightward gorization regime. choice (say a positive decision variable) and others a leftward one. If this is the case, Finally, equipped with the theoretical results on the attractor and we sort the stimuli over many trials by decision, we will see a clear separation model, we have revisited two psychophysical studies seeking for which can be quantified via a ROC analysis. Mathematically, for each trial i, we signatures of attractor dynamics. With the data from the first subtract the mean evidence (μi) of each trial si(t) = μi + σSξi to avoid that the study34, we have tested a key prediction of the attractor models distributions of stimuli that produce left and right choices are trivially separated by their mean evidence: and have shown that the DWM can readily fit the crossover from primacy, to flexible categorization, to recency observed in the data bsi ðtÞ ¼ si ðtÞ  μi : ð8Þ as stimulus duration increases. This fit shows that the behavioral Thus bsi ðt Þ ¼ σ s ξ i are simply the stimulus fluctuations. Then, for each time t, we compute the probability distribution function of the stimuli that produce a right data in this task is consistent with the presence of transitions (f ðbsR ðt ÞÞ) or left (f ðbsL ðt ÞÞ) choice. The PK is the temporal evolution of the area between attractor states during the perceptual categorization under the ROC curve between these two distributions process (Fig. 6). We used psychophysical data from two other PK ðt Þ ¼ aucðf ðbsR ðt ÞÞ; f ðbsL ðt ÞÞÞ: ð9Þ studies35,40, to show that in a regime close to the flexible cate- gorization the DWM could fit the categorization accuracy as a function of stimulus strength for all memory periods (Fig. 7). Normalized PK area and slope. In order to quantify the magnitude and the shape of a PK, we defined two measures, the PK area and the PK slope: Thus, the described asymmetry between correcting and error 1) The normalized PK area is a measure of the overall impact of stimulus transitions allowed the DWM to combine evidence from the two fluctuations on the upcoming decision, it ranges from 0 (no impact) to 1 (the pulses and yield a higher accuracy than a single pulse, just like stimulus fluctuations are perfectly integrated to make a choice). It is defined as subjects did (Fig. 7b, compare single vs two pulse trials using the RT PK ðt Þ  0:5 dt same coherence, e.g., 6.4% versus 6.4 + 6.4%). Models that NPKA ¼ R T 0 ; ð10Þ PK PI ðt; σ i ¼ 0Þ  0:5 dt assume perfect integration of evidence can generally store a 0 parametric value in short-term memory but they are susceptible where T is the stimulus duration. NPKA is the PK area normalized by the PK area of a PI in the absence of internal noise (σi = 0), i.e., an ideal observer. to undergoing diffusion over time, causing a drop in memory 2) The normalized PK slope is the slope of a linear regression of the PK, precision as the delay increases56,57. In contrast, the fact that the normalized between −1 (decaying PK, primacy) to +1 (increasing PK, recency). accuracy did not decrease with delay duration suggests that the Because we wanted the PK slope to quantify the shape of the PK rather than its information stored in memory could be categorical instead of magnitude (which is captured by the PK area), we first normalized the PK to have unit area, parametric58,59, a feature naturally captured by the DWM (Fig. 7d). Alternatively, it could reflect a parametric memory with PK ðt Þ  0:5 NPK ðt Þ ¼ R T ; ð11Þ negligible internal noise60. Interpreting neural recordings can also 0 PK ðt Þ  0:5 dt be non-conclusive as different areas can simultaneously represent where T is the stimulus duration. We then fit the NPK with a linear function of stimulus information with different levels of categorization61. To time, overcome these shortcomings in understanding whether the LPK ðt Þ ¼ β0 þ kβ1 ´ t; ð12Þ stored information is categorical or parametric, we propose an where β1 is the PK slope and k ¼ 1 2var ðt Þ is a factor that normalizes the PK slope to experiment that combining electrophysiology with psychophysics the interval (−1, +1). can qualitatively distinguish between these two alternatives (see Supplementary Fig. 6). An alternative version of the DDMA Accuracy for the DWM. To compute the accuracy for the DWM, we assume that model where the sensitivity to the second pulse was larger than to the time spent in the unstable region is much shorter than the time spent in one of the first one could also account for the combination of the two the attractors. This assumption allows us to treat the system as a Continuous pulses40. This feature captured the slight recency effect found in Markov Chain (CMC) with only two possible states correct and error. The first step the data, but it left unanswered the key question of why the is to compute the probability of first visiting the correct attractor which will be used as the initial state of the CMC62 subjects did not use their maximum sensitivity during the first   R x0 pulse. In total, our findings provide evidence that an attractor 2φðxÞ xE exp σ 2I þσ 2S dx model, working in the flexible categorization regime, can capture P0 ¼ R   ; ð13Þ xC 2φðxÞ aspects of the data that were previously viewed as incompatible x exp σ 2 þσ 2 dx E I S NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 11 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z where φ is the potential in Eq. 3, xC and xE are the x values of the correct and error connected network shown in Supplementary Fig. 4 was exactly the original network attractors whereas x0 = 0 is the initial position of x. The integrals of P0 can be model presented in ref. 19. The current-based network consists of two populations computed assuming that the term x4 is very small for values of x0 ’ 0: of excitatory neurons (A and B), both of which are recurrently coupled between pffiffiffiffi   pffiffiffiffi   μ μ them and to a population of inhibitory interneurons (I). We study the case in erf σ2α x0 þ 2α  erf σ2α xE þ 2α which the system is near a steady bifurcation to a winner-take-all state. It is in the P0 ¼ pffiffiffiffi   pffiffiffiffi  : ð14Þ μ μ vicinity of the bifurcation that the dynamics of the network can be captured in a erf σ2α xE þ 2α  erf σ2α xC þ 2α one-dimensional amplitude equation which describes the slow evolution along the The second step is to compute the correcting and error transition rates37,62 critical manifold28. The evolution of the membrane potential ViX ðt Þ from the i-th pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi   neuron in population X is given by: jφ00ðxE Þφ00ðxU Þj 2ðφðxU Þ  φðxE ÞÞ kC ¼ exp  and ð15Þ dViA   2π σ 2I þ σ 2S τ Em ¼  ViA  El þ IiAA  IiAI þ IiAext =gL ; ð28Þ dt pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi   jφ00ðxC Þφ00ðxU Þj 2ðφðxU Þ  φðxC ÞÞ dViB   kE ¼ exp  ; ð16Þ ð29Þ 2π σ 2I þ σ 2S τ Em ¼  ViB  El þ IiBB  IiBI þ IiBext =gL ; dt where xU is the x position at the unstable state. These are the transition rates of a dViI   Continuous Markov Chain with only two states: correct and incorrect. The τ Im ¼  ViI  El þ IiIA þ IiIB þ IiIext =gL ; ð30Þ probability of making a correcting and error-generating transition during a trial dt are63: where the synaptic input voltages of the form IXY indicate interactions from neurons pC ðT Þ ¼ P1 ð1  expðkT ÞÞ; ð17Þ in population Y to neurons in population X, while external synaptic inputs are given by IXext. The synaptic inputs are sums over all postsynaptic potentials (PSPs), mod- eled as exponential functions with a delay. The synaptic inputs take the form pE ðT Þ ¼ ð1  P1 Þð1  expðkT ÞÞ; ð18Þ X kC IiXY ¼ JijXY gijXY : ð31Þ where k = kC + kE, T is the stimulus duration and P1 ¼ kC þkE is the probability of j the stationary state being the correct one (T→∞). Finally, the probability of being The dynamics of excitatory and inhibitory synapses are described by in the correct attractor given the model and stimulus parameters is dgijXY P ¼ P0 ð1  pE Þ þ ð1  P0 ÞpC : ð19Þ τ Ys¼ gijXY ; ð31Þ dt The probability of correct is the probability to first visit the correct attractor and After the presynaptic neuron j fires a spike at time tkXY , the corresponding remain in it (P0(1−pE)) plus the probability to first visit the error attractor and correct the initial decision ((1−P0)pC). To be more quantitative, we can compute dynamic variable is incremented by one at tkXY þ δ Yk , that is after a delay δYk . the ratio between the probability of a correcting (Eq. 17) and an error-generating External synapses have instantaneous dynamics transition (Eq. 18): X X     IiIext ¼ Jijext δ t  tk;j Xext ; ð33Þ pC =pE / exp 2ðφðxE Þ  φðxC ÞÞ=σ 2 ð20Þ j k For small values of the mean signal μ<<1, we can rewrite the ratio between the i.e., a presynaptic action potential from neuron j of the external population at time correcting and error-generating transitions as a function of the potential Xext tk;j results in an instantaneous jump of the external synaptic input variable. A parameters. To this aim we compute the fixed points of order ϑðε2 Þ using μ ¼ εμ spike is emitted whenever the voltage of a cell from an excitatory (inhibitory) where μ is a parameter of order 1 and x = x0 + εx1: population crosses a value Θ, after which it is reset to a reset potential Er. rffiffiffi We consider the case of sparse random connectivity for which, on average, each α μ   xC ¼ þ þ ϑ ε2 ; ð21Þ neuron from population X receives a total of CXY synapses from population Y. The 2 4α pairwise probability of connection is thus ϵXY ¼ CXY =NY , where NA = NB= NE and rffiffiffi NI are the number of neurons in the respective populations. For nonzero synapses α μ   xE ¼  þ þ ϑ ε2 and ð22Þ we choose JijAA ¼ JijBB ¼ JEE , JijIA ¼ JijIB ¼ JIE and JijAI ¼ JijBI ¼ JEI . 2 4α The stimulus input current is modeled similar to23, with the exact same μ   stimulus input being injected to each neuron in each of the two excitatory xU ¼  þ θ ε2 ; ð23Þ populations. The stimulus input onto each of the excitatory populations A and B is 4α given by where xU is the x position of the unstable state (note that xU = 0 when μ = 0) and xC(xE) is the position of the correct (error) attractor. Using these fixed points, the A Istim ðt Þ ¼ I0 ð1 þ μÞ þ σ S z A ðt Þ; and ð34Þ ratio between the correcting and error-generating transitions is  rffiffiffi B Istim ðt Þ ¼ I0 ð1  μÞ þ σ S z B ðt Þ; ð35Þ 4μ α pC =pE ¼ exp 2 : ð24Þ σ 2 where the first term describes the mean stimulus input onto each population and Which shows that the ratio between correcting transitions and error-generating the second term the temporal modulations of the stimulus with standard deviation ones increases exponentially with the mean stimulus (μ) as long as stimulus σstim. The term μ parametrizes the mean difference of the two stimulus inputs and fluctuations are not too large. These probabilities are illustrated in Fig. 3c, pC it captures the amount of net stimulus evidence favoring one choice over the other increases steeply as a function of stimulus fluctuations even before pE reaches non- (i.e., μ = 0 represents an ambiguous stimulus with zero mean sensory evidence). negligible values and for large stimulus fluctuations both probabilities tend to 0.5. Finally, zA(t) and zB(t) are independent realizations of an Ornstein–Uhlenbeck pffiffiffiffiffiffiffiffiffiffiffi To find the maximum of the accuracy, we derive Eq. 19 respect to σ: dt ¼ z þ 2τ stim ξ ðt Þ, where ξ(t) is Gaussian white noise process, defined by τ stim dz (mean 0, variance dt). dP 2 d ¼  3 ½P0 expðkT Þ þ pC ; ð25Þ dσ σ dβ Simulation details. The network model was implemented in Python 3 using the where we rewrite Eq. 19 as a function of pC and P0. From this equation, it can be Brian 2 simulator version 2.364. We used the Euler integration method with a time shown (see Supplementary Information) that the local maximum in accuracy is step of 0.1 ms. We simulated fixed duration trials of varying stimulus duration. Stimulus presentation was preceded by a 500 ms interval to prevent transient α2 1 effects due to initial conditions. The choice outcome of the network was deter- σ 2IC ¼  ; ð26Þ 2 log 2Tα mined by the neural population with a higher population firing rate over the last πz0 100 ms of the stimulus period. Results for a given stimulus condition (σS and T) are and the critical value of μ above which the accuracy decreases monotonically with based on 5000 trials using different realizations of the network connectivity, ran- the stimulus fluctuations is dom initial conditions as well as different realizations of the external background rffiffiffi inputs into each circuit. The value of all the parameters can be found in Table 2 α α μC ¼ : ð27Þ (Supplementary Information) 2 2 Psychophysical data and model fitting. In Fig. 6, we used data from experiments Spiking network 1 and 4 from34 with a total of N = 21 humans subjects (N = 13 in experiment 1 and Network model. In Fig. 5 we consider a network of randomly connected current- N = 8 in experiment 4). The data can be accessed here: https://doi.org/10.1371/ based integrate-and-fire neurons, similar to28. The conductance-based all-to-all journal.pcbi.1004667. The stimuli consisted of two brightness-fluctuating round 12 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE disks. In each stimulus frame (duration 100 ms), the brightness level of each disk index indicates the pulse number. Note that we are assuming that the time was updated from one of two generative Gaussian distributions that had the same spent for the decision variable in the unstable state is short compared with the variance but different mean: either one distribution had a high mean value and the pulse duration. With this assumption, the decision variable starts in the correct second a low value or vice versa. At the end of the stimulus, the subjects had to attractor with probability P0. Similarly for double pulse trials the probability of report the disk with a higher overall brightness (i.e., which disc corresponded to the correct is: generative distribution with higher mean). Incorrect responses were followed by an   auditory feedback. Trials were separated into five equal length segments, in 80% of Pi2 ¼ PC1 ð1  pE Þ þ 1  PC1 pC : ð44Þ the trials, a congruent or incongruent pulse of evidence was presented at a random The potential and the diffusion equation can be written as segment. This increase or decrease of evidence was corrected in the rest of the φð X Þ ¼ μx  αx2 þ x4 and ð45Þ segments and as a consequence the stimuli were anticorrelated. In experiment 1 stimuli with 1, 2, or 3 s duration were presented in blocks of 60 trials whereas dx dφ in experiment 4, the stimulus duration was 5 s. We computed the PK using τ ¼  þ σξ ðt Þ; ð46Þ the procedure described above (see section Psychophysical kernel) but first com- dt dx puting the difference in brightness of the two disks. We also subtracted the mean where μ is a linear scaling of the coherence to x units (μ = kcoh) and σ represents difference in order to have a one-dimensional stimulus trace with zero mean. the two sources ffi of noise, the internal noise and the stimulus fluctuations pffiffiffiffiffiffiffiffiffiffiffiffiffiffi Namely σ ¼ σ I þ σ S . The two sources of noise cannot be fitted separately because the   only difference between them is that the internal noise is also activated during the Si ðt Þ ¼ SiR ðt Þ  SiL ðt Þ  μiR  μiL ; ð36Þ delay (Fig. 7a). But internal noise does not have  any impact  during the delay. Thus where SiL ðt Þ is the brightness of the t-th frame of the left disk during the i-th trial it is impossible to distinguish σI in the range 0; σ max I where σ max I is the maximum and μiL is the mean of the generative Gaussian distribution for the left disc in the i- σI without transitions during the delay. For this reason, we assume that there are no th trial. We computed the PKs standard error of the mean using bootstrap with transitions during the delay and we only fit the total noise σ. The parameters that 1000 repetitions. maximize Eq. 42 and their 95% confidence interval are k* = 0.012 ± 0.0011, α* = To compute the PK of the DWM we simulated Eq. 6 using stimuli with the 0.70 ± 0.05, σ* = 0.52 ± 0.05, and τ* = 3.3 ± 0.5. To compute the confidence exact same temporal fluctuations in evidence than the stimuli presented to the intervals, we assume that the likelihood function around the best-fit parameters is a subjects. We modeled it by updating μi(t) from Eq. 3 with the difference in multi-dimensional Gaussian. Then the confidence intervals are two times the brightness at each time between the right and left disk: diagonal of the inverse of the Hessian matrix17,65. The Hessian matrix is the matrix of second derivatives and we compute it numerically using the finite difference μi ðt Þ ¼ SiR ðt Þ  SiL ðt Þ: ð37Þ method. Note that in this framework the stimulus fluctuations were set to zero σS = 0 Although we cannot fit the internal and the stimulus  sources of noise separately, because σS was captured inside μi(t). The DWM parameters (α = −0.8, σI = 0.3, we can study the range of internal noise 0; σ max I that produces a negligible and τ = 200 ms) were tuned to account for the change from primacy to recency number of transitions (<1%) during the delay (up to 1 s) and thus is compatible with the stimulus duration. with the psychophysical data. For the parameters that maximize the likelihood this range is (0, 0.32), indicating that the DWM is robust to perturbations during the Primacy-recency index for the two pulses trials. In Fig. 7, we define the delay even when  the magnitude of the internal noise represents a substantial part of primacy-recency index the total noise σ max I =σ S ¼ 0:8 (Fig. 7d). We also compute the accuracy of the PI as a function of the delay (Fig. 7d). To be able to compare both models, we adjust the β2  β1 scaling factor of the evidence to match subjects’ accuracy for the shortest delay (μPI PRI ¼ ð38Þ β1 þ β2 = 0.44k×coh where k is the scaling of the DWM), and we use the parameters τ, σS, where β1 and β2 are the coefficients of a logistic regression with the coherence of and σi that maximize the DWM. the first and second pulse as predictors:   Model for n-choice decision making. To model a categorization task with n = 3 logit PC ¼ β0 þ β1 coh1 þ β2 coh2 ð39Þ choices (Supplementary Fig. 5) we simulated a system of standard nonlinear Similar to the Normalized PK slope, the primacy-recency index ranges from −1 coupled rate equations (see e.g., Equation (38) in66): (primacy) to 1 (recency). dr1   τ ¼  r1 þ ϕ sr1  crI þ I1 þ ξ 1 ðt Þ; dt DWM fitting. In Fig. 7, we use data from two studies performing the same dr   experiments35,40. We extract the accuracy of the subjects directly from the paper τ 2 ¼  r2 þ ϕ sr2  crI þ I2 þ ξ 2 ðt Þ; dt ð47Þ figures (with GraphClick, a software to extract data from graphs) and the number   dr of trials from the methods of the papers. We pool the data from the two experiment τ 3 ¼  r3 þ ϕ sr3  crI þ I3 þ ξ 3 ðt Þ; and we compute the mean accuracy in each condition i as dt dr g    PiK NiK þ PiT NiT τ I ¼  rI þ ϕ r þ r2 þ r3 þ II þ ξ I ðt Þ; Pi ¼ ; ð40Þ dt 3 1 NiT þ NiK where ξi is a Gaussian white noise process with amplitude σ for i = 1,2,3 and where Ni is the number of trials in condition i, the data with superindex K and T amplitude σI for i = I, pand with ffitransfer function ϕ(x) = 0 for x < 0, ϕ(x) = x2 for ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi were extracted from35 and40 respectively. The 95% confidence interval of Pi is: 0 ≤ x ≤ 1 and ϕðxÞ ¼ 2 x  3=4 for x > 1. The n = 4 case is a simple extension of vffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi u   these equations (the general system of rate equations for n > 2 can 66 uP 1  P pffiffibe ffi found in ). t C;i C;i ð41Þ The parameters used for the simulations were s = 0.694, c = g = 5, τ = 20 ms, τI Pi ± 1:96 ; = 10 ms, II = 0, and σI = 0. For n = 3 the inputs were taken as I1 = I + 2ΔI/3, I2 = NiT þ NiK I − ΔI/3, I3 = I − ΔI/3, while for n = 4 they were I1 = I + 3ΔI/4, I2 = I − ΔI/4, I3 = In these experiments, the human subjects had to discriminate between left and I − ΔI/4, I4 = I − ΔI/4, with I = 2.25 and ΔI = 0.03*s. For the top panels in Sup- right motion direction of a random dots stimulus. The experimenters interleaved plementary Fig. 5 the values of the noise strength where σ = 0.18 and σ = 0.13 for trials with one and two pulses of 120 ms. For single pulse trials the possible n = 3 and 4, respectively. The accuracy was calculated as the fraction of trials (N = coherence levels were 0, 3.2, 6.4, 12.8, 25.6, and 51.2%. For double pulse trials, the 10,000) in which the highest firing rate at the end of the trial was r1. pulses were separated by a delay of 0, 120, 360, or 1080 ms and the coherences were randomly chosen from 3.2, 6.4, and 12.8% (nine different coherence sequences). In both papers, they reported that the subjects’ accuracy in double pulses trials was Reporting Summary. Further information on research design is available in the Nature independent of the delay. Thus we assume that, in the DWM, the internal noise Research Reporting Summary linked to this article. was too small to drive transitions during the delay and we pool the data across delays to compute the accuracy for each coherence sequence. We fit the model by maximizing the log-likelihood (Nelder–Mead algorithm): Data availability Data shown in Fig. 6 can be accessed here: https://doi.org/10.1371/journal.pcbi.1004667. X Ni The data shown in Fig. 7 was extracted directly from the manuscripts35,40 using LL ¼ NC;i Pi þ NE;i ð1  Pi Þ; ð42Þ i GraphClick. where NC,i and NE,i are the number of correct and error trials for each coherence sequence i whereas Pi is the accuracy for sequence i predicted by the DWM. Code availability For single pulse trials, we computed Pi as The codes to simulate the DWM and canonical models and generate the figures of the paper are available at https://bitbucket.org/delaRochaLab/flexible-categorization. Pi1 ¼ P0 ð1  pE Þ þ ð1  P0 ÞpC ; ð43Þ The code and analysis scripts for the spiking neural network simulations are available where P0, pC, and pE were computed using Eqs. 14, 17, and 18 whereas the super at https://github.com/wimmerlab/flexcat-spiking. NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 13 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z Received: 26 May 2020; Accepted: 29 January 2021; 30. Gold, J. I. & Shadlen, M. N. The neural basis of decision making. Annu. Rev. Neurosci. 30, 535–574 (2007). 31. Bogacz, R., Brown, E., Moehlis, J., Holmes, P. & Cohen, J. D. The physics of optimal decision making: a formal analysis of models of performance in two- alternative forced-choice tasks. Psychol. Rev. 113, 700–765 (2006). References 32. Miller, P. & Katz, D. B. Accuracy and response-time distributions for decision- 1. Ratcliff, R. A theory of memory retrieval. Psychological Rev. 85, 59–108 (1978). making: linear perfect integrators versus nonlinear attractor-based neural 2. Palmer, J., Huk, A. C. & Shadlen, M. N. The effect of stimulus strength on the circuits. J. Comput. Neurosci. 35, 261–294 (2013). speed and accuracy of a perceptual decision. J. Vis. 5, 376–404 (2005). 33. Kawaguchi, K. et al. Differentiating between models of perceptual decision 3. Bogacz, R., Hu, P. T., Holmes, P. J. & Cohen, J. D. Do humans produce the making using pupil size inferred confidence. J. Neurosci. 38, 8874–8888 (2018). speed–accuracy trade-off that maximizes reward rate? Q. J. Exp. Psychol. 63, 34. Bronfman, Z. Z., Brezis, N. & Usher, M. Non-monotonic temporal-weighting 863–891 (2010). indicates a dynamically modulated evidence-integration mechanism. PLoS 4. Urai, A. E., de Gee, J. W., Tsetsos, K. & Donner, T. H. Choice history biases Comput. Biol. 12, e1004667 (2016). subsequent evidence accumulation. Elife. 8, e46331 (2019). 35. Kiani, R., Churchland, A. K. & Shadlen, M. N. Integration of direction cues is 5. Resulaj, A., Kiani, R., Wolpert, D. M. & Shadlen, M. N. Changes of mind in invariant to the temporal gap between them. J. Neurosci. 33, 16483–16489 (2013). decision-making. Nature 461, 263–266 (2009). 36. Tsetsos, K., Gao, J., McClelland, J. L. & Usher, M. Using time-varying evidence 6. Kiani, R., Corthell, L. & Shadlen, M. N. Choice certainty is informed by both to test models of decision dynamics: bounded diffusion vs. the leaky evidence and decision time. Neuron 84, 1329–1342 (2014). competing accumulator model. Front. Neurosci. 6, 79 (2012). 7. Pardo-Vazquez, J. L. et al. The mechanistic foundation of Weber’s law. Nat. 37. Kramers, H. A. Brownian motion in a field of force and the diffusion model of Neurosci. 22, 1493–1502 (2019). chemical reactions. Physica 7, 284–304 (1940). 8. Kiani, R., Hanks, T. D. & Shadlen, M. N. Bounded integration in parietal 38. Neri, P. & Levi, D. M. Receptive versus perceptive fields from the reverse- cortex underlies decisions even when viewing duration is dictated by the correlation viewpoint. Vis. Res. 46, 2465–2474 (2006). environment. J. Neurosci. 28, 3017–3029 (2008). 39. Ratcliff, R., Voskuilen, C. & McKoon, G. Internal and external sources of 9. Mazurek, M. E., Roitman, J. D., Ditterich, J. & Shadlen, M. N. A role for neural variability in perceptual decision-making. Psychol. Rev. 125, 33–46 (2018). integrators in perceptual decision making. Cereb. Cortex 13, 1257–1269 (2003). 40. Tohidi-Moghaddam, M., Zabbah, S., Olianezhad, F. & Ebrahimpour, R. 10. Zylberberg, A., Barttfeld, P. & Sigman, M. The construction of confidence in a Sequence-dependent sensitivity explains the accuracy of decisions when cues perceptual decision. Front. Integr. Neurosci. 6, 79 (2012). are separated with a gap. Atten. Percept. Psychophys. 81, 2745–2754 (2019). 11. Yates, J. L., Park, I. M., Katz, L. N., Pillow, J. W. & Huk, A. C. Functional 41. Melcher, D., Crespi, S., Bruno, A. & Morrone, M. C. The role of attention in dissection of signal and noise in MT and LIP during decision-making. Nat. central and peripheral motion integration. Vis. Res. 44, 1367–1374 (2004). Neurosci. 20, 1285–1292 (2017). 42. Lange, R. D., Chattoraj, A., Beck, J. M., Yates, J. L. & Haefner, R. M. A 12. Nienborg, H. & Cumming, B. G. Decision-related activity in sensory neurons confirmation bias in perceptual decision-making due to hierarchical reflects more than a neuron’s causal effect. Nature 459, 89–92 (2009). approximate inference. Preprint at bioRxiv https://doi.org/10.1101/440321. 13. Huk, A. C. & Shadlen, M. N. Neural activity in macaque parietal cortex reflects 43. Keung, W., Hagen, T. A. & Wilson, R. C. A divisive model of evidence temporal integration of visual motion signals during perceptual decision accumulation explains uneven weighting of evidence over time. Nat. making. J. Neurosci. 25, 10420–10436 (2005). Commun. 11, 2160 (2020). 14. Odoemene, O., Pisupati, S., Nguyen, H. & Churchland, A. K. Visual evidence 44. Keung, W., Hagen, T. A. & Wilson, R. C. Regulation of evidence accumulation accumulation guides decision-making in unrestrained mice. J. Neurosci. 38, by pupil-linked arousal processes. Nat. Hum. Behav. 3, 636–645 (2019). 10143–10155 (2018). 45. Eckhoff, P., Wong-Lin, K. F. & Holmes, P. Optimality and robustness of a 15. Cheadle, S. et al. Adaptive gain control during human perceptual choice. biophysical decision-making model under norepinephrine modulation. J. Neuron 81, 1429–1441 (2014). Neurosci. 29, 4301–4311 (2009). 16. Wyart, V., Myers, N. E. & Summerfield, C. Neural mechanisms of human 46. Miller, P. & Katz, D. B. Stochastic transitions between neural states in taste perceptual choice under focused and divided attention. J. Neurosci. 35, processing and decision-making. J. Neurosci. 30, 2559–2570 (2010). 3485–3498 (2015). 47. Deco, G., Rolls, E. T. & Romo, R. Stochastic dynamics as a principle of brain 17. Brunton, B. W., Botvinick, M. M. & Brody, C. D. Rats and humans can function. Prog. Neurobiol. 88, 1–16 (2009). optimally accumulate evidence for decision-making. Science 340, 95–98 48. Gammaitoni, L., Hänggi, P., Jung, P. & Marchesoni, F. Stochastic resonance. (2013). Rev. Mod. Phys. 70, 223–287 (1998). 18. Zhang, J., Bogacz, R. & Holmes, P. A comparison of bounded diffusion models 49. van den Berg, R. et al. A common mechanism underlies changes of mind for choice in time controlled tasks. J. Math. Psychol. 53, 231–241 (2009). about decisions and confidence. Elife. 5, e12192 (2016). 19. Wang, X.-J. Probabilistic decision making by slow reverberation in cortical 50. Kiani, R., Cueva, C. J., Reppas, J. B. & Newsome, W. T. Dynamics of neural circuits. Neuron 36, 955–968 (2002). population responses in prefrontal cortex indicate changes of mind on single 20. Wong, K.-F. & Wang, X.-J. A recurrent network mechanism of time trials. Curr. Biol. 24, 1542–1547 (2014). integration in perceptual decisions. J. Neurosci. 26, 1314–1328 (2006). 51. Peixoto, D. et al. Decoding and perturbing decision states in real time. Nature 21. Lo, C.-C. & Wang, X.-J. Cortico-basal ganglia circuit mechanism for a decision 1–6 (2021). threshold in reaction time tasks. Nat. Neurosci. 9, 956–963 (2006). 52. Lemus, L. et al. Neural correlates of a postponed decision report. Proc. Natl 22. Fusi, S., Asaad, W. F., Miller, E. K. & Wang, X.-J. A neural circuit model of Acad. Sci. USA 104, 17174–17179 (2007). flexible sensorimotor mapping: learning and forgetting on multiple timescales. 53. Rich, E. L. & Wallis, J. D. Decoding subjective decisions from orbitofrontal Neuron 54, 319–333 (2007). cortex. Nat. Neurosci. 19, 973–980 (2016). 23. Wimmer, K. et al. Sensory integration dynamics in a hierarchical network 54. Albantakis, L. & Deco, G. Changes of mind in an attractor network of explains choice probabilities in cortical area MT. Nat. Commun. 6, 6177 decision-making. PLoS Comput. Biol. 7, e1002086 (2011). (2015). 55. Stine, G. M., Zylberberg, A., Ditterich, J. & Shadlen, M. N. Differentiating 24. Engel, T. A., Chaisangmongkon, W., Freedman, D. J. & Wang, X.-J. Choice- between integration and non-integration strategies in perceptual decision correlated activity fluctuations underlie learning of neuronal category making. Elife. 9, e55365 (2020). representation. Nat. Commun. 6, 6454 (2015). 56. Wimmer, K., Nykamp, D. Q., Constantinidis, C. & Compte, A. Bump attractor 25. Wilming, N., Murphy, P. R., Meyniel, F. & Donner, T. H. Large-scale dynamics in prefrontal cortex explains behavioral precision in spatial working dynamics of perceptual decision information across human cortex. Nat. memory. Nat. Neurosci. 17, 431–439 (2014). Commun. 11, 5109 (2020). 57. Compte, A. Synaptic mechanisms and network dynamics underlying spatial 26. Jaramillo, J., Mejias, J. F. & Wang, X.-J. Engagement of pulvino-cortical working memory in a cortical network model. Cereb. Cortex 10, 910–923 (2000). feedforward and feedback pathways in cognitive computations. Neuron 101, 58. Fleming, S. M., Maloney, L. T. & Daw, N. D. The irrationality of categorical 321–336.e9 (2019). perception. J. Neurosci. 33, 19060–19070 (2013). 27. Bonaiuto, J. J., Berker, Ade & Bestmann, S. Response repetition biases in 59. Inagaki, H. K., Fontolan, L., Romani, S. & Svoboda, K. Discrete attractor human perceptual decisions are explained by activity decay in competitive dynamics underlies persistent activity in the frontal cortex. Nature 566, attractor models. Elife. 5, e20047 (2016). 212–217 (2019). 28. Roxin, A. & Ledberg, A. Neurobiological models of two-choice decision 60. Waskom, M. L. & Kiani, R. Decision making through integration of sensory making can be reduced to a one-dimensional nonlinear diffusion equation. evidence at prolonged timescales. Curr. Biol. 28, 3850–3856.e9 (2018). PLoS Comput. Biol. 4, e1000046 (2008). 61. Hanks, T. D. et al. Distinct relationships of parietal and prefrontal cortices to 29. Forstmann, B. U., Ratcliff, R. & Wagenmakers, E.-J. Sequential sampling evidence accumulation. Nature 520, 220–223 (2015). models in cognitive neuroscience: advantages, applications, and extensions. 62. Gardiner, C. W. Handbook of Stochastic Methods for Physics, Chemistry and Annu. Rev. Psychol. 67, 641–666 (2016). the Natural Sciences (Springer, 1985). 14 NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-021-21501-z ARTICLE 63. Durrett, R. Essentials of Stochastic Processes (Springer, 2016). Additional information 64. Stimberg, M., Brette, R. & Goodman, D. F. M. Brian 2, an intuitive and Supplementary information The online version contains supplementary material efficient neural simulator. eLife. 8, e47314 (2019). available at https://doi.org/10.1038/s41467-021-21501-z. 65. MacKay, D. J. C. & Mac, D. J. Information Theory, Inference and Learning Algorithms (Cambridge Univ. Press, 2003). Correspondence and requests for materials should be addressed to G.P.-O. or J.d.l.R. 66. Roxin, A. Drift-diffusion models for multiple-alternative forced-choice decision making. J. Math. Neurosci. 9, 5 (2019). Peer review information Nature Communications thanks Mark Humphries and Jorge Mejias for their contribution to the peer review of this work. Peer reviewer reports are available. Acknowledgements We thank Tobias H. Donner and Niklas Wilming for excellent discussions. The research Reprints and permission information is available at http://www.nature.com/reprints leading to these results has received funding from “la Caixa” Foundation (to G.P.O.), the Spanish Ministry of Economy and Competitiveness together with the European Regional Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in Development Fund (RYC-2015-17236 and BFU2017-86026-R to K.W, MTM2015- published maps and institutional affiliations. 71509-C2-1-R and RTI2018-097570-B-I00 to A.R. and SAF2015-70324-R to J.R.) and from the Generalitat de Catalunya (grant AGAUR 2017 SGR 1565 to A.R., J.d.I.R., and K.W.). This work has received funding from the European Research Council (ERC) Open Access This article is licensed under a Creative Commons under the European Union’s Horizon 2020 research and innovation program (ERC- Attribution 4.0 International License, which permits use, sharing, 2015-CoG - 683209 PRIORS to J.d.I.R.). Part of this work was developed at the building adaptation, distribution and reproduction in any medium or format, as long as you give Centre Esther Koplowitz, Barcelona. appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party Author contributions material in this article are included in the article’s Creative Commons license, unless G.P.O., K.W., A.R., and J.d.l.R. contributed to the design of the study and to the inter- indicated otherwise in a credit line to the material. If material is not included in the pretation of the results. G.P.O. performed the simulations and the analysis of the article’s Creative Commons license and your intended use is not permitted by statutory canonical and the double well models. G.P.O. and A.R. derived analytical expressions regulation or exceeds the permitted use, you will need to obtain permission directly from from the DWM. K.W. and G.P.O. performed the simulations and analysis of the spiking the copyright holder. To view a copy of this license, visit http://creativecommons.org/ network. G.P.O., K.W., A.R., and J.d.l.R. wrote the paper. licenses/by/4.0/. Competing interests © The Author(s) 2021 The authors declare no competing interests. NATURE COMMUNICATIONS | (2021)12:1283 | https://doi.org/10.1038/s41467-021-21501-z | www.nature.com/naturecommunications 15