Brain-Labelled Keyboard and Mouse Data Classifies Cognitive Load
Deep learning models were trained to evaluate Cognitive Load from typing and mouse movements using light-based sensor data.
- Sai Kala Sagar Nookarapu, Shruti Kundu, Dr. Amanda Kavner, Dr. Richard Lamb (University of Georgia)
Project: Evaluation and Scoring of Cognitive Demand and Attention for Automatic Recommendations and Summaries Using Mouse and Keyboard Inputs
How hard does a person’s brain work when they are using a computer? Though it is difficult to observe from the outside, mental effort fluctuates throughout the day. It can be measured by brain sensors, but no one wants to wear one while working.
We just used a brain sensor during training in this research. Thirty adults used a mouse and typed while wearing a functional near-infrared spectroscopy (fNIRS) headband. Their mouse and keyboard activity was classified as Low, Medium, or High load by their brain signals. Then, deep learning models were able to estimate that load, using just the keyboard and mouse. The models scored more than double chance on individuals they had never seen, and when they were wrong, they were almost always just one level off.
Why cognitive demand matters
Cognitive demand refers to the mental effort required to process information, maintain attention, use working memory, and perform executive functions. Understanding how cognitive demand changes during computer-based tasks is important, particularly in environments where individuals must continuously process information, evaluate recommendations, and make decisions. However, cognitive demand is not always directly observable through task performance. Physiological measurements may provide additional insight into the cognitive processes occurring during these tasks.
Although brain sensors are accurate, they are not practical for everyday work.
In contrast, keyboard and mouse activity is non-intrusive, free, and constantly available. Without the need for any kind of sensor, computers might adjust summaries and recommendations based on how hard a person is working if keyboard and mouse activity could show cognitive demand. However, behavior-based models require trustworthy labels.
Behavior-based models need reliable labels, though. Questionnaires are subjective and are usually given after a task, not moment to moment. Many studies also test their models on the same people they trained on, which overstates how well the models work for someone new. We addressed both problems:
- Labels were provided moment-to-moment by brain signals during training.
- Models were tested on people it had never trained on.
Reading the brain with fNIRS
Functional near-infrared spectroscopy (fNIRS) offers a noninvasive method of monitoring changes in cerebral hemodynamics associated with neuronal activity. Through neurovascular coupling, increased neuronal activity produces localized changes in blood flow and oxygen delivery to active brain regions. These changes can be measured through concentrations of oxygenated hemoglobin (HbO) and deoxygenated hemoglobin (HbR). Because the prefrontal cortex is involved in attention, working memory, planning, decision-making, and cognitive control, monitoring activity in this region may provide valuable information about changes in cognitive demand.
The physiological component of the study utilizes fNIRS to monitor hemodynamic responses across eight optode positions targeting the frontal and prefrontal regions of the brain. Optode placement follows the international 10-10 positioning system and includes FP1, FP2, AF7, AF3, AF4, AF8, AFz, and Fz. These locations were selected based on their proximity to cortical regions associated with attention, working memory, executive functioning, emotional processing, and cognitive control.
The selected regions provide coverage of both left and right prefrontal areas, as well as midline frontal regions. FP1 and FP2 are associated with frontopolar functions, including planning, attention, and monitoring. AF7 and AF8 target lateral prefrontal regions involved in information processing and behavioral control. AF3 and AF4 cover regions associated with working memory, concentration, and inhibitory control. AFz and Fz provide additional coverage of midline regions involved in decision-making, focused attention, and error monitoring.
During task performance, fNIRS measures changes in HbO and HbR concentrations to characterize localized hemodynamic responses. These measurements provide an indirect assessment of cortical activity rather than a direct measurement of cerebral blood flow.
Each fNIRS’ measurement reflects changes in hemoglobin concentrations within the tissue sampled between the light source and detector. Increased neuronal activity typically produces an increase in oxygenated hemoglobin (HbO) and a decrease in deoxygenated hemoglobin (HbR), reflecting increased oxygen delivery to the active region. Together, these measurements provide insight into localized changes in brain activity associated with cognitive demand.
The study
Data was collected from 30 participants. Each person completed a baseline period, a mouse task, a keyboard task and a rest period. The fNIRS were used to collect brain hemodynamic data throughout, while the keyboard and mouse data were recorded during the same session.
The fNIRS headband was positioned intentionally to ensure consistent placement across the frontal and prefrontal regions. The eight selected positions allowed for measurements across both hemispheres and the frontal midline. During data collection, the fNIRS system continuously recorded changes in oxygenated and deoxygenated hemoglobin while participants completed the keyboard and mouse tasks. These physiological measurements were collected alongside behavioral data to establish relationships between brain activity and computer interaction.

From brain signals to keyboard and mouse models
We turned the brain recordings into labels, passed those labels to the behavioral data, and trained models on the result. The pipeline has four steps:
1. Cut recordings into short windows. Each recording was split into windows of 20 time points, with an overlap of 10 time points from the previous window, so a brief burst of activity is never lost. Brain, keyboard and mouse data were scaled and cut the same way, so their windows are aligned in time.
2. Label each window from the brain. For every brain window, we averaged the HbO signal across the eight channels and compared it with the same person’s rest period. Windows near the group average were labelled Medium, those clearly below were Low, and those clearly above were High (a cut at half a standard deviation). Rest windows were labelled Baseline.
3. Transfer the label to keyboard and mouse data. Each brain label was transferred to the matching behavioral window: 20 mouse samples, or 80 keystrokes. Since one kind of data (the brain) supervises another (behavior), This is called cross-modal supervision,
4. Train the models. For keystrokes and for mouse movement, we trained an ensemble of two deep learning models: A 1D-CNN (one Dimensional – Convolutional Neural Network) and a BiLSTM (Bidirectional Long Short-Term Memory), which spots short patterns like a burst of fast typing, and reads the window in order and tracks how it changes respectively. The keystroke model records the time between keystrokes as well as the key that was pushed (a normal key or Backspace). The mouse model can read jerk, acceleration, and speed. The scores from the two networks are combined into a single response.

To keep the results honest and uncontaminated, we never trained and tested our models on data from the same person. We divided the 30 people into 10 groups of 3. In each round, the models trained on 27 people and were tested on the remaining 3. Everyone has been tested once after 10 rounds. This is called participant-wise 10-fold cross-validation.
What we found
We measured performance with macro-F1, a score from 0 to 1 that gives every load level equal weight, so a model cannot score well by always guessing the most common level. Random guessing scores about 0.33.
- Keyboard and mouse alone predict the cognitive workload at over twice random chance. The keystroke-based model attained a macro-F1 score of 0.75 and the mouse-based model attained 0.72, while a basic statistical method (logistic regression using averages like typing speed) scored roughly 0.50.
- Mistakes are small. 94% of keystroke mistakes and 100% of mouse mistakes were only off by one level, for example medium called high. The mouse model never confused Low with High.
- The brain labels are learnable. An accuracy of 98-99% has been achieved by a model trained on fNIRS data with the same design.
- When the cut points moved, the results were intact. Changing the cut to 0.4 or 0.6 standard deviations, or to equal thirds, changed scores by at most 0.04.

| Model | Levels | Accuracy | Balanced accuracy | Macro-F1 |
|---|---|---|---|---|
| Keystroke model | Low / Medium / High | 0.75 | 0.77 | 0.75 |
| Mouse model | Low / Medium / High | 0.73 | 0.79 | 0.72 |
| Mouse model | Baseline + 3 levels | 0.79 | 0.84 | 0.79 |
| Simple model, keystroke | Low / Medium / High | 0.48 | 0.53 | 0.47 |
| Simple model, mouse | Low / Medium / High | 0.51 | 0.57 | 0.50 |
| Random guessing | Low / Medium / High | 0.33 | 0.33 | 0.31–0.33 |
Limitations
- Most participant’s load changed in a similar way throughout time, so time in the task and load are partly linked. Tasks of varied difficulty in random order would separate them.
- Rather than using a common clock, brain and behavior recordings were synchronized by sample count.
- Since there are no inherent groups in the brain signal, the cut points that designate Low, Medium, and High are a decision. Our robustness assessment indicates that the decision does not influence the outcomes.
- fNIRS measurements can be influenced by physiological factors beyond neuronal activity, including changes in blood pressure, breathing, heart rate, and scalp blood flow. These factors may contribute to variations in the measured hemodynamic signals.
Where this could be used
- Adaptive recommendations and summaries that become shorter or simpler when a user is overloaded.
- Monitoring workloads in jobs that requires lot of information without using sensors.
- Tools for tracking mental exhaustion throughout extended computer sessions.
What’s next
- Collect new data with easy, medium and hard versions of each task, in random order, recorded on one shared clock and train robust models.
Our findings showed that a brain sensor used exclusively during training can teach everyday computer activity to reveal cognitive stress.
This material is based upon work supported in whole or in part with funding from the Department of Defense (DoD). Any opinions, findings, conclusions, or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the DoD and/or any agency or entity of the United States Government.
- Categories: