Nirvana: A Specialized Generalist Model With Task-Aware Memory Mechanism

Yuhua Jiang, Shuang Cheng, Yihao Liu, Ermo Hua, Che Jiang, Weigao Sun, Yu Cheng, Feifei Gao, Biqing Qi, Bowen Zhou · OpenReview

Abstract

Specialized Generalist Models (SGMs) aim to preserve broad capabilities while achieving expert-level performance in target domains. However, traditional LLM structures including Transformer, Linear Attention, and hybrid models do not employ specialized memory mechanism guided by task information. In this paper, we present Nirvana, an SGM with specialized memory mechanism, linear time complexity, and test-time task information extraction. Besides, we propose the Task-Aware Memory Trigger (Trigger) that flexibly adjusts memory mechanism based on the current task's requirements. In Trigger, each incoming sample is treated as a self-supervised fine-tuning task, enabling Nirvana to adapt its task-related parameters on the fly to domain shifts. We also design the Specialized Memory Updater (Updater) that dynamically memorizes the context guided by Trigger. We conduct experiments on both general language tasks and specialized medical tasks. On a variety of natural language modeling benchmarks, Nirvana achieves competitive or superior results compared to the existing LLM structures. To prove the effectiveness of Trigger on specialized tasks, we test Nirvana's performance on a challenging medical task, i.e., Magnetic Resonance Imaging (MRI). We post-train frozen Nirvana backbone with lightweight codecs on paired electromagnetic signals and MRI images. Despite the frozen Nirvana backbone, Trigger guides the model to adapt to the MRI domain with the change of task-related parameters. Nirvana achieves higher-quality MRI reconstruction compared to conventional MRI models as well as the models with traditional LLMs' backbone, and can also generate accurate preliminary clinical reports accordingly.

Introduction

While Large Language Models (LLMs) have mastered general conversation, they often stumble in specialized fields requiring deep, domain-specific reasoning. Existing Specialized Generalist Models (SGMs) attempt to bridge this gap, but traditional architectures like Transformers or pure State Space Models lack a flexible mechanism to reconfigure memory based on specific tasks during inference. Nirvana addresses this by treating inference as a learning process, allowing the model to adapt its memory strategy dynamically for every input sample.

Architecture and Methodology

Nirvana introduces two primary components that enable on-the-fly adaptation while maintaining linear time complexity:

  1. Task-Aware Memory Trigger (Trigger): This component treats every incoming sample as a self-supervised fine-tuning task. Utilizing Cross-Layer Online Gradient Descent (CL-OGD), it extracts task-specific information to update "fast parameters" from a shared weight bank.
  2. Specialized Memory Updater (Updater): This manages the memory by interpolating between Sliding Window Attention (SWA) for fine-grained local details and Linear Attention for global context. The Trigger dictates the optimal balance between these memory types for the given task.
Figure 4: The Nirvana architecture featuring the Task-Aware Memory Trigger and Specialized Memory Updater.

Experimental Results

Nirvana was evaluated across diverse benchmarks, ranging from general language modeling to specialized medical signal processing.

Generalist and Long-Context Performance

A 1.3B parameter Nirvana model achieved an average score of 56.51 on common sense reasoning tasks (including PIQA, HellaSwag, and ARC), outperforming state-of-the-art models like Mamba2 (54.89) and Gated DeltaNet (55.32). In long-context evaluations, Nirvana achieved 100% accuracy on 4K "Needle-In-A-Haystack" tasks and demonstrated superior stability when extrapolating to 20K tokens.

Medical Expertise: MRI Reconstruction

In the challenging domain of MRI reconstruction using the FastMRI dataset, Nirvana demonstrated that a frozen LLM backbone, guided by the Trigger mechanism, could outperform specialized medical imaging models. Nirvana achieved a Structural Similarity Index (SSIM) of 0.9003, significantly higher than the previous SOTA, UDNO (0.8598). It maintained high image fidelity even at high acceleration factors where other models produced artifacts.

Figure 6: SSIM performance of Nirvana compared to UDNO and E2E-VarNet across different acceleration factors.

Conclusion

Nirvana represents a significant step toward models that are both generalists and experts. By treating inference as a learning process and employing a task-aware memory mechanism, it achieves superior performance in both language and physical signal processing. Future work will explore full-parameter fine-tuning for deeper specialization and stress-testing linear complexity at million-token scales.

Summary updated

BibTeX
@inproceedings{jiang2026nirvana,
  author = {Yuhua Jiang and Shuang Cheng and Yihao Liu and Ermo Hua and Che Jiang and Weigao Sun and Yu Cheng and Feifei Gao and Biqing Qi and Bowen Zhou},
  title = {{Nirvana: A Specialized Generalist Model With Task-Aware Memory Mechanism}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.996},
}
Figure