CORTEX: Learning to Share and Specialize in Dense Language Models

Chuiyang Meng, Ming Tang, Vincent W. S. WongarXiv 2026

TL;DR

CORTEX is a new framework that learns to modularize dense language models during training without adding explicit "expert" blocks or routing layers. By analyzing gradient similarities across different data domains, it automatically partitions parameters into a "shared" module and domain-specific "specialized" modules, resulting in better performance, lower perplexity, and improved interpretability.

What Problem Does This Paper Address?

Modern Large Language Models (LLMs) are trained on massive, heterogeneous mixtures of data—everything from Python code and legal briefs to medical abstracts and mathematical proofs. This creates a fundamental tension:

  1. Sharing: Different domains often share underlying logic, syntax, and world knowledge. A fully shared dense model excels at this but suffers from "gradient interference," where updates for one domain conflict with another.
  2. Specialization: Unique domains require specialized patterns. Modular architectures like Mixture-of-Experts (MoE) address this by using separate "expert" blocks, but they often introduce significant inference overhead and can struggle to balance shared vs. specialized knowledge effectively.

The authors of CORTEX ask: Can we form modularity inside a standard dense LLM just by shaping its learning dynamics? Instead of imposing a rigid architecture, they want the model to discover its own internal functional modules during the training process.

Methods

CORTEX introduces a "learning dynamics-inspired" approach to modularization. Here is the breakdown of the workflow:

  • Parameter Grouping: Instead of treating every individual weight as a unit, CORTEX partitions weight matrices into functional groups. For Attention layers, a group is a single head; for Feed-Forward Networks (FFN), it’s a block of intermediate channels.
  • Soft Assignment: Each parameter group is given a trainable "assignment weight." This weight determines how much that group contributes to a Shared Module (common to all domains) versus one of several Specialized Modules (one per domain).
  • Domain-Conditioned Gradients: During training, CORTEX tracks gradients for each domain separately.
  • Utility Scores: This is the "secret sauce." CORTEX calculates utility scores based on gradient behavior:
  • Shared Utility: High if gradients from different domains are aligned (pointing in the same direction).
  • Specialized Utility: High if a specific domain induces a large gradient magnitude while remaining distinct from other domains.
  • Joint Optimization: The model simultaneously learns the backbone weights (to minimize task loss) and the assignment weights (to maximize utility).
A schematic illustration of CORTEX, showing how parameter groups are assigned to shared or specialized modules based on gradient similarity.

Datasets

The researchers evaluated CORTEX across two main settings:

  1. Synthetic Benchmark: Six symbolic tasks (COPY, REVERSE, ADD, LOOKUP, etc.) designed to test basic algorithmic reasoning.
  2. Real-Domain Mixture: A diverse set including C4 (general text), Magicoder (code), MathInstruct (math), PubMed (biomedical), Caselaw (legal), and WinoGrande (reasoning).

Backbone models included a 160M parameter decoder-only model, as well as the much larger Qwen3-8B and Qwen3-32B.

Key Insights and Ideas

  • Modularity without Routing: Unlike MoE, which uses a router to pick experts at runtime, CORTEX creates a static (but learned) internal structure. At inference time, it behaves exactly like a standard dense model, meaning zero inference overhead.
  • Neuroscience-Inspired Evaluation: To prove the modules actually specialized, the authors borrowed the concept of "lesion studies." By zeroing out a specialized module and measuring the performance drop, they confirmed that the "Math" module, for example, was indeed critical for math tasks but less so for legal ones.
  • Gradient Concentration: The "aha moment" is that modularity is essentially a way to manage gradient interference. By assigning "conflicting" parameters to specialized modules, CORTEX allows domains to update their own parameters without breaking what other domains have learned.
Heatmaps showing the learned modularization. You can see clear patterns of specialization across different Transformer blocks.

Key Results

  • Superior Performance: CORTEX consistently outperformed baselines like standard Dense training, MoE, and MoM (Mixture-of-Modules). On the synthetic benchmark, it achieved the highest exact match scores across all domains.
  • Perplexity Reduction: CORTEX achieved the largest average perplexity (PPL) reduction compared to dense baselines. For the 160M model, it saw a ~20.6% reduction in PPL.
  • Identifiable Specialization: As shown in the domain-normalized gradient share plots, specialized modules captured the vast majority of the gradient information for their target domains (often >60%), while the shared module successfully captured commonalities across all domains.
  • Efficiency: While CORTEX increases training step time by 18–24% (due to gradient tracking), it is faster and uses significantly less peak memory than MoE during training.
Gradient share visualization showing that specialized modules (diagonal) capture the bulk of domain-specific updates.

Limitations and Future Work

  • Domain Labels Required: CORTEX currently relies on having explicit domain labels during training. In "in-the-wild" pre-training where data is unlabelled, this would require an initial clustering or classification step.
  • Granularity Sensitivity: The effectiveness of the modularization depends on the chosen size of the parameter groups. Finding the optimal "grain size" automatically is an open challenge.
  • Training Overhead: Storing domain-conditioned gradients adds memory and computation costs during the training phase, even if inference remains fast.
  • Static at Inference: Because the modules are fixed after training, CORTEX doesn't offer the dynamic "per-token" routing benefits that MoE provides for extremely large-scale models.

Summary updated

BibTeX
@misc{meng2026cortex,
  author = {Chuiyang Meng and Ming Tang and Vincent W. S. Wong},
  title = {{CORTEX: Learning to Share and Specialize in Dense Language Models}},
  year = {2026},
  eprint = {2609.34449},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.34449},
}
Figure