Working memory demands modulate memory brain state engagement Authors: DT Nguyen, Nicole M Long Published: 2026 ABSTRACT SummaryThe extent to which attention and memory processes rely on shared, as opposed to distinct, mechanisms is critical for understanding the role of both processes in cognition. We hypothesize that memory brain states, whole-brain activity patterns that support long-term memory encoding and retrieval, map onto the external/internal axis of attention. To test this hypothesis, we conducted a scalp electroencephalography study in which participants engaged in a working memory paradigm with and without maintenance demands. We used an independently validated cross-study multivariate pattern classifier to measure memory brain state engagement during change and target detection tasks. We find that the encoding state is recruited for stimulus presentation during both tasks, whereas the retrieval state is selectively recruited during the delay of the change detection task. Together, these results suggest that memory states map onto the external/internal axis of attention to support working memory, long-term memory, and cognition more broadly.Keyword: working memory, encoding, retrieval, external attention, internal attention, brain states, scalp EEG Introduction Upon arrival at the airport, you try to form a memory of the current moment so that you can find your car on your return. You direct your resources to sensory information in the world around you—an alphanumeric sign on a concrete column, a yellow painted number under your car. When you return from your trip, you direct your resources to the stored information to recover those no longer present sensory details. Thus memory—in particular, the processes of encoding and retrieving experiences—is tightly linked to attention or how limited capacity resources are directed.1 Memory encoding and memory retrieval constitute neurally distinct brain states that trade off—meaning that encoding and retrieval cannot occur simultaneously—and this tradeoff impacts behavior.2 Memory brain states may reflect processes specific to episodic, long-term memory, that is, the formation and retrieval of events situated within a particular spatiotemporal context.3 However, growing research suggests that memory brain states may extend beyond episodic memory and instead map onto the external/internal axis of attention.4 External attention constitutes focusing on sensory, environmental information, whereas internal attention constitutes focusing on mental processes and representations. Establishing a link between memory brain states and attention is critical for determining how both memory and attention impact cognition. As working memory (WM) sits at the intersection of external and internal attention, it is well suited for assessing such a link. The aim of this study is to directly connect memory brain states with the external/internal axis of attention via a WM paradigm with and without memory demands. Establishing the degree to which memory brain states reflect how attention is oriented is critical both to the specific goal to identify the mechanisms that support memory and attention and to the broad goal of understanding how brain states impact cognition. Although often considered in isolation, memory and attention have a strong degree of overlap, both conceptually and neurally.5,6,7,8,9 A link between memory brain states and external/internal attention would constrain models of cognition10 and enable online, real-time identification of when and how specific memory and attentional processes are engaged. Furthermore, brain states, or whole brain activity/connectivity patterns,11 modulate how stimuli are processed,12 impact behavior,11,13 and influence the efficacy of brain stimulation efforts.14 Characterizing the factors that induce memory brain state engagement will further understanding of how orienting attention externally vs. internally modulates behavior. Growing evidence suggests that the retrieval state tracks internal attention.10,15,16,17,18 The retrieval state is recruited under explicit demands to retrieve episodic memories19 as originally proposed.3 However, recent work has shown that the retrieval state is also engaged when participants retrieve from semantic memory18 and selectively attend to particular spatial locations.15 The retrieval state is characterized by a sustained pattern of voltage topography that is thought to reflect engagement of the default mode network (DMN20,21,22,23). The DMN supports episodic and semantic memory retrieval24,25 and more broadly, internal mentation.26 In tandem, scalp electroencephalography (EEG) studies have revealed an overlap in the spectral signals that support selection from both perception and memory.27 Specifically, spectral power in the alpha band (10–14 Hz) is modulated both by focusing attention internally28,29,30,31 and by long-term memory retrieval (e.g., Martín-Buro et al.32). Finally, behavioral performance in an episodic version of the flanker task33 suggests that retrieval from short- and long-term memory requires inward focused attention.34 Taken together, these findings suggest that the retrieval state is not specific to long-term episodic remembering, but tracks the degree to which the mind’s eye is turned inward. As WM sits at the intersection between external and internal attention,4 it serves as the ideal testbed for linking memory states to attention. WM enables the maintenance and manipulation of information in the absence of sensory input.35 Like attention more broadly,36 WM has capacity limits whereby only a small amount of information can be maintained.37,38,39,40 Alpha power tracks both perceptual and WM load (e.g.,41), though there is some variability as to whether maintenance-related alpha power increases42,43,44,45 or decreases46,47,48 as a function of load (for a review, see Pavlov et al.49). WM paradigms tap both external and internal attention, with external attention recruited during the encoding or display interval and internal attention recruited during the delay interval.50 Display-interval alpha power decreases51 along with delay-interval alpha power increases42 are consistent with the broader finding that alpha dissociates external vs. internal attention. To the extent that memory brain states selectively reflect long-term episodic remembering, there should be no memory state modulation within the context of a WM paradigm. Alternatively, to the extent that memory brain states track attentional orienting, the shifting demands within a WM task should induce memory brain state fluctuations. Our central hypothesis is that memory states map onto the external/internal axis of attention, whereby external attention recruits the encoding state and internal attention recruits the retrieval state. We have two specific hypotheses. First, we hypothesize that the encoding state will be recruited during initial stimulus presentation regardless of memory demands. Alternatively, the encoding state will be selectively recruited during stimulus presentation in response to top-down demands to encode the stimulus display. Second, we hypothesize that WM maintenance will specifically recruit the retrieval state. Alternatively, the retrieval state will be selectively recruited in response to top-down demands to retrieve a past experience. To test our hypothesis, we conducted a scalp EEG study in which participants performed either a target detection task or a change detection task (Figure 1). We used cross-study multivariate pattern analyses (MVPA) to assess how encoding and retrieval states are engaged by fluctuating WM demands. To the extent that memory brain states reflect external and internal attention, these states should be differentially recruited across the phases of this task. Task design In both the target detection (perception) task and the change detection (memory) task, participants saw one, two, four, or six squares on the screen for 500 ms. Each display phase was followed by a 2,000 ms delay phase. During the response phase, participants saw the same squares either in new locations with a white or black outline around one square (target detection) or the same squares in the same locations (change detection). On half of the change detection trials, one of the squares changed to a complementary color as shown above. Participants’ task was to respond as to whether there was a white/black outline in the target detection task or to respond as to whether one of the squares had changed color in the change detection task. Participants had 1,000 ms to make their response. Results Set size modulates target and change detection behavior Our first goal was to assess the impact of set size on target detection reaction time (RT) in the perception task and change detection accuracy in the memory task (Table 1). We expected to find slower RTs in the perception task and lower accuracy in the memory task as set size increases. Following our pre-registration, we conducted two regressions to predict behavior as a function of set size. For the perception task, we conducted a linear regression with set size as the predictor and RT on accurate perceptual trials as the dependent variable (Figure 2A). We found a significant effect of set size on RT (β = 2.914, SD = 3.631, t38 = 4.948, p < 0.0001, d = 0.8026). For the memory task, we conducted a logistic regression with set size as the predictor and accuracy on memory trials as the dependent variable (Figure 2D). We found a significant effect of set size on memory accuracy (β = −0.4088, SD = 0.1938, t38 = −13.00, p < 0.0001, d = 2.109). Table 1Behavioral performance as a function of task and set sizeSet SizePerceptionMemoryReaction timeAccuracyReaction timeAccuracyMSDMSDMSDMSD1569.9265.910.98590.0178633.6570.430.94090.03552581.3363.940.98080.0217662.1775.440.94350.04444577.4861.960.98190.0188711.5174.830.87540.07726588.6965.560.98120.0212718.0072.580.73470.0963 Behavioral performance as a function of task and set size Set size modulates target and change detection behavior (A) Target detection reaction times as a function of set size (1, 2, 4, and 6). There is a significant increase in reaction time as a function of set size (p < 0.0001). (B) Change detection reaction times as a function of set size (1, 2, 4, and 6). There is a significant increase in change detection reaction time as a function of set size (p < 0.0001). (C) Target detection accuracy as a function of set size (1, 2, 4, and 6). There is no significant set size effect on reaction time (p = 0.7117). (D) Change detection accuracy as a function of set size (1, 2, 4, and 6). There is a significant decrease in change detection accuracy as a function of set size (p < 0.0001). Error bars denote standard error of the mean. We conducted additional exploratory analyses on target detection accuracy and change detection RTs. For the memory task, we conducted a linear regression with set size as the predictor and RT on accurate memory trials as the dependent variable (Figure 2B). We found a significant effect of set size on RT (β = 18.16, SD = 8.779, t38 = 12.75, p < 0.0001, d = 2.069). For the perception task, we conducted a logistic regression with set size as the predictor and accuracy as the dependent variable (Figure 2C). We did not find a significant effect of set size on accuracy (β = −0.2620, SD = 4.338, t38 = −0.3723, p = 0.7117, d = 0.0604). These results show that as set size increases, target detection and change detection RTs increase and change detection accuracy decreases. Validation of the memory state classifier To measure memory state engagement, we trained a multivariate pattern classifier to distinguish encoding and retrieval states based on an independently collected dataset from participants who completed the memory state task (Figure 3).15,17,23 We have previously reported this procedure and a subset of these data.52 In the memory state task, participants study two lists of object images in which the list 2 objects categorically overlap with the list 1 objects—for instance, participants may encounter a bench in list 1 and then encounter a new bench in list 2. During list 2, participants are instructed to either encode the currently presented list 2 object or retrieve the categorically related list 1 object. Through the instruction manipulation, participants are biased toward either an encoding or a retrieval state while perceptual input and motor output are held constant. After sub-selecting the participants for whom within-participant classification accuracy exceeded chance (Figure 3B), we validated that cross-participant decoding was significantly above chance (Figure 3C), which indicates that a common set of features (spectral activity across electrodes) consistently distinguish memory brain states across participants. Finally, we tested this cross-participant-cross-study classifier on data in the current paradigm (Figure 3D). Cross-study classification approach (A) An independent group of participants (N = 143) completed the memory state task. In this task, participants are explicitly instructed to retrieve a previously presented object (list 2 “OLD” trials) or to encode a currently presented object (list 2 “NEW” trials). (B) We conducted leave-one-run-out within-participant classification in which we trained and tested an L2 logistic regression classifier (penalty parameter = 1) to distinguish encode and retrieve trials based on a feature space of 63 electrodes × 46 spectral frequencies. Any participant whose true classification accuracy exceeded the 90th percentile of their respective null classification accuracy distribution was selected for the next stage (N = 57). (C) To validate this classifier for cross-participant use, we conducted leave-one-participant-out classification and found significantly above-chance memory-state decoding (M = 60%) across participants. ∗∗∗p < 0.0001. (D) We applied the memory state classifier (N = 57) to spectral activity patterns to the current working memory task. Memory brain states are modulated by working memory demands To generally assess the impact of dynamic WM demands—including the presumed external/internal attention demands—on memory brain states, we first measured memory state evidence over time across the entire trial separately for the perception and memory tasks (Figure 4). Following our pre-registration, we conducted a 2 × 35 repeated measures ANOVA (rmANOVA) with factors of task and time interval (100 ms intervals from 0 to 3,500 ms following display onset). Stimulus-locked memory state evidence served as the dependent variable. We found a significant main effect of time (F34,1292 = 35.96, p < 0.0001, ηp2 = 0.4862) and task (F1,38 = 29.99, p < 0.0001, ηp2 = 0.4411). We found a significant interaction between task and time (F34,1292 = 18.10, p < 0.0001, ηp2 = 0.3226). Thus, memory state engagement varies as a function of task and over time. Memory brain states are modulated by working memory demands We assessed memory state evidence as a function of task (perception, orange; memory, teal) across display (0–500 ms), delay (500–2,500 ms), and response (2,500–3,500 ms) phases. Positive values indicate greater evidence for retrieval; negative values indicate greater evidence for encoding. Shaded areas denote standard error of the mean. We conducted exploratory post-hoc one-sample t tests to specifically evaluate the temporal dynamics of memory state engagement during the delay interval separately for each task (Table 2). During the memory task, we find that memory state evidence is significantly greater than zero for the majority of delay interval time points (0–1,200 ms) and is significantly less than zero for the final two time points (1,800–2,000 ms). During the perception task, we find that memory state evidence is significantly greater than zero for the first 600 ms of the delay interval and is significantly less than zero for the majority of the delay interval time points (800–2,000 ms). Thus, delay-interval memory state engagement dynamically fluctuates based on task and time, with sustained retrieval state engagement during the memory task and late interval encoding state engagement during both tasks. Table 2Delay interval memory state evidence vs. zero via one-sample t testsTime intervalPerception trialsMemory trialst38pdt38pd0–100 ms5.533<0.00010.89768.465<0.00011.373100–200 ms5.632<0.00010.91379.617<0.00011.56200–300 ms5.753<0.00010.933311.17<0.00011.812300–400 ms6.105<0.00010.990312.13<0.00011.968400–500 ms4.889<0.00010.793110.93<0.00011.773500–600 ms2.9410.00550.47718.956<0.00011.453600–700 ms1.240.22260.20127.097<0.00011.151700–800 ms−1.1970.23880.19415.239<0.00010.8498800–900 ms−3.3180.00200.53835.030<0.00010.816900–1,000 ms−3.9420.00030.63944.951<0.00010.80311,000–1,100 ms−4.3800.00010.71054.4110.00010.71551,100–1,200 ms−5.867<0.00010.95174.1730.00020.6771,200–1,300 ms−5.871<0.00010.95242.0980.04260.34031,300–1,400 ms−6.136<0.00010.99530.46020.64800.07461,400–1,500 ms−5.374<0.00010.8717−0.54630.58810.08861,500–1,600 ms−5.738<0.00010.9308−1.2870.2060.20871,600–1,700 ms−5.385<0.00010.8735−1.8210.07640.29551,700–1,800 ms−4.4290.00010.7185−1.9910.05370.32291,800–1,900 ms−3.0130.00460.4887−2.3110.02630.37491,900–2,000 ms−2.9390.00560.4767−3.3290.00190.5399Bold values indicate p < 0.05, FDR-corrected. Delay interval memory state evidence vs. zero via one-sample t tests Bold values indicate p < 0.05, FDR-corrected. To perform a targeted investigation of how external and internal attention demands modulate memory brain state engagement, we extracted memory state evidence across the three phases (display: 0–500 ms, delay: 500–2,500 ms, response: 2,500–3,500 ms) and performed three specific sets of analyses. Due to the structure of our memory state classifier, positive values indicate more evidence for the memory retrieval state, and negative values indicate more evidence for the memory encoding state. We first sought to link the encoding state with external attention during the display phase. Specifically, we hypothesized that the encoding state would be recruited during initial stimulus presentation regardless of memory demands, as external attention demands should be equivalent across both perception and memory tasks. Alternatively, to the extent that the encoding state tracks memory formation either exclusively or in addition to external attention, display-interval encoding evidence should be greater for memory compared to perception trials. Following our pre-registration, we conducted a paired t test comparing stimulus-locked memory state evidence across perception-display and memory-display trials (Figure 5A). We found significantly greater memory state evidence for memory-display (M = −0.0249, SD = 0.114) compared to perception-display trials (M = −0.0542, SD = 0.0916; t38 = 2.224, p = 0.0321, d = 0.2838). We separately compared memory state engagement within each task against zero via one-sample t tests and found a significant decrease for perception-display trials (t38 = −3.647, p = 0.0008, d = 0.5916) and not for memory-display trials (t38 = −1.344, p = 0.187, d = 0.218). Thus, we find significant engagement of the encoding state exclusively for the perception task. This result provides evidence against the alternative hypothesis that the encoding state tracks memory formation. Memory brain states are modulated by working memory load We assessed stimulus-locked memory state evidence as a function of task and set size. (A) Memory state evidence as a function of task during the display phase. There is a significant difference between memory state engagement during perception trials and memory trials (p = 0.0321). (B) Memory state evidence as a function of task during the delay phase. There is a significant difference between memory state engagement during perception trials and memory trials (p < 0.0001). (C) Memory state evidence as a function of task and set size during the display phase. There is a significant decrease in memory state engagement during perception and memory trials as a function of set size (p < 0.0001). (D) Memory state evidence as a function of task and set size during the delay phase. There is a significant increase in memory state engagement during memory trials as a function of set size but no significant increase for perception trials (p < 0.0001). Error bars denote standard error of the mean. ∗p < 0.05; ∗∗p < 0.01; ∗∗∗p < 0.001. To further test the alternative hypothesis that the encoding state tracks memory formation, we assessed the extent to which memory state evidence during the display interval predicts subsequent task performance. Insofar as the encoding state tracks successful memory formation, greater display-phase encoding state evidence should selectively predict subsequent change detection accuracy. Display-phase encoding state evidence should not predict subsequent target detection performance given that attending to the squares will not facilitate target detection as the squares change location during the response phase. Following our pre-registration, we performed two regressions to relate memory state evidence to behavior. First, we conducted a linear regression with target detection RT as the dependent variable. We found no association between display-phase memory state evidence and RT (β = 3.824, SD = 17.30, t38 = 1.363, p = 0.1809, d = 0.2211). Second, we conducted a logistic regression with change detection accuracy as the dependent variable. We did not find a significant effect of display-phase memory state evidence on accuracy (β = 0.0389, SD = 0.4082, t38 = 0.588, p = 0.56, d = 0.0954, BF = 0.2029). Having anticipated that memory state evidence would predict performance on the memory task, but not the perception task, we pre-registered a direct paired t test to compare regression outputs between the perception and memory tasks. However, in view of our finding that neither task individually predicted behavior, we are unlikely to observe a difference between the two tasks, and we indeed did not find a significant difference between perception and memory (β = 0.0389, SD = 0.4082, t38 = 1.344, p = 0.1868, d = 0.3094). Together, these results show that memory state evidence does not predict subsequent performance in either task. Our a priori expectation was that memory and perception trials would differ primarily during the delay phase. The logic is that the change detection (memory) task requires maintaining information over the delay, whereas the target detection (perception) task does not. Thus, to the extent that the retrieval state reflects internal attention, we should find more memory state evidence (equivalent to retrieval state evidence) for the delay phase of the memory compared to the perception task. This contrast provides the most robust assessment of maintenance-related internal attention, as in both tasks no visual or external stimuli are present (excluding the fixation cross); thus, the only difference is whether participants are (memory task) or are not (perception task) maintaining information during the delay. Following our pre-registration, we conducted a paired t test comparing stimulus-locked memory state evidence across perception-delay and memory-delay trials (Figure 5B). We find that memory state evidence is significantly greater for memory-delay (M = 0.1153, SD = 0.099) compared to perception-delay trials (M = −0.0408, SD = 0.0761; t38 = 7.305, p < 0.0001, d = 1.768). We separately compared memory state engagement within each task against zero via one-sample t tests. For perception-delay trials, we find a significant decrease in memory state evidence (t38 = −3.301, p = 0.0021, d = 0.5355), indicating that participants engage the encoding state during the delay interval of the target detection task. For memory-delay trials, we find a significant increase in memory state evidence (t38 = 7.183, p < 0.0001, d = 1.165). These results show that the retrieval state is selectively engaged during the delay interval of the change detection task but not the target detection task. Having shown that working memory demands recruit the retrieval state during the delay interval, we next sought to link delay-phase memory state evidence to subsequent change detection performance. To the extent that the retrieval state tracks successful accessing of an internal representation, there should be a positive association between retrieval state evidence and subsequent memory performance. Alternatively, to the extent that retrieval state evidence tracks general internal attention and not memory success per se, there may be either no association or even a negative association between memory performance and retrieval state evidence. That is, greater retrieval state evidence may indicate a greater attempt to focus attention internally, reflecting difficulty rather than success. Following our pre-registration, we conducted a logistic regression with trial-level memory state evidence as the predictor and change detection accuracy as the outcome variable. Because we found an effect of set size on both behavior (above) and memory state evidence (below), we conducted four separate regression analyses, one for each set size, and averaged the resulting beta values together. The average beta value (β = 0.1694, SD = 0.8826) did not differ significantly from zero (t38 = 1.183, p = 0.2442, d = 0.1919, BF = 0.3296). These results show that greater retrieval state engagement does not predict successful subsequent performance in the change detection task. Given that we failed to find a significant trial-level association between delay-interval retrieval state evidence and memory performance, we conducted two exploratory participant-level analyses. We correlated delay-interval memory state evidence with both change detection performance and working memory capacity scores at the participant level (Figure 6). First, across all set sizes and for each participant, we calculated change detection accuracy and average delay-interval (2,000 ms) memory state evidence. We conducted a Pearson correlation and find a marginally significant positive correlation (r38 = 0.2972, p = 0.0661; Figure 6A), whereby greater delay interval memory state evidence is associated with better performance on the change detection task. Second, we calculated working memory capacity scores following the method described by Kyllingsbæk and Bundesen.53 Briefly, we calculated the difference between hit and false alarm rates and scaled this difference by the set size. We extracted capacity score K for the set size of 4, as this produced the highest average capacity (M = 2.983, SD = 0.6264) and correlated most strongly with raw accuracy scores (r38 = 0.8856, p < 0.0001). We conducted a Pearson correlation between average delay interval (2,000 ms) memory state evidence and participant capacity scores (Figure 6B). We find a significant positive correlation (r38 = 0.3829, p = 0.0161), whereby greater delay interval memory state evidence is associated with higher working memory capacity scores. Together, these results show that greater delay-interval retrieval state engagement is associated with better change detection performance and higher working memory capacity scores. Participant-level memory state-behavior correlations We calculated the average delay interval memory state evidence (2,000 ms) across set size for each participant and correlated these neural data with two behavioral measures via Pearson correlation. Each dot represents a participant. Linear regression line with 95% confidence interval is shown. (A) We calculated the average change detection accuracy for each participant across all set sizes. We find a marginally significant positive correlation between memory state evidence and change detection accuracy (r = 0.2972, p = 0.0661). (B) We calculated working memory capacity scores for each participant. We find a significant positive correlation between memory state evidence and capacity scores (r = 0.3829, p = 0.0161). To gain insights into the extent to which the retrieval state is modulated by decision-making, we assessed response-locked memory state evidence during the response interval of each task. We extracted the response time for each trial and evaluated memory state evidence relative to this key press. There are two alternative outcomes. First, to the extent that the retrieval state is recruited for any decision, we should find a gradual increase in memory state evidence (indicating greater retrieval state engagement), leading up to the response on both memory and perception trials. Alternatively, to the extent that the retrieval state is specifically recruited for a decision based on internal—rather than external—information, we should find a gradual increase in memory state evidence, leading up to the response selectively for memory trials. Following our pre-registration, we conducted a 2 × 10 rmANOVA with factors of task and time interval (100 ms intervals from 500 ms pre-response to 500 ms post-response; Figure 7A). Response-locked memory state evidence during the response phase served as the dependent variable. We found a significant main effect of time (F9,342 = 64.05, p < 0.0001, ηp2 = 0.6276) and task (F1,38 = 55.32, p < 0.0001, ηp2 = 0.5928), as well as a significant interaction between task and time (F9,342 = 5.359, p < 0.0001, ηp2 = 0.1236). Response-locked memory state evidence (A) Response-locked memory state evidence during the response phase. The bold dashed vertical line at time 0 to 100 ms indicates the onset of the response. (B) Response-locked memory state evidence as a function of memory response (hits or CRs) during the pre-response time interval (−500 to 0 ms). There is no significant difference between memory state engagement during hits and CR responses. Error bars denote standard error of the mean. We anticipated a pre-response dissociation between memory and perception responses; thus, following our pre-registration, we conducted a post-hoc paired t test to specifically compare memory state evidence between tasks during the pre-response (−500 to 0 ms) time interval. We found significantly greater memory state evidence for memory (M = 0.0505, SD = 0.0805) compared to perception responses (M = −0.0110, SD = 0.0660, t38 = 6.139, p < 0.0001, d = 0.8353). These results show that the retrieval state is specifically recruited for a decision based on internal—rather than external—information. To further examine memory state engagement during the memory task and specifically during successful retrieval, we next assessed memory state evidence as a function of memory response (hit or correct rejection, CR) during the pre-response interval. To the extent that the retrieval state is engaged in the service of the attempt to retrieve a stored representation, we should find greater memory state evidence for CRs compared to hits, consistent with our prior work.19,52 Following our pre-registration, we averaged memory state evidence during the pre-response (−500 to 0 ms) time interval and used a paired t test to compare memory state evidence across hit and CR trials in the memory task (Figure 7B). We did not find a significant difference between hit (M = 0.0507, SD = 0.0867) and CR trials (M = 0.0533, SD = 0.083; t38 = −0.3744, p = 0.7102, d = 0.0313, BF = 0.1853). These findings suggest that correctly detecting that a square in the display has or has not changed colors recruits the retrieval state to a similar degree. Memory brain states are modulated by working memory load We have shown that the demand to maintain information over a delay recruits the retrieval state. However, these findings do not address whether memory brain states track the direction of attention—external vs. internal—or the degree of internal attention. Put another way, the retrieval state may indicate whether attention is oriented internally rather than externally or the retrieval state may directly scale with the amount of internal attention that is deployed. By assessing memory state evidence as a function of set size, we can directly test these two possibilities. We first tested the association between set size and display-phase memory state evidence. To the extent that increasing the amount of visual input recruits more external attention, we anticipated a positive association between set size and encoding state evidence. Following our pre-registration, we conducted linear regressions with factors of set size (1, 2, 4, and 6) separately for perception and memory trials (Figure 5C). Stimulus-locked display-phase memory state evidence served as the dependent variable. We averaged the resulting beta values across both tasks and expected to find a significant negative beta, whereby memory state evidence decreases (reflecting greater encoding state engagement) as set size increases. We found a significant negative beta (β = −0.0222, SD = 0.0145, t38 = −9.399, p < 0.0001, d = 1.525). Given our hypothesis that the encoding state tracks external attention as opposed to successful memory formation, we expected that the association between display-phase memory state evidence and set size would not differ between perception and memory trials. We conducted a paired t test and did not find a significant difference in beta values for perception vs. memory task trials (t38 = 1.571, p = 0.1244, d = 0.3191). Thus, as more visual information is presented, encoding state evidence increases, suggesting that this state reflects external attention to environmental stimuli. As we demonstrated above, working memory demands during the delay phase strongly recruit the retrieval state. The critical question is whether recruitment of the retrieval state is further modulated by working memory load or the amount of information that participants must maintain. To the extent that the retrieval state tracks the degree of internal attention, we expect to find greater memory state evidence as working memory load increases. Following our pre-registration, we conducted a linear regression with factors of set size (1, 2, 4, and 6) selectively for the memory trials (Figure 5D). Stimulus-locked delay-phase memory state evidence served as the dependent variable. We expected to find a significant positive beta, whereby memory state evidence increases (reflecting greater retrieval state engagement) as set size increases. We found a significant positive beta (β = 0.0316, SD = 0.0277, t38 = 7.021, p < 0.0001, d = 1.139). As a control, we performed a linear regression on the perception task trials as participants should not maintain the stimuli during the perception delay interval. As expected, we did not find a significant beta (β = −0.0057, SD = 0.0180, t38 = −1.937, p = 0.0602, d = 0.3143, BF = 0.9320). To demonstrate that the positive association between set size and memory state evidence is specific to the memory task, we directly compared the regression outputs across perception-delay and memory-delay trials. We found a significantly greater beta for the memory task trials compared to perception task trials (perception: β = −0.0057, SD = 0.0180; t38 = 6.662, p < 0.0001, d = 1.593). These results show that memory state evidence increases (reflecting greater retrieval state engagement) as set size increases selectively for the memory task. Discussion The aim of this study was to directly connect memory brain states with the external/internal axis of attention. Using cross-study decoding of scalp EEG data, we measured memory state engagement during a WM paradigm in which participants performed either target or change detection. We find that the encoding state is recruited during the display interval of both target and change detection tasks, whereas the retrieval state is selectively engaged during the delay interval of the change detection task—and modulated by set size—but not the target detection task. Together, these results suggest that memory states map onto the external/internal axis of attention to support both working and long-term memory. We find that memory brain states are modulated by the different phases—display, delay, and response—of a WM paradigm. According to prior work, the retrieval state specifically enables intentional retrieval from long-term episodic memory,3,54 in which case it should not be modulated in the current paradigm, as there were no demands to access long-term memories associated with a particular spatiotemporal context. However, we find engagement of both memory encoding and memory retrieval states across the display, delay, and response intervals and across tasks. These results indicate that memory brain states track processes related to working memory, including external and internal attention. During the display phase of both the target and change detection tasks, we find encoding state engagement. To the extent that the encoding state tracks memory formation, it should be strongly and selectively engaged during the display phase of the change detection task, as encoding the display is needed to later report on color changes. However, we find similar levels of encoding state engagement across both tasks and that encoding state evidence increases as a function of set size. Attention is recruited when stimuli compete,55 and more stimuli will lead to more competition.56 Thus, encoding state engagement may reflect an attentional response to increasing perceptual demands as the number of stimuli increases. We failed to find significant engagement of the encoding state during the display phase in the change detection task, and encoding evidence did not predict subsequent memory performance. Although we cannot draw strong conclusions from null results, these findings support the interpretation that the encoding state tracks external attention to stimuli in the environment, which may or may not be linked to subsequent memory. We anticipate that the encoding state would be recruited in support of visual search57,58 and may play a role in change blindness and the attentional blink.59,60 We find robust retrieval state engagement selectively during the change detection task delay interval. This finding provides strong support for the hypothesis that the retrieval state reflects internal attention. WM maintenance can be considered a form of internal attention (50,61,62, cf.63), whereby attention is directed internally to no longer perceptually present information. Internal attention relies on neural substrates common to memory retrieval, including the DMN26,64,65 and spectral signals in the theta and alpha bands.27,66 Our interpretation is that a single, internal attention brain state—here labeled the retrieval state—tracks all of these processes, from long-term episodic memory retrieval, to WM maintenance, to other forms of internal mentation such as mind wandering.15,26 Interestingly, some retrieval-state engagement was observed during the target detection task delay interval, at least within the first several hundred milliseconds. It may be that some degree of internal attention is invoked when external input is removed, regardless of intentional maintenance demands. Such a finding is reminiscent of prior work showing increased DMN activity during “idling” or mind-wandering in the absence of visual input67 and increases in alpha power for eyes-closed compared to eyes-opened conditions.68 Near the end of the delay interval, we find encoding state engagement across both tasks. Our interpretation is that this response reflects preparatory attentional engagement, whereby participants focus externally in anticipation of an upcoming stimulus.69,70,71 Such a finding is consistent with prior work showing that the encoding state is engaged when stimulus onset is predictable (as in the current study),18 compared to when stimulus onset is variable.17 These delay-interval transitions between brain states may be indicative of input-driven switches between external and internal states72,73 and are an important avenue for future work. The retrieval state is selectively modulated by WM load. As the amount of information to be maintained increases, retrieval state engagement increases, but only during the change detection task. Thus, it is not merely that internal attention is recruited in the absence of visual input but also scales with the amount of maintained information. Previous work has shown that contralateral delay activity (CDA), a negative voltage deflection over the hemisphere contralateral to the visual hemifield in which information is maintained, increases up to WM capacity limits.74,75 Thus, the CDA is thought to track specific objects maintained in WM.76 As we observe maximal retrieval state engagement with the largest set size (6), which is beyond the average capacity limit,37,38 it is possible that the retrieval state tracks internal attention engaged in service of the attempt to maintain information and may not directly relate to the items themselves. Such an interpretation is consistent with our failure to find trial-level associations between delay-interval memory state evidence and change detection performance. However, we did find positive associations at the participant level. Specifically, we find that delay-interval retrieval state engagement is positively associated with both change detection accuracy and working memory capacity scores. These findings suggest that there is a link between the ability to invoke a putative internal attention state and maintain items in working memory, though future work is needed to clarify this relationship. To the extent that the retrieval state and WM maintenance invoke the same underlying alpha power mechanism,29,42,50 the retrieval state could reflect a map of “prioritized space.”77 This interpretation is consistent with our prior work in which evidence for the retrieval state is positively associated with maintained information in a variant of the Posner spatial cueing task.15,78,79 Thus, the retrieval state likely reflects a domain-general internal attention signal. Finally, we show that the retrieval state is recruited while participants detect changes and targets, with greater recruitment for change detection. As with prior long-term episodic memory retrieval work,19 we speculate that retrieval state engagement during the response phase reflects internal attention directed to stored representations, in this case, the immediately preceding display interval stimulus array. We have previously observed greater retrieval state evidence for correct rejections compared to hits,19,52 which we interpreted as reflecting an internal search and/or evidence accumulation process (e.g.,80) used to reject not-studied lure stimuli. Such a search process may not be needed for decisions based on WM contents. That we failed to find a dissociation between correct rejections and hits in the current study is instead consistent with the view that participants perform an internal comparison process81 between the test probe and the contents of their WM to detect both changed and unchanged displays. Taken together, our findings provide strong evidence that memory encoding and memory retrieval states map onto the external/internal axis of attention. The degree to which memory states reflect the orientation of attention has important consequences for our understanding of memory and attention as well as cognition more broadly. Although our results demonstrate an overlap between memory brain states and attention, a direct investigation of the shared and unique components is necessary in order to constrain our conceptualization of the two domains of “attention” and “memory.”10 Our results suggest that attentional processes may contribute substantially to memory success and are consistent with recent work showing that a composite of attention information predicts subsequent memory.82 The current line of work on memory brain states stems from theories and data showing that memory states are governed by hippocampal circuitry.83,84 Thus, a critical open question is how the brain states currently indexed relate to hippocampal signals. To the extent that the hippocampus sits atop the sensory/perceptual hierarchy,73,85,86 hippocampal signals may impact the currently observed cortical brain states. Alternatively, there may be memory-specific signals, distinct from the current states, driven by the hippocampus. For instance, lingering hippocampally-mediated memory states87 may be induced by judgments made about old and new stimuli, whereas cortical states may be invoked to re-orient attention when a task-irrelevant hippocampal state is engaged.52 More broadly, brain states govern downstream processing12 and impact behavior.11,13 The extent to which current cortical states track attention vs. memory processes will result in different influences on behavior. Whereas retrieval trades off with encoding,2,83 meaning that retrieval will prevent encoding the current moment and impair subsequent memory,2 internal focus may facilitate memory by enabling elaborative, constructive internal processes such as imagery.88,89 By identifying a core set of attentional states, our work will enable online, real-time detection of brain state engagement, identification of which states are optimal based on task goals and desired behaviors, and the development of tools to correct maladaptive or suboptimal state engagement. In conclusion, we demonstrate that memory encoding and memory retrieval states map onto the external/internal axis of attention, respectively. We find that the retrieval state is selectively engaged when there is a demand to maintain and is further modulated by memory load. Our results show that memory brain states are recruited in response to attentional demands in support of both working and long-term memory. Together, these results advance our understanding of how attention and memory processes overlap, informing our conceptual framing and empirical measurement of how these processes impact cognition. Limitations of the study It is important to note that there are several limitations to the present study. First, our sample was predominantly (85%) female participants, which limits the generalizability of our findings. Although we do not expect any gender-based differences, future studies should consider a more representative sample. Second, we do not know the extent to which our findings generalize beyond visual working memory and the specific stimuli—e.g., colored squares—that this paradigm used. Although working memory has been characterized as domain-general,90 capacity limits and the neural mechanisms that underlie working memory performance may vary with how meaningful and complex the stimuli are,91,92,93 as well as with stimulus modality.94 Future work will be needed to test the extent to which other visual stimulus types and sensory modalities (e.g., verbal or auditory) recruit memory brain states. Resource availability Lead contact Requests for further information and resources should be directed to and will be fulfilled by the lead contact, Nicole Long (nml3kd@virginia.edu). Materials availability This study did not generate new materials. Data and code availability •The data generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). The data generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). •The code generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). The code generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). •All other associated study materials are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/) All other associated study materials are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/) Acknowledgments This work was supported by a grant from the National Institutes of Health (NINDS R01 NS132872, PI: N.M.L.). We thank Eddie Ashie, Matthew Bair, Hannah Buras, Leah Cassidy, Lola Fuentes Brock, Rithik Kalikota, Amanda Smith, Salonee Verma, and Theo Wilson for assistance with data collection. Author contributions D.T.N., data curation, formal analysis, software, visualization, writing – original draft, and writing – review and editing. N.M.L., conceptualization, formal analysis, funding acquisition, project administration, software, supervision, visualization, writing – original draft, and writing – review and editing. Declaration of interests The authors declare no competing interests. STAR★Methods Key resources table REAGENT or RESOURCESOURCEIDENTIFIERDeposited dataRaw and analyzed dataThis paperhttps://doi.org/10.17605/OSF.IO/M6KNVSoftware and algorithmsPsychopyOpen Science Tools, https://psychopy.org/RRID:SCR_006571R studioR Foundation, https://www.r-project.org/RRID:SCR_000432Experiment codeThis paperhttps://doi.org/10.17605/OSF.IO/M6KNVAnalysis codeThis paperhttps://doi.org/10.17605/OSF.IO/M6KNV Experimental model and study participant details Participants Forty participants (33 female; age range = 18–35 years, mean age = 19.88 years) from the University of Virginia community participated. Our sample size was determined a priori based on our prior work and is described in the pre-registration report of this study (https://osf.io/rcwk3). All participants had normal or corrected-to-normal vision. Informed consent was obtained in accordance with the University of Virginia Institutional Review Board for Social and Behavioral Research (protocol SBS-2115), and participants were compensated for their time. One participant was excluded from the final dataset due to poor task performance (only responded to 3% of trials). Thus, data are reported for the remaining 39 participants. Method details Procedure and design General overview Behavioral data collection was performed via Psychopy (v2023.2.3). Experiment codes are available via OSF (osf.io/m6knv). Stimuli were colored squares presented on a gray background with eight possible colors (Figure 1). Participants viewed 1, 2, 4, or 6 squares per trial. Square locations were random across the screen, constrained to one of twenty-four locations on a 4 by 6 grid (not shown to participants) with a small jitter. To manipulate memory demands, trials were divided into perception blocks and memory blocks. Each of the twelve runs contained two blocks, memory and perception, and block order was random within run. Each block contained 24 trials, two response options, and participants were instructed to respond as quickly and accurately as possible. Each block began with a get ready screen indicating the current block and response mappings (3000 ms) followed by a 1000 ms inter-stimulus interval (ISI). Each trial began with a 500 ms display phase in which 1, 2, 4, or 6 squares were presented. The display phase was immediately followed by the delay phase in which a fixation cross was presented for 2000 ms. The delay phase was followed by the response phase. Participants pressed one of two response keys which was counterbalanced across participants. Responses were required within 1000 ms of response phase onset. The response phase was followed by a 1500 ms ISI. Perception task In the perception blocks, participants performed a target detection task. All squares from the display phase were re-presented in new locations with either a black or white outline around one of the squares. The locations changed to minimize (and potentially eliminate) participants’ tendency to maintain information about the squares across the delay. All square colors were identical to the display phase. Participants were instructed to respond with either the d or k key indicating the outline color. Memory task In the memory blocks, participants performed a change detection task. All, or all but one, squares from the display phase were re-presented in the same locations. On half of the memory trials, one square changed color between the display and response phase. The color changed to the complementary color of a square presented during the display phase and was not utilized for any of the other squares in either the display or response phase (e.g., a red square would change to cyan and no other squares in the display would be cyan). Participants were instructed to respond with either the d or k key indicating whether any of the squares did or did not change color from the display phase. Memory state task An independent group of participants completed a memory state task (Figure 2). Participants were biased via explicit instructions on a trial-by-trial basis to engage an encoding or retrieval state while perceptual input and behavioral demands were held constant. In this memory state task (for specific study parameters, please see23,95), participants viewed two lists of object images. For the first list, each object was new. For the second list, each object was again new but was categorically related to an object from the first list. For example, if List 1 contained an image of a bench, List 2 would contain an image of a different bench. During List 1, participants were instructed to encode each new object. During List 2, however, each trial contained an instruction to either encode the current object (e.g., the new bench) or to retrieve the corresponding object from List 1 (the old bench). Critically, this design ensures that perceptual inputs, decision demands, and motor outputs are matched across encode and retrieve trials. Encode/retrieve instructions were randomly intermixed within List 2. Objects were randomly assigned to condition across participants. Each object was presented for 2000 ms. Participants completed either a two-alternative forced choice recognition test or a recency test on the object stimuli. We used the stimulus-locked List 2 data, data that is time-locked to when the stimulus appears on the screen, to train a multivariate pattern classifier (see below) to distinguish encoding and retrieval states. EEG data acquisition EEG recordings were collected using a BrainVision system and an ActiCap equipped with 64 Ag/AgCl active electrodes positioned according to the extended 10–20 system. All electrodes were digitized at a sampling rate of 1000 Hz and referenced to electrode FCz. Offline, electrodes were later converted to an average reference. Impedances of all electrodes were kept below 50 kΩ. Quantification and statistical analysis EEG data preprocessing Custom Python codes were used to process the EEG data (codes available via OSF: osf.io/m6knv). Electrodes that demonstrated high impedance or poor contact with the scalp were excluded from the average reference but included in all other analysis steps. Bad electrodes (M = 2.154, SD = 1.113 per participant) were determined by voltage thresholding. We applied a high pass filter at 0.1 Hz, followed by a notch filter at 60 Hz and harmonics of 60 Hz to each participant’s raw EEG data. We then performed three preprocessing steps96 to identify electrodes with severe artifacts. First, we calculated the mean correlation between each electrode and all other electrodes as electrodes should be moderately correlated with other electrodes due to volume conduction. We z-scored these means across electrodes and rejected electrodes with z-scores less than −3. Second, we calculated the variance for each electrode as electrodes with very high or low variance across a session are likely dominated by noise or have poor contact with the scalp. We then z-scored variance across electrodes and rejected electrodes with a |z| >= 3. Finally, we expect many electrical signals to be autocorrelated, but signals generated by the brain versus noise are likely to have different forms of autocorrelation. Therefore, we calculated the Hurst exponent, a measure of long-range autocorrelation, for each electrode and rejected electrodes with a |z| >= 3. Outlier Hurst exponent values (very high or very low) suggest atypical autocorrelation and are more likely to reflect noise rather than biological signals. Electrodes marked as bad by this procedure were excluded from the average re-reference. We then calculated the average voltage across all remaining electrodes at each time sample and re-referenced the data by subtracting the average voltage from the filtered EEG data. Although bad electrodes were excluded from the average re-reference calculation, all electrodes were included for every participant for all subsequent analyses. We used wavelet-enhanced independent component analysis97 to remove artifacts from eye blinks and saccades. EEG data analysis We applied the Morlet wavelet transform (wave number 6) to the entire EEG time series across electrodes, for each of 46 logarithmically spaced frequencies (2–100 Hz98). After log-transforming the power, we downsampled the data by taking a moving average across 100 ms time intervals from 500 ms preceding to 4000 ms following trial onset, and sliding the window every 25 ms, resulting in 177 time intervals (45 non-overlapping). Power values were then z-transformed by subtracting the mean and dividing by the standard deviation power. Mean and standard deviation power were calculated across all trials and across time points for each frequency. Pattern classification analyses Pattern classification analyses were performed using penalized (L2) logistic regression, implemented via the sklearn linear model module in Python. “Memory state evidence” was a continuous value reflecting the logit-transformed probability that the classifier assigned a particular mnemonic label (encode, retrieve) to each trial. Memory state evidence served as a trial-specific, continuous measure of memory state information, which we used to assess how encoding and retrieval states were engaged by fluctuating working memory demands. We developed and validated a cross-participant memory state classifier based on already-collected data from participants (N = 143) who completed a memory state task.17,23 We have previously reported this procedure and a subset of these data.52 We conducted three stages of classification using the same methods as in our prior work.15,17,19,52 First, we conducted within participant leave-one-run out cross validated classification (penalty parameter = 1) on all participants who completed the memory state task (Figure 2A; N = 100), see.23 We trained the classifier to distinguish encode vs. retrieve states based on spectral power averaged across the 2000 ms stimulus interval during List 2 trials. Our prior work provides validation that such a classifier distinguishes memory states, given that applying such a classifier to the List 1 trials reveals robust encoding state engagement.2 We permuted condition labels (encode, retrieve) for 1000 iterations to generate a null distribution for each participant. Any participant whose true classification accuracy fell above the 90th percentile of their respective null distribution was selected for further analysis (N = 57; Figure 2B). Second, using leave-one-participant-out cross-validated classification (penalty = 0.0001), we obtained classification accuracy of 59.29% which is significantly above chance (t56 = 7.667, p < 0.0001; Figure 2C), indicating that the cross-participant memory state classifier can distinguish memory encoding and memory retrieval states. Finally, we applied the cross-participant memory state classifier to assess memory state evidence across all phases and tasks in the current study. We extracted classifier evidence, the logit-transformed probability that the classifier assigned the label encoding or retrieval to a test data pattern (Figure 2D). This approach provides a trial-level estimate of memory state evidence during the working memory task. Due to the structure of our classifier, positive values of memory state evidence reflect greater retrieval state engagement and negative values of memory state evidence reflect greater encoding state engagement. Statistical analyses Statistical details of the study are reported in the results. The ∗ values can be found in the figure legends. n = 39 participants. We used p-values to make inferences and two-tailed tests. p-values below 0.05 are considered significant. We used false discovery rate (FDR99) to correct for multiple comparisons. We used custom code and R (version 4.5.2) to conduct all statistical analyses (codes available via OSF: osf.io/m6knv). We used repeated measures ANOVAs (rmANOVAs) and linear and logistic regression along with paired t tests to assess the effect of set size on behavior in the perception and memory tasks. We used rmANOVAs to assess the impact of task (memory or perceptual) and time on memory state evidence. We used paired t tests to assess task differences in memory state evidence for the display and delay phases. We used one sample t tests to compare delay interval memory state evidence against zero for each task. We used linear and logistic regression to test the extent to which memory state evidence predicts subsequent memory. We used linear regression to relate memory state evidence to set size. We used Pearson correlations to relate participant-level memory state evidence to change detection performance and to working memory capacity scores. References Associated Data Data Availability Statement •The data generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). The data generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). •The code generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). The code generated in the current study are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/). •All other associated study materials are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/) All other associated study materials are publicly available on the Open Science Foundation (osf.io/m6knv) and via the Long Term Memory Lab website (http://longtermmemorylab.com/papers/)