CMR and memory search model variants

This section documents the memory search models available in jaxcmr. The library provides a unified framework for implementing and comparing different variants of the Context Maintenance and Retrieval (CMR) model.## Why Do We Model Memory?Free recall experiments reveal robust patterns:- Recency: Items from the end of a list are recalled first and most often- Primacy: Items from the beginning are also recalled well- Contiguity: Recalled items tend to come from nearby serial positions- Forward asymmetry: Transitions favor items that followed the just-recalled itemCMR explains these patterns through a simple mechanism: temporal context that drifts during study and is reinstated during retrieval.## Model ArchitectureA CMR model combines three core components:- Context: A temporal context representation that drifts over time- Memory: Associative stores (MFC and MCF) linking items and contexts- Termination Policy: Determines when recall stopsThese components implement protocols defined in jaxcmr.typing, allowing different implementations to be swapped while maintaining compatibility with the rest of the library.## Baseline Models### CMRThe base Context Maintenance and Retrieval model. Start here to understand the core mechanism that all variants build upon.### ContextThe TemporalContext component implements drifting context representations that form the heart of CMR’s temporal dynamics.### MemoryLinear (Hebbian) and Instance (MINERVA-2 style) memory implementations, with tradeoffs between event-blending and event-preserving storage.### ParametersComplete reference for all CMR parameters, their meanings, and typical value ranges.## Repetition VariantsModels addressing how repeated items are encoded and retrieved:| Model | Description ||——-|————-|| Positional CMR | Position-based encoding creates distinct traces for repetitions || Drift Positional | Different drift rate for repeated items || Reinforcement | Reinforces first-presentation trace at repetition || Outlist CMR | Out-of-list context mixing for distinct repetition traces || Blend Positional | Hybrid item/position context streams || Distinct Contexts | Positional encoding with item-level recallability || No Reinstate | No context reinstatement during encoding |## Semantic VariantsModels integrating pre-experimental semantic associations:| Model | Description ||——-|————-|| Additive Semantic | Semantic similarity as additive boost to activation || Multiplicative Semantic | Semantic as multiplicative gate (foraging-inspired) |## Usage Example

Code
from jaxcmr.models.cmr import CMR, make_factory
import jaxcmr.components.linear_memory as LinearMemory
import jaxcmr.components.context as TemporalContext
from jaxcmr.components.termination import PositionalTermination

# Create a model factory
Factory = make_factory(
    LinearMemory.init_mfc,
    LinearMemory.init_mcf,
    TemporalContext.init,
    PositionalTermination,
)

factory = Factory(dataset, features=None)

# Define parameters
params = {
    "encoding_drift_rate": 0.5,
    "start_drift_rate": 0.5,
    "recall_drift_rate": 0.5,
    "learning_rate": 0.5,
    "primacy_scale": 2.0,
    "primacy_decay": 0.8,
    "shared_support": 0.05,
    "item_support": 0.25,
    "choice_sensitivity": 1.0,
    "stop_probability_scale": 0.05,
    "stop_probability_growth": 0.2,
    "learn_after_context_update": True,
    "allow_repeated_recalls": False,
}

# Create model for a specific trial
model = factory.create_trial_model(trial_index=0, parameters=params)

# Study items (1-indexed)
for item in [1, 2, 3, 4, 5]:
    model = model.experience(item)

# Begin retrieval
model = model.start_retrieving()

# Get retrieval probabilities
probs = model.outcome_probabilities()

Choosing a Model### For Standard Free RecallStart with the base CMR model. It captures recency, primacy, contiguity, and forward asymmetry with a minimal parameter set.### For Lists with Repeated ItemsConsider Positional CMR or Blend Positional CMR. These handle the ambiguity of which presentation’s context to reinstate.### For Semantic RecallUse Additive Semantic CMR for typical semantic effects, or Multiplicative Semantic CMR for foraging-inspired gating behavior.## Implementation PhilosophyAll models in jaxcmr share a common interface defined in jaxcmr.typing.MemorySearch:- experience(item) — Process a study event- start_retrieving() — Transition to retrieval mode- retrieve(item) — Process a recall event- outcome_probabilities() — Get retrieval probability distributionThis allows models to be swapped in evaluation pipelines without changing the analysis code.