Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Apple Machine Learning Research 1 min read Research hardMaster

On the Importance of Gating: Memorization vs. In-Context Learning in State Space Models

The gating mechanism in State Space Models makes them first learn an in-weights "memorization" solution, which delays or even prevents convergence to a correct in-context learning solution. This happens even when the architecture and its memory capacity impose no fundamental limit, and it helps explain why SSMs lag Transformers on in-context learning and precise retrieval. Gating also often improves generalization to longer sequence lengths. The results, supported by theory and experiments, point to gating as the key factor shaping SSM training dynamics and generalization, and offer a basis for improving linear-time models.

Assumes: state space modelsTransformersin-context learning

Related posts

  • Weighted State Souping for Efficient Long-Context Retrieval

    Apple Machine Learning Research hardMaster

    Weighted state souping learns query-dependent weights for combining independently encoded, cached SSM states for chunks like documents, tool definitions or memory records, fixing the degradation that plain state souping and vanilla SSMs show on long, crowded contexts. It substantially improves single- and multi-hop document QA, needle-in-a-haystack retrieval, variable tracking and tool use. A sparse variant keeps encoding cost near-constant in context length while preserving or sometimes improving accuracy, and simple theoretical arguments explain when souping works and when it fails.

  • GLM-5.2: Built for Long-Horizon Tasks

    Hugging Face hardMaster

    GLM-5.2 is Z.ai's MIT-licensed flagship model for long-horizon coding-agent work, with a 1M-token context and selectable thinking effort levels. It scores 81.0 on Terminal-Bench 2.1 and lands near Claude Opus 4.8 on FrontierSWE. Architecturally, IndexShare reuses one sparse-attention indexer across every four DSA layers, cutting per-token FLOPs 2.9× at 1M context. An improved MTP draft layer, using shared indices and KV, rejection sampling and an end-to-end TV loss, raises speculative-decoding acceptance length by 20%. Post-training switches from group-wise optimization to critic-based PPO, which handles compacted sub-traces, and uses slime for agentic RL plus a two-stage rule-and-LLM-judge guard that blocks reward-hacking tool calls online without aborting rollouts.

  • The sleep framework: A new way for LLMs to retain knowledge in continual learning

    Google Research hardMaster

    A sleep phase for continual learning alternates LLM operation between an active (wake) phase that stores information in fast short-term memory and an offline sleep phase that consolidates it into long-term parameters. Consolidation unlocks low-rank Mixture-of-Experts memory blocks, distills in-context memory into them via on-policy Generalized Knowledge Distillation plus RL-based imitation learning rewarded by semantic and Levenshtein similarity, then resets the short-term parameters. A 'dreaming' stage generates synthetic samples with randomly routed experts, filters them by gradient-based selection, and refines the model with SFT and RL. Reported results include near-zero forgetting on continual translation for unseen languages like Manchu and Kalamang, near-perfect BABILong scaling to 10M tokens, better factual incorporation than SFT and SEAL on SQuAD, and 79.2%/69.0%/46.1% on AIME 24/25 and HMMT 25.

  • Train your first Decision Transformer

    Hugging Face hardMaster

    Decision Transformers recast reinforcement learning as conditional sequence modeling: a GPT-2 model takes the last K timesteps of return-to-go, state and action tokens and autoregressively predicts actions that achieve a desired return. This walkthrough trains an offline Decision Transformer from scratch on the HalfCheetah expert dataset from the Hugging Face hub. A custom data collator normalizes states, computes returns-to-go, scales rewards by 1000, pads sequences and samples trajectories by length. A subclassed model adds an MSE action loss so the standard transformers Trainer can be used, and training takes about 40 minutes in Colab versus roughly 3 hours in the original paper.

  • GaLore: Advancing Large Model Training on Consumer-grade Hardware

    Hugging Face hardMaster

    GaLore cuts LLM training memory by projecting gradients into a low-rank subspace before the optimizer sees them, reporting over 82.5% reduction in optimizer-state memory and enabling 7B Llama-style models to train on a single RTX 4090. Periodic subspace switching preserves full-parameter learning, and combining the projection with 8-bit quantized optimizer states (via bitsandbytes) saves further memory. It is available in Hugging Face Transformers 4.39+ through optimizers like galore_adamw, galore_adamw_8bit and galore_adafactor with optim_target_modules, plus layer-wise variants that apply updates per layer via PyTorch post-accumulation hooks.

The quest for software engineering knowledge.

Look:
Layout: