Dynamics of the judgment of tactile stimulus intensity

In the future, artificial agents will need to make assessments of tactile stimuli in order to interact intelligently with the environment and with humans. Such assessments will depend on exquisite and robust mechanosensors, but sensors alone do not make judgments and choices. Rather, the central processing of mechanosensor inputs must be implemented with algorithms that produce ‘behavioral states’ in the artificial agent that resemble or mimic perceptual judgments in biology. In this study, we consider the problem of perceptual judgment as applied to vibration intensity. By a combination of computational modeling and simulation followed by psychophysical testing of vibration intensity perception in rats, we show that a simple yet highly salient judgment—is the current stimulus strong or weak?—can be explained as the comparison of ongoing sensory input against a criterion constructed as the time-weighted average of the history of recent stimuli. Simulations and experiments explore how judgments are shaped by the distribution of stimuli along the intensity dimension and, most importantly, by the time constant of integration which dictates the dynamics of criterion updating. The findings of this


Introduction
Neuromorphic engineering has made great strides in fabricating sensors that promise, with further development, to replicate many of the sensory functions present in the real skin of living organisms (Chortos et al 2016, Lee et al 2020, Shim et al 2022, Liu et al 2022. While high-acuity, high-sensitivity, reliable, durable artificial sensors are a requisite to building agents that can sense the world and behave accordingly (Chicca et al 2014, Indiveri and Liu 2015, Bartolozzi et al 2022, such sensors are just the starting point. An autonomous agent must not only transduce contacts, but must also process the signals to generate a behavioral output. Ultimately the agent's central processing networks must endow sensor inputs with meaning and in many instances, must act upon such inputs. Acting implies classification: the input signal must be recognized as belonging to one or another category, each category associated with an appropriate behavioral output. One approach that may be fruitful in neuromorphic engineering is to build up the foundations of knowledge about sensing and decision making in living, behaving organisms. As summarized in a recent review, 'Better understanding the sophisticated neural encoding of the properties of the sensed signal and their relation to behavioral decisions of the subject-and their implementation in the design of novel neuromorphic sensors-would enhance the capability of artificial agents to extract relevant information and take appropriate decisions' (Bartolozzi et al 2022).
Here, we further develop our initial inquiry as to what type of algorithm the biological nervous system might employ to perform the classification of tactile inputs, with an eye towards extending such algorithms to artificial agents (Bandyopadhyaya et al 2014, Taunyazov et al 2020, Zhang et al 2021. We examine the brain algorithms that might be at work when a trained animal, a rat in our case, classifies a tactile vibration. To carry out the experiment, the investigators impose a classification boundary and the rat gains rewards by correctly identifying each stimulus across a long session as being stronger or weaker (according to vibration intensity, in units of mean speed) than that boundary. Intuition tells us that the brain must generate, hold, and apply an internal criterion. To make choices in the current context, the 'decision rule' must be supported by a neural instantiation of the criterion. But exactly what is the neural substrate of such a criterion and by what algorithm is the choice made? Previous work (Hachen et al 2021) indicated that the brain's internal criterion is not a direct representation of the investigator-imposed classification boundary but is, instead, a memory formed from the history of past stimuli, an ongoing register of the sensory context that is gradually updated on each trial. Our aims here are, in the first section, to explore the quantitative implications of the model developed in the earlier study (Hachen et al 2021) and, in the second section, to confirm the main outcomes of the model by empirical psychometric measures in behaving rats. We focus on how the time constant of sensory integration, τ , plays out on the dynamics of criterion updating; the motivation is that this time constant, if adaptable to current behavioral requirements, offers a tool that the brain and artificial processing networks may employ to optimize decision making.

Tactile categorization task
To investigate the algorithms giving rise to vibration judgment, we employed the psychophysical task of (Hachen et al 2021) in which rats have to judge each trial's vibration as belonging to one of two categories, high-intensity or low-intensity (in shorthand, 'strong' or 'weak'). In figure 1(a), trial structure is illustrated along with an example stimulus. The rat triggers trials by nose-poking ('nose in'). After a 500-700 ms delay, the vibratory stimulus is initiated. The vibration lasts 500 ms and, 500-700 ms after its termination, an auditory cue signals to the rat to withdraw from the nose poke ('nose out') and choose between the left and right spouts. The interval from nose out on one trial to nose in on the next trial is referred to as the intertrial interval, and is paced by the rat. This design, differently from many studies of tactile processing in which stimulus time is set by the experiment software (Berditchevskaia et al 2016, Lee et al 2016, Bale et al 2017, Lee et al 2020a, enhances performance by presenting stimuli only when triggered by the animal's decision to enter the nose poke. The rat's performance of the task is shown schematically in figure 1(b). By entering the nose poke (left panel), the whiskers on the right side of the snout are positioned in contact with the plate. Plate translation, driven by a shaker motor along the axial dimension, moves the whiskers rapidly forwards/backwards to form a vibration (see details below). On each trial, either the left or right spout is activated to release a reward (right panel) according to whether vibration intensity is above or below the category boundary. Triggered by the rat's approach, a correct choice is rewarded by a fixed water quantity and accompanied by a reinforcing sound.
The stimulus of each trial consists of a sequence of velocity values sampled from a Gaussian distribution, giving rise to a vibration containing frequencies up to 120 Hz (Fassihi et al 2014, Esmaeili and Diamond 2019, Hachen et al 2021, Toso et al 2021a, 2021b. Because rat sensory cortical neurons robustly encode speed but not velocity (Fassihi et al 2017), we may also consider the stimulus as a sequence of speed values drawn from a half-Gaussian distribution. A single vibration's intensity is thus defined in units of mean speed. When received on the fingertip, human subjects experience the mean speed of such vibrations as subjectively mapped to intensity, strength, or amplitude (Toso et al 2021a). Figure 1(c) illustrates an example sequence of five stimuli presented across five trials, numbered from n − 4 to n; in our convention, the current trial is always denoted n. The full task configuration and the intertrial intervals (figure 1(a)) are not depicted here. The stimulus set consists of nine linearly spaced intensities, ranging from 43 to 163 mm s −1 . The four stimuli of greatest intensity are rewarded as 'strong,' meaning that one reward spout (e.g. right) is baited after these stimuli. The four stimuli of lowest intensity are rewarded as 'weak,' meaning that the other reward spout (e.g. left) is baited. On trials where the presented stimulus is on the category boundary (e.g. trial n − 2), choices are rewarded with 0.5 probability at either spout. The experiments presented here employed a category boundary at the stimulus intensity of 103 mm s −1 , such that the boundary lies at the mean/median of the stimulus set (see Hachen et al (2021) for experiments with non-centered category boundary).
In the modeling and experimental studies presented here, the probability, per trial, of presentation of any individual intensity value is a uniform value of 0.11 (figure 1(d)).

Dynamics of the tactile decision criterion
To classify stimuli, the sensory-perceptual decision-making system needs to create an internal decision criterion, based on previous experience of stimulus/choice/reward contingencies; each new stimulus must By placing its snout in the nose poke, the rat triggers a whisker vibration. The rat withdraws upon hearing the go cue and seeks the reward. The time until next nose poke is determined by the rat. (b) Schematic example trial. Left: the rat's whiskers are in contact with the motor-actuated plate to receive the vibration. Right: the rat has correctly chosen the right reward spout and collects the liquid reward. (c) Sequence of five trials within a session. Stimuli of intensity greater than the boundary stimulus, 103 mm s −1 , are rewarded as 'strong' (light-red shading) while stimuli of intensity below the boundary are rewarded as 'weak' (light-blue shading). Stimuli on the boundary are rewarded randomly. (d) Each stimulus value is presented with equal likelihood of 0.11 per trial.
then be compared to this criterion. For optimal performance in a laboratory setting, the brain's decision criterion would be identical to the software boundary that separates the two stimulus categories (figures 1(c) and (d)). Since the previous experience should lead, ideally, to one fixed 'reference' criterion that overlies the reward boundary, we have referred to this as a 'reference memory' task (Hachen et al 2021).
Carrying out the task in the ideal manner outlined above would require flawless performance of a sequence of operations: (i) exact and stable alignment of the internal criterion to the reward boundary, (ii) noiseless sensory coding of the vibration, and (iii) noiseless comparison of the realtime sensory representation of the stimulus to the internal criterion. This oversimplified blueprint of the task also assumes high motivation, absence of distraction, and perfect recall and implementation of the choice rule (e.g. 'strong stimulus means turn left').
To better understand intensity categorization, we first consider point (i), the alignment of the internal criterion to the reward boundary. The internal criterion applied on each trial divides the stimulus dimension into one range where the current trial's intensity is more likely to be judged as 'strong' and the complementary range where the current trial's intensity is more likely to be judged as 'weak.' However, the brain does not seem to process all past stimuli, choices, and rewards to formulate a noiseless, immutable mental representation of the decision criterion. Recent work, instead, has suggested that rats and humans form the decision criterion, denoted µ, through a weighted averaging of stimulus intensities across the sequence of recent trials. Hachen et al (2021) presented a recursive model of the trial n criterion, µ n , as an exponentially weighted average of the history of stimuli up to and including n − 1 where intensity n−1 and µ n−1 (respectively, the preceding stimulus and the previous criterion, applied on trial n − 1) are summed with relative exponential weights given by the time constant τ . This constant (expressed in units of number of trials) provides a timescale for the influence of preceding trials. The rat's decision is a binary choice resulting from the comparison of its percept of intensity n to the criterion µ n .
In the remainder of the paper, we will use computational modeling and simulations to explore this sensory-perceptual decision-making model more deeply, asking the following questions: what is the effect of criterion updating on the current trial choice? How does the stability of the decision criterion depend on τ ? How does the imperfect acuity of sensory representation interact with the criterion to determine overall performance? Finally, we will extend beyond modeling and simulation to examine the application of this model to actual psychophysical data acquired from rats.
Following from equation (1), figure 2(a) illustrates criterion updating between two sequential trials, n − 1 and n, when τ assumes the values of 1, 2, 4 and 8. At the top-left corner of each plot, the criterion applied on trial n − 1 is given by the small green square (to be accurate, the trial n − 1 criterion, having been updated from n − 2, n − 3, n − 4 etc, would itself depend on τ , but the depiction is locally correct once a given value of n − 1 criterion is assumed). Stimulus n − 1 (bottom-left corner of each plot) is positioned substantially below the criterion and therefore, with high likelihood, would be judged as 'weak.' The key is the successive criterion updating. After the n − 1 choice is made, the criterion is attracted (downward arrow) along the intensity dimension in the direction of the value of stimulus n − 1. This 'discretized,' step-like attraction, modeled in the remainder of the study, has been shown to be a good approximation for a more physiologically realistic time-continuous attraction of the criterion towards stimulus n − 1 (Hachen et al 2021). In the upper-left plot, with τ = 1, the criterion (by equation (1)) would shift 63% of the distance to stimulus n − 1 before the presentation of stimulus n. Due to this large step, µ n lies well below the intensity of stimulus n which, as a consequence, would likely be judged as 'strong.' The same updating procedure is shown in the upper-right plot with τ = 2. The criterion would shift 39% of the distance to stimulus n − 1 before the presentation of stimulus n. The criterion now overlies the intensity of stimulus n; as a consequence, the choice might be 'weak' or 'strong' with nearly equal likelihood. Following the same updating procedure with τ = 4 (lower-left plot), the criterion would shift 22% of the distance to stimulus n − 1 before the presentation of stimulus n. The subject would show a slightly greater likelihood of judging stimulus n as 'weak' than 'strong.' With τ = 8 (lower-right plot), the criterion would shift just 12% of the distance to stimulus n − 1 before the presentation of stimulus n. Due to this small step, the criterion µ n remains well above the intensity of stimulus n which, as a consequence, would likely be judged as 'weak.' From this simulation, the significance of the updating time constant emerges: different values of τ lead to the prediction of opposing judgments of the same stimulus, in this case trial n. In general, τ can influence whether individual stimuli within a long chain of trials will be perceived as 'weak' or 'strong.' The size of τ matters: a short time constant will cause the criterion to take a large step towards the value of each new stimulus, strongly affecting choice on the next trial. A long time constant will cause the criterion to take only a small step towards the value of each new stimulus, making the choice on the next trial dependent on the more distant history of preceding stimuli already incorporated in the criterion.
The same criterion updating algorithm is shown for a sequence of 20 trials in figure 2(b). Each stimulus is denoted by a red asterisk. The trial-by-trial criterion, µ n , is given in magenta for τ = 2 and in green for τ = 8. The ideal boundary, matching the reward rule, is positioned at 103 mm s −1 (dashed line; also see figures 1(c) and (d)). Because a small τ causes the criterion to take large steps towards each new stimulus, the magenta time sequence shows substantial fluctuations around the ideal boundary. The green time sequence shows much smaller fluctuations. In figure 2(c), the distribution of criterion value, µ, is shown for a simulation in which 50 000 trials are considered for each value of τ (see color scale). This simulation demonstrates that, provided two conditions are satisfied-the category boundary imposed by the environment is fixed over time, and is near the mean of the entire stimulus distribution-the longer time constant will afford better performance because the subject's internal criterion adheres more closely to the externally-imposed category rule.

The role of decision criterion dynamics in the judgment of vibration intensity
The nervous system of a biological organism is characterized by variability over time (Mazzucato 2022) The non-deterministic nature of sensory-perceptual decision-making can be quantified with the methodology of psychometric analysis (Dayan and Abbott 2005, Purcell et al 2010, Haefner et al 2016, Kingdom and Prins 2016. The data typically consist of the probability of making a given judgment in relation to systematic steps along the stimulus dimension. The resulting set of points reveals the system's behavioral input/output function. Fitting of the raw data can be achieved through logistic psychometric curves; in the present case, the psychometric curve assesses the probability with which the stimulus is judged 'strong' in relation to its physical intensity: One such logistic function, generated by simulation with artificial data, is illustrated in figure 3(a). Two of the curve's parameters are λ (upper lapse rate) and γ (lower lapse rate). Lapses (Wichmann and Hill 2001, Swets 2014, Kingdom and Prins 2016 are errors that cannot be accounted for by the limits of sensory acuity (e.g. they are due to bias, inattentiveness, loss of motivation, or rule-checking) and will not be further discussed in this report.
Additional parameters are σ (an acuity term that dictates curve steepness) and µ (the stimulus value aligned to the curve inflection point). The slope of the psychometric function when stimulus intensity = µ is proportional to 1/σ. A steeper psychometric function at µ is associated with a smaller value of σ. In this plot, σ = 32 and its inverse, in units of (mm/s) −1 , is 1/32. In functional terms, σ represents the standard deviation of the Gaussian distribution of trial-by-trial noise in the sensory code. In figure 3(a), the probability density function giving rise to the psychometric function is shown in the inset. Thus, for instance, if a stimulus of intensity 103 is presented on many different, independent trials, it will be encoded in the sensory system as representing a stimulus value of 103 on average, but on many trials the sensory system may report 85, 93, or 112. For this reason, perceptual judgments would be probabilistic even if the decision criterion were perfectly stable.
To this point, the term µ has been used in two contexts: first as the decision criterion (equation (1), figure 2) and then as the stimulus value corresponding to the psychometric curve inflection point (equation (2), figure 3(a)). What is the logic behind the dual use of this term? In classical psychophysics, the point of subjective equality (PSE) is the stimulus value at which the two choices are equally likely, i.e. probability judged 'strong' = probability judged 'weak' = 0.5. In the case of nearly symmetric lapses (λ = γ), as in the simulation of figure 3(a) and in our empirical data set (see later sections), µ is nearly equal to the PSE and µ thus divides the stimulus dimension into one range where vibration intensity is more likely to be judged as 'weak' and the complementary range where intensity is more likely to be judged as 'strong. ' We can thus take µ as a proxy for the rat's decision criterion. If µ is dynamic, then the criterion at work on trial n may be denoted µ n .
This framework for decision-making dynamics, given by equations (1) and (2), states that a subject's choices can be predicted by a model where stimulus n − 1 modifies the trial n choice by 'pulling' the decision criterion from µ n−1 to µ n . Trial-by-trial updating of µ (assuming lapses and acuity are stable) is equivalent to leftward and rightward shifts of the brain's internal sensory-perceptual decision-making function; these shifts would affect judgments as if the psychometric function were sliding horizontally (Hachen et al 2021). It is informative to consider the magnitude of the expected shift of the trial n psychometric curve caused by trial n − 1. We simulated a subject, endowed with the perceptual parameters of figure 3(a), and with µ updated according to equation (1). This artificial subject was given a time constant τ of two trials. Figure 3(b) shows nine trial n curves, separated according to n − 1 (color bar). The psychometric curve shifts leftward after a low-intensity n − 1 and rightward after a high-intensity n − 1; the red squares denote the PSE, which corresponds exactly to the value of µ. This is equivalent to reasoning that after a weak stimulus the next is more likely to be judged as 'strong,' and after a strong stimulus the next is more likely to be judged as 'weak.' This repulsive effect was hinted at in figure 2(a): as stimulus n − 1 'attracts' the decision criterion, there is a tendency to judge each sequential stimulus in contrast to the previous one.
To this point, we have limited the analysis to the serial effect carried over from n − 1 to n. However, the model of equation (1) is recursive, such that n − 2 and n − 1 may be substituted for n − 1 and n, respectively. Just as stimulus n − 1 attracts the criterion that will be applied on trial n, stimuli even earlier than n − 1 must be expected to exert effects. In other words, a memory for more remotely past stimuli is built into the model, inasmuch as the criterion upon which stimulus n − 1 acts has been previously influenced by n − 2, and so on. By the same algorithms of figure 3(b)-(d) show the progressively diminishing effects of stimuli n − 2 and n − 3, respectively.
Stimulus history is continually built up as new trials are sequentially embedded within the running value of the criterion. Using equation (1), the next simulation computes the likelihood of judgment of stimulus n as 'strong,' averaged across all intensity values of trial n, in relation to the intensity of one selected preceding trial, from n − 1 to n − 6. In figure 3(e), τ is set to 1 and the position of the preceding trial of interest is given by the color scale. Stimulus n − 1 has a strong impact on the current choice, with >20% change in choice likelihood for n − 1 at the lowest and highest intensity. The impact of more distant trials declines rapidly, with stimulus n − 6 exerting negligible impact. In figure 3(f), τ is set to 10; stimulus n − 1 now has a much more limited impact on the current choice, with a <4% change in choice likelihood for n − 1 at the lowest and highest intensity. Interestingly, the more distant stimuli have almost as large an effect as stimulus n − 1.
We further investigated how preceding stimuli contribute to choice by applying a logistic regression model. Specifically, employing the psychometric function of figure 3(a), we predict the trial n decision by the probit link function: where seq n = β 0 + β 1 · intensity n + β 2 · intensity n−1 + · · · + β i · intensity n−i +1 .
The term seq n represents the linear sum of the current stimulus, intensity n , and a history of up to i preceding stimuli, each weighted with a coefficient b i , while b 0 is an intercept term. Figure 3(g) shows that with τ = 2, the weight of preceding trials declines rapidly. As τ is set to the progressively higher values of 4, 6, and 8, the decline in weights in more distant history is progressively less steep. All decay functions are exponential. The weights are negative due to the 'repulsive' effect of preceding trials (e.g. figure 2(a)): a stronger n − i trial increases the likelihood of trial n being judged 'weak,' and vice versa. Thus, the significance of a greater τ -a longer time constant of integration-is that each current judgment incorporates a longer sequence of previous stimuli. The reference memory that forms the criterion is, in effect, built by integrating across a longer history.
With the psychometric curve parameters of figure 3(a), choices simulated according to two values of τ lead to two distinct psychometric curves ( figure 3(h)). The curve associated with τ = 1 is shallower due to the fluctuations in the decision criterion; the curve associated with τ = 10 is steeper due to the stability in the decision criterion. This simulation reinforces the findings in figure 2(b): the longer time constant will afford better performance because the subject's internal criterion adheres more closely to the externally-imposed category rule. Provided the category boundary imposed by the environment is fixed over time and is near the mean of the entire stimulus distribution, a longer τ will support higher performance.
The integration time constant is, of course, not the only factor that is decisive in the subject's accuracy. In general, proficiency in judging stimuli as weak or strong will depend on three interrelated factors within the subject's perceptual decision making system: τ , acuity, and lapse rate. The next simulation considers in more detail how τ and acuity interact to set the overall performance. To isolate the factors of interest, the upper and lower lapse rates (the frequency of non-sensory errors; see equation (2) are fixed (λ = γ = 0.07). Acuity determines how strongly the choice is affected by some given step size along the stimulus dimension, and is quantified as 1/σ, where σ is the standard deviation of the probability density function underlying the psychometric function (see figure 3(a)). For this simulation, acuity ranges from 1/10 to 1/60. On the other hand, the left-right positioning of the PSE-corresponding to the decision criterion, µ-is dynamically updated according to τ of equation (1). Figure 4 shows that, for any given value of acuity (see color scale), increasing τ from 1 to 12 yields progressively better performance. If the system is endowed with low acuity, the increase in τ affords an improvement of only about 1% correct. If the system is endowed with high acuity, the same increase in τ affords an improvement of about 8% correct.
The greater influence of τ within a high-acuity system can be appreciated by recalling the alignment of the subject's trial-by-trial psychometric function to the externally-imposed category boundary. If that function is steep (i.e. acuity is high) then large trial-by-trial fluctuations in the decision criterion µ, stemming from short τ , will frequently cause weak stimuli to be judged as 'strong' and vice versa, thus diminishing performance. By contrast, if trial-by-trial fluctuations in µ are dampened by a long τ , then the subject's trial-by-trial psychometric function will be closely aligned to the externally-imposed category boundary.
If the internal psychometric function is shallow (i.e. acuity is low) then large trial-by-trial fluctuations in µ will have less impact: for any stimulus positioned near the boundary, the shallowness of the psychometric Figure 4. Impact of acuity and τ on performance. In this simulation performance is measured as the % correct pooled across all stimulus intensities. Increasing values of τ lead to better performance; the integration time constant has a magnified influence if the subject's acuity is high. function leads to a relatively high proportion of choice errors, independently of the closeness of alignment of µ to the category boundary.

Judgment of vibration intensity in rats
As a step towards verifying the decision-making framework outlined to this point, we have examined the intensity classification performance of four rats. Under the conditions of the uniform distribution of figure 1(d), the rats were trained for about three months each until demonstrating stable performance. In the analyzed data set, rats zy1-4 had overall performance of 74%, 77%, 75% and 77% correct, respectively. Figure 5(a) reports the performance, as percent correct, of all four rats in the 53, 52, 57 and 59 test sessions (per rat) that yielded the data analyzed in further sections. Performance of all rats was stable, in the range of 70%-80% correct. The maximum obtainable performance was 94.4% correct, since the stimulus on the category boundary (103 mm s −1 ) was rewarded randomly.
How did performance evolve within single sessions? Figure 5(b) depicts the percent correct in five-trial windows (beginning with trials 1-5 and concluding with trials 191-200) averaged among all the sessions indicated in figure 5(a), for all four trained rats. Improvement associated with stabilizing the internal decision criterion would saturate after about three times τ , or roughly 10-20 trials. For rats zy2 and zy4, performance from session onset improves rapidly and reaches steady state after around 20 (zy4) and 30 (zy2) trials, consistent with the time scale necessary to establish the decision criterion. For rats zy1 and zy3, performance improves more gradually than can be explained by the time scale associated with τ . Although there is no direct evidence to explain their trajectory toward steady state, we speculate that for the two slower rats a sense of urgency (as they are water-restricted in the home cage) causes them to allocate too little attention to the vibration and thus to fail to fully incorporate the available sensory evidence. Incomplete sensory processing of the stimulus would lead to two outcomes. First is the failure to form a reliable representation of the current stimulus, which must be compared to the criterion. Second is the failure to precisely establish and update the decision criterion trial by trial, since criterion updating relies first and foremost on the accurate encoding of sensory inputs. Beyond this, sensory-independent errors (lapses) might also be triggered by urgency. Additional work could clarify the factors underlying poor performance at the session outset and the time course of improvement. Global and local dynamics of rat performance in vibration intensity judgment. (a) Four well trained rats show stable performance across tests sessions, with % correct remaining between 70% and 80%. Each data point represents the average performance across a window of ten sequential sessions with step size of one session for the advancement of the window. (b) Change in performance during a session from trial number 1-200. Each data point represents the average performance across a window of five sequential trials with step size of one trial for the advancement of the window. Shaded area is the 95% confidence interval. Rats zy1 and zy3 show gradual improvement from the session onset, while rats zy2 and zy4 show rapid improvement from the session onset.
Figure 6(a) shows the psychometric curves obtained for the four rats, with the rat's response on trial n not conditioned on the value of stimulus n − 1. The psychometric curves of rats zy1-4 were fit by σ values of 32, 30, 37 and 32 mm s −1 , respectively. Figure 6(b) shows the psychometric curves after the rat's response on trial n is separated according to the value of stimulus n − 1 (color scale). All four rats showed a pronounced leftward psychometric curve shift after a low-intensity n − 1 and a rightward shift after a high-intensity n − 1, as highlighted by the red squares denoting the dependence of the PSE on the intensity of stimulus n − 1. This effect-after a weak stimulus the next is more likely to be judged as 'strong,' and after a strong stimulus the next is more likely to be judged as 'weak'-was already simulated in figure 3(b) on the basis of trial-by-trial criterion updating.
We asked whether the main finding of the effect of stimulus n − 1 on trial n choice depends on whether trial n − 1 choice was correct or not. The overall repulsive effect is equivalent to a decreasing likelihood of stimulus n being judged strong as stimulus n − 1 intensity increases. Figure 7 demonstrates that the main effect, the negative slope of the curve p(strong) in relation to stimulus n − 1 intensity, holds whether n − 1 choice was correct (green) or incorrect (red). Additional details highlight the individuality of the single subjects. Rats zy1 and zy4 had no side-bias; after pooling all stimulus n values, trial n choice was equally likely to be 'weak' or 'strong.' Rat zy2 showed a small 'weak' bias, but this bias was not substantially affected by the correctness of trial n − 1. Rat zy3 showed a significant 'strong' bias, and this bias was amplified after incorrect trial n − 1 (vertically displaced red plot), as if non-sensory factors (the bias) exerted more weight after an error. By contrast, rats zy1, zy2, and zy4 showed no substantial trial n choice difference according to n − 1 correctness. The biases of both zy2 and zy3 ('weak' and 'strong,' respectively) are also visible in the psychometric curves of figure 6(b).

Estimating the criterion-updating time constant in behaving rats
Before conducting the analysis to recover τ values from the empirical data, it is useful to recapitulate the dynamics posited to underlie the judgment of vibration intensity. In simulated data, we have seen that for any given τ , a trial-by-trial resetting of the decision criterion will be determined (figures 2(a) and (b)). The sequence of criterion values allows us to formulate a sequence of expected judgments: on trial n − 1, the choice probability curve (estimated by the psychometric function) can be centered on the decision criterion value, µ n−1 . Stimulus n − 1 intensity is then projected onto the curve to predict the likelihood of the two alternative choices, 'strong' and 'weak.' After the decision is executed, the criterion will be translated in the direction of stimulus n − 1 ( figure 2(a)). On trial n, the comparison of stimulus intensity n to the choice probability curve at its updated position is carried out. This can be repeated over many trials, giving a series of simulated choices associated with the given value of τ . For a different value of τ , a different series of simulated choices for the same stimulus sequence will emerge.
An inverted analysis procedure allows us to recover the brain's internal τ from real, empirical data. First, for the actual trial sequences presented to each rat, a sequence of choice probabilities must be generated according to a large set of possible τ values, as outlined above. Then, for each τ value, the sequence of generated choice probabilities must be compared to the observed choices of the rat. The best estimate for the brain's integration time constant is the value of τ that brings about the closest prediction of observed rat behavior.
While the model predicts choice probability on a given trial by centering a smooth logistic function on the decision criterion value computed for that trial, in the actual experiment the rat's decision is, of course, binary-'strong' or 'weak.' To compute the prediction error within a large set of trials, we employ the Brier score (Brier 1950 where N is the total number of trials, p(strong) n is the probability of the rat giving the 'strong' response in a specific trial n once the psychometric function is centered on µ n , and choice n is the observed outcome for that same trial (a binary variable, 0 or 1). The Brier score on a single trial can thus range from 0, where the logistic function value for that stimulus matches the choice, to 1 where the logistic function value for that stimulus is opposite to the observed choice. By this computation, the closer the τ value assumed in a given test run is to the τ present in the behaving rat's brain, the more accurate will be the model predictions of the rat's choices, and consequentially the lower will be the average Brier score. For the data illustrated in figure 6, we used the above estimation procedure to compute the average Brier score for values of τ ranging from 1 to 15 trials, in steps of 0.1. Figure 8 (upper) plots the result for each rat over the range of tested τ values, with the Brier score transformed to a z-score for clarity. It can be seen that at the best-fitting value of τ , the score was a well-defined global minimum; at these minima, the criterion updating time constant most accurately predicted the rats' trial-by-trial choices. To assess the stability of the estimates, we performed a bootstrap procedure: for each rat, we randomly sampled behavioral sessions with replacement, to obtain a sample of S sessions, where S is the total number of sessions for the rat. We estimated τ within each sample by employing the method described above, for 1000 different session samples. Figure 8 (lower plot) shows the resampled τ values following the bootstrap procedure. The average τ values for each of the four rats (triangles) were 3.2 trials (range of 2.6-3.8 at 95% confidence interval), 4.8 trials (range of 3.7-6.2), 5.1 trials (range of 3.6-8.0), and 7.3 trials (range of 5.8-9.5). These analyses validate the plausibility, in the simulated and in the real nervous system, of the proposed framework wherein stimulus intensity is judged as the comparison of ongoing sensory input against a criterion constructed from the time-weighted average of the history of recent stimuli.

Discussion
In response to mechanical inputs, the peripheral stage of tactile processing is characterized by astonishingly high levels of temporal precision and reliability, as seen in hand afferents in humans (Dépeault et al 2008, Birznieks and Vickery 2017, Watkins et al 2022 and in non-human primates (Lindblom 1965, Recanzone et al 1992, Kim et al 2010, Weber et al 2013, Alvarez et al 2015, Long et al 2022 as well as in rodent vibrissal receptors (Arabzadeh et al 2006, Kleinfeld et al 2006, Mitchinson et al 2011, Diamond and Arabzadeh 2013, Maravall and Diamond 2014, Bale et al 2017, the system addressed in the current study. When engaged by naturalistic sequences of whisker motion, neurons in the rat trigeminal ganglion fire with sub-millisecond variability over repetitions of the same stimulus stream (Arabzadeh et al 2005). Once sensory inputs reach the level of the cerebral cortex, trial-to-trial variability in the neural responses to repeated presentations is much greater, both in primates (Manley and Müller-Preuß 1978, Lee et al 1998, Harvey et al 2013, Song and Francis 2013, Gómez-Laberge et al 2016, Ruff and Cohen 2016, Festa et al 2021, Stephani et al 2021 and in rats (Panzeri et al 2001, Arabzadeh et al 2003, 2004, von Heimendahl et al 2007, Lak et al 2008, Kheradpezhouh et al 2017, Sederberg et al 2019. While the apparently lower fidelity of sensory representations across cortical processing stages can be interpreted as an inevitable and perhaps non-optimal physiological outcome of multitudes of converging and diverging synaptic networks (Sompolinsky et al 2001, Ecker et   random trial-to-trial noise in the perceptual judgment of stimulus intensity can be recast as the highly systematic modulation of the processing of the current stimulus according to the sequence of preceding stimuli. The ongoing stimulus was judged not in relation to some absolute physical scale, but in relation to a continuously updated context. Our simulations show that the context can be effectively captured by an updating time constant, τ . Whereas the preceding study (Hachen et al 2021) suggested the presence of two clusters of rats-three 'hot rats' with time constant τ around 2.5-5 trials and three 'cold rats' with τ around 5-8 trials-the current study reveals that τ may be distributed more continuously and that the clusters seen in the earlier study were not a universal result. An issue that is now of central interest is whether τ is hard-wired into the individual rat's brain (and the individual human's brain) or is an adaptable function. If adaptable, a contraction of τ under volatile conditions and an extension of τ under stable conditions could optimize behavioral performance. For example, in a situation where the current stimulus must be compared not to a remote, fixed boundary but to some set of recent stimuli-essentially, a change detection task-the subject would perform ideally by implementation of a short time constant.
The experimental paradigm involved implementing a category boundary to separate stimuli rewarded as weak versus strong, but rat (present work and Hachen et al 2021) and human (Hachen et al 2021) nervous systems do not seem to have access to an internal mental representation of the boundary in an absolute scale. In sum, although it can be appealing to conceive of sensory-perceptual systems as ideal observers that reliably map physical inputs onto the appropriate responses, our simulations and experimental data reveal prominent variability, and performance of a perceptual task appears to involve less a rigid stimulus-toresponse transformation than a flexible adjustment to the full experimental context.
The model developed here-stimulus classification based upon criterion updating-should be conceived of as a data-inspired framework rather than the outcome of a formal multi-model comparison (Burnham and Anderson 2004). It grew out of the fundamental question: when a perceptual system must judge a stimulus as strong or weak, is the current choice isolated in time or is it affected by sensory history? The success of the model under the present experimental conditions and those of previous work (Hachen et al 2021) suggests that alternative models, even if not explicitly tested, likely have lower explanatory power. One such model is that preceding stimuli have no systematic effect on the current trial's (trial n) perceptual judgment. If that were the case, then figure 6(b) would fail to uncover the pronounced leftward and rightward psychometric curve shifts after low-and high-intensity stimulus n − 1 (respectively). Further, according to a model postulating the absence of history effects, a simulated sequence of choices based on a fixed decision boundary would better match rats' actual choices than would a simulated sequence of choices based on decision criterion updating. A second possible model is that preceding stimuli have an attractive, not repulsive, effect on the current trial's perceptual judgment: stimulus n may 'feel like' stimulus n − 1. This is excluded by the raw data; if previous stimuli were attractive, the dark blue to light green sequence of curves in figure 6(b) would be inverted in order. A third possible model is that history effects are limited to a one-back repulsive phenomenon: stimulus n may 'feel opposite to' stimulus n − 1, and only stimulus n − 1. In that case, the n − 2 to n − 6 effects seen in earlier work (Hachen et al 2021) would not be seen and, correspondingly, our fitting routines would have uncovered values of τ below one trial. Earlier work has suggested that the context is not only sensory, but also includes the history of rewards and choices (Helson 1964, Lages and Treisman 1998, Morgan et al 2000, Gepshtein and Kubovy 2005  Research and development in artificial sensors in autonomous agents aims to fabricate durable, precise transducers of external forces, mimicking the precision and reliability of real, biological tactile mechanoreceptors (Chicca et al 2014, Büscher et al 2015, Bartolozzi et al 2016, Massari et al 2022, Sengupta et al 2022, Liu et al 2022. If artificial sensors are intended for integration into humans, e.g. to endow a prosthetic element with sensing, the artificial sensors must also be biocompatible (Nag et al 2016). Although robust transducers that convert minute quantities of mechanical energy into signals will be required for agents to sense the world and behave accordingly (Arlett et al 2011, Rodrigues et al 2020, Sengupta et al 2022, one implication of the present work is that inputs from such sensors must be processed in a way that relates the current stimulus to its context.
In relation to the implementation of artificial systems, the present results may be considered in two different contexts: (i) an artificial sensing apparatus that provides input to the intact human nervous system as a means to substitute the loss of peripheral sensorimotor elements, e.g. a prosthetic hand or fingers (Bensmaia et al 2020), and (ii) a robot-a fully artificial autonomous agent which comprises not only the artificial sensing system but also a processing hardware/software to guide meaningful actions on the basis of sensor input. In the first case, it is safe to assume that the perceptual dynamics described in this report would occur through physiological mechanisms already in place in the individual's nervous system. In the second case, the dynamics giving rise to 'perception' would need to be programmed into the autonomous agent. The main outcome of the present study is that even when faced with a fixed, constant category boundary, the current input is judged in relation to recent history. How distant that history extends depends on the time constant parameter, τ . The observed values of τ , on the order of 3-7 trials, implies that rats (current study and (Hachen et al 2021) and humans (Hachen et al 2021) judge vibration intensity as if performing change detection. Importantly, change detection has been argued to be the key 'high level abstraction that captures the essence of biological sensory encoding' (Bartolozzi et al 2022) and can be efficiently implemented in neuromorphic perception (Chicca et al 2014, Bartolozzi et al 2022. If biological perceptual dynamics is to be programmed into autonomous agents, a key message of the current work is the multiplicity of timescales, as highlighted in (Bartolozzi et al 2022). Leading edge neuromorphic engineering solutions typically address adaptation in the scale of ms or hundreds of ms (Chicca et al 2014) while our results show adaptation extending over multiple trials, where each trial lasts about 5-10 s (Hachen et al 2021).
In sum, one common perceptual task-solving the problem of whether the ongoing stimulus is strong or weak in comparison to the center of the stimulus range-can be accomplished by a criterion updating algorithm. Can this simple algorithm be modified to support other forms of judgment? If the sensory-perceptual decision-making task requires detection of the highest-intensity stimulus within a sequence, the same central tendency criterion, µ, could be generated but the behavioral output would require adding one increment, κ, so that the stimuli of intensity greater than µ + κ are identified as targets. Thus, an algorithm that flexibly implements the central tendency of a distribution, like equation (1), may be adapted to support additional behavioral functions. A problem of ongoing interest is the algorithms at work to support stimulus classification in an unstable, volatile environment. In such an environment, the decision criterion of an individual must be adaptable to the changing statistics of sensory input.
One 'hidden' advantage of the algorithm of equation (1) is that it involves holding a memory trace of the intensity of the most recent stimulus, intensity n−1 . For the purpose of judging each stimulus relative to a long-term reference, the memory trace of intensity n−1 acts as the quantity that attracts and updates the criterion, µ. The short-term buffer is not purposefully engaged in the reference memory task. However, the same network may be employed to execute a delayed comparison task (Harris et al 2002, Preuschhof et al 2010, Fassihi et al 2014, wherein the subject must determine if intensity n is greater than or less than that of the preceding stimulus, intensity n−1 . This formulation can subserve another useful behavior in biological and artificial agents: change detection. For instance, are inputs growing or diminishing over time? In conclusion, these experiments provide indications for how an encoded physical quantity may serve as the raw material for making perceptual judgments in real, living organisms. Mimicking the algorithms present in the nervous system might help endow artificial systems with the ability to make context-dependent classifications.

Methods
All protocols conformed to international norms and were approved by the Ethics Committee of SISSA and by the Italian Health Ministry (license number 429/2020-PR).

Subjects
Four young adult male Wistar rats (Harlan Laboratories, San Pietro Al Natisone) were handled for one week and then were trained daily for about three months to reach stable performance. Stable performance was defined as achieving at least 75% correct in three consecutive sessions. The period prior to such stable performance is referred to as 'training' while the period thereafter is comprised of the 'test sessions' which provided the data analyzed here.
Their health condition was checked before daily training and their weights were measured weekly to ensure standard growth. They had access to a large multi-level playground and other environmental enrichments every day. To provide social enrichment, they were caged in pairs. They were maintained on a 12/12 h light/dark cycle. They had free access to food but their accessibility to water was restricted to the time of the test sessions. To avoid any stress due to water restriction, the experimenter ensured they were saturated after every training or test session. On every working day, they completed one session for 1 h, consisting of around 300 trials. On weekends they had free access to water in their home cages.

Experimental apparatus
The apparatus, custom-built by CyNexo (www.cynexo.com/), consisted of a Plexiglas box measuring 25 × 25 × 38 cm (height × width × length) which was located inside a sound-proof and lightproof chamber. Reward spouts on each of the two sides of the apparatus, fashioned from metal tubes with a plastic lip, delivered 0.03 ml of water. They were actuated by syringes controlled by pressure-pumps, on correct choices. A rounded head-port on the front wall of the apparatus allowed rats to access the nose poke, a circular aperture of 0.85 cm diameter. During sessions the box was closed with a Plexiglas cover and monitored with a camera placed on top of the apparatus. All the software for the control of the rat experiment were written in-house in LabVIEW (National Instruments, Austin, TX).

Behavioral task
An LED placed on the nose poke signaled to the rat that a trial could be initiated by crossing the optical sensor inside the nose poke. In the nose-poking position, the rat's right whiskers touched the plate. Task structure and apparatus configuration are given in figures 1(a) and (b) and accompanying text. According to vibration intensity one of the two spouts was enabled to deliver fluid reward, e.g. left spout for vibration intensities below the category boundary, 103 mm s −1 , and right spout for vibration intensities above the category boundary. No reward was delivered after incorrect choices. After presentation of the stimulus on the category boundary, reward was assigned randomly to one of the two spouts. After incorrect choices, the nose poke sensor was inactivated for 1500-3500 ms, forcing the rat to wait for the next trial. The reward rule for each rat (the 'weak,' 'strong'/reward spout contingency) was held constant across all training and test session and switched between different rats.

Vibrotactile stimuli
The stimulation medium consisted of a rectangular plate (20 × 30 mm) connected to a motorized shaker (Bruel and Kjar, type 4808) to which velocity values were sent as analog signals, moving the plate along the rostro-caudal axis. Stimuli were vibrations of the plate made of low-pass filtered white noise. Velocity values of one stimulus were sampled at 10 kHz from a normal probability distribution function with 0 mean. There were 50 speeds (specific time series) available for each velocity standard deviation. The noise was low-passed through a Butterworth filter with 150 Hz cutoff, amplified, and sent as voltage input to the shaker motor. Vibration speed was quantified as the mean absolute value of velocity (i.e. the mean speed in mm s −1 ), equal to the normal distribution's standard deviation multiplied by √((2⁄π)).

Psychophysical analyses and simulations
Psychophysical analyses of rat data, as well as simulations of the role of the time constant, τ , in choice history were run in MATLAB 2022 (MathWorks) based on the formulations given in Results.

Data availability statement
The data cannot be made publicly available upon publication because they are not available in a format that is sufficiently accessible or reusable by other researchers. The data that support the findings of this study are available upon reasonable request from the authors.