Paper deep dive
From Exposure to Internalization: Dual-Stream Calibration for In-context Clinical Reasoning
Chuang Zhao, Hongke Zhao, Xiaofang Zhou, Xiaomeng Li
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 96%
Last extracted: 4/10/2026, 3:11:35 AM
Summary
The paper introduces Dual-Stream Calibration (DSC), a test-time training framework for Large Language Models (LLMs) designed to improve clinical reasoning. DSC moves beyond passive context exposure by employing two parallel calibration streams: a Semantic Calibration Stream that minimizes entropy to stabilize generative trajectories, and a Structural Calibration Stream that uses meta-learning to reconstruct inferential dependencies between clinical records and diagnostic queries. The framework demonstrates superior performance across thirteen clinical benchmarks compared to existing fine-tuning and test-time learning methods.
Entities (5)
Relation Signals (3)
Dual-Stream Calibration â comprises â Semantic Calibration Stream
confidence 100% ¡ DSC facilitates input internalization by synergistically aligning two calibration streams.
Dual-Stream Calibration â comprises â Structural Calibration Stream
confidence 100% ¡ DSC facilitates input internalization by synergistically aligning two calibration streams.
Dual-Stream Calibration â optimizes â Clinical Reasoning
confidence 95% ¡ we propose DSC, a novel test-time training framework that shifts the LLM paradigm... enabling adaptive and accurate clinical reasoning
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Contextual clinical reasoning demands robust inference grounded in complex, heterogeneous clinical records. While state-of-the-art fine-tuning, in-context learning (ICL), and retrieval-augmented generation (RAG) enable knowledge exposure, they often fall short of genuine contextual internalization: dynamically adjusting a model's internal representations to the subtle nuances of individual cases at inference time. To address this, we propose Dual-Stream Calibration (DSC), a test-time training framework that transcends superficial knowledge exposure to achieve deep internalization during inference. DSC facilitates input internalization by synergistically aligning two calibration streams. Unlike passive context exposure, the Semantic Calibration Stream enforces a deliberative reflection on core evidence, internalizing semantic anchors by minimizing entropy to stabilize generative trajectories. Simultaneously, the Structural Calibration Stream assimilates latent inferential dependencies through an iterative meta-learning objective. By training on specialized support sets at test-time, this stream enables the model to bridge the gap between external evidence and internal logic, synthesizing fragmented data into a coherent response. Our approach shifts the reasoning paradigm from passive attention-based matching to an active refinement of the latent inferential space. Validated against thirteen clinical datasets, DSC demonstrates superiority across three distinct task paradigms, consistently outstripping state-of-the-art baselines ranging from training-dependent models to test-time learning frameworks.
Tags
Links
- Source: https://arxiv.org/abs/2604.06262v1
- Canonical: https://arxiv.org/abs/2604.06262v1
Trouble viewing inline? Open PDF directly â
Full Text
94,099 characters extracted from source content.
Expand or collapse full text
X1 From Exposure to Internalization: Dual-Stream Calibration for In-context Clinical Reasoning Chuang Zhao, Hongke Zhao, Xiaofang Zhou, Fellow, IEEE, Xiaomeng Li, Senior Member, IEEE AbstractâContextual clinical reasoning demands robust in- ference grounded in complex, heterogeneous clinical records. While state-of-the-art fine-tuning, in-context learning (ICL), and retrieval-augmented generation (RAG) enable knowledge expo- sure, they often fall short of genuine contextual internalization: dynamically adjusting a modelâs internal representations to the subtle nuances of individual cases at inference time. To address this, we propose Dual-Stream Calibration (DSC), a test- time training framework that transcends superficial knowledge exposure to achieve deep internalization during inference. DSC facilitates input internalization by synergistically aligning two calibration streams. Unlike passive context exposure, the Seman- tic Calibration Stream enforces a deliberative reflection on core evidence, internalizing semantic anchors by minimizing entropy to stabilize generative trajectories. Simultaneously, the Structural Calibration Stream assimilates latent inferential dependencies through an iterative meta-learning objective. By training on specialized support sets at test-time, this stream enables the model to bridge the gap between external evidence and internal logic, synthesizing fragmented data into a coherent response. Our approach shifts the reasoning paradigm from passive attention- based matching to an active refinement of the latent infer- ential space. Validated against thirteen clinical datasets, DSC demonstrates superiority across three distinct task paradigms, consistently outstripping state-of-the-art baselines ranging from training-dependent models to test-time learning frameworks. Index TermsâClinical Reasoning, Knowledge Internalization, Test-time Training I. INTRODUCTION C LINICAL reasoning stands as a unique knowledge- intensive frontier, distinct from conventional linguistic comprehension [1], [2]. Unlike standard question answer- ing (QA), this task mandates that Large Language Models (LLMs) synthesize intricate, multi-faceted clinical records. These records include comparable patient histories, longitudi- nal laboratory results, and diagnostic narratives, enabling mod- els to conduct rigorous causal inference and draw accurate, well-justified conclusions [3]â[5]. The central obstacle lies in enabling these models to effectively internalize and harness the input evidence during inference, moving beyond highly speculative leaps or stochastic guessing. C. Zhao and X. Li are with the Department of Electronic and Computer Engineering, The Hong Kong University of Science and Technology, Hong Kong, SAR, China; (e-mail: czhaobo@connect.ust.hk, eexmli@ust.hk). X. Li is the corresponding author. H. Zhao is with the College of Management and Economics, Laboratory of Computation and Analytics of Complex Management Systems (CACMS), Tianjin University, Tianjin 30072, China; (e-mail: hongke@tju.edu.cn) X. Zhou is with the Department of Computer Science and Engineering, The Hong Kong University of Science and Technology, Hong Kong, SAR, China; (e-mail: zxf@ust.hk). Qwen25-7BLingshu-7B 0.08 0.10 0.12 0.14 0.16 0.18 0.20 ICL SFT i-MedRAG T DSC (a) Internalization. 05001000150020002500300035004000 Inference Step 0 2 4 6 8 10 Entropy DSC (Mean) DSC Âą1 Std Deepseek (Mean) Deepseek Âą1 Std CoT (Mean) CoT Âą1 Std T (Mean) T Âą1 Std Step 461 Entropy: 5.44 Token: at ID: 518 Step 749 Entropy: 5.06 Token: and ID: 323 (b) Generation Entropy. BeforeAfter 0.34 0.36 0.38 0.40 0.42 0.44 ICL i-MedRAG T DSC (c) In-context Disturb. Fig. 1. Motivations. Fig. 1(a) presents the ROUGE-L scores of various models evaluated on auxiliary QA pairs per sample. These QA pairs are generated from the eLife datasetâs context using DeepSeek-V3 [6] and subsequently provided as input for model evaluation. Qwen [7] and Lingshu [8] denote different LLM backbones. Fig. 1(b) depicts the predictive entropy fluctuations during the generative process. Fig. 1(c) evaluates model resilience (ROUGE- L) to contextual order on the eLife dataset, where the order of in-context demonstrations is randomly perturbed. A critical review of existing methodologies reveals lim- itations across two primary paradigms. The training-based paradigm, represented by Supervised Fine-Tuning (SFT) [9], [10] and Reinforcement Learning (RL) [11], [12], attempts to fossilize clinical expertise within the modelâs parametric weights during training. While enhancing domain familiarity, this strategy induces a frozen reasoning logic that is ill- equipped for the fluid nature of medicine, where the pro- hibitive cost of large-scale retraining renders models lag behind evolving clinical guidelines. More critically, this rigid parametric dependency creates a generalization bottleneck: when faced with Out-of-Distribution (OOD) scenarios [13], [14] where patient symptoms deviate from training tem- plates, the modelâs internal logic often collapses, resulting in brittle performance in high-stakes clinical environments. To transcend these costs and static constraints, recent research has shifted toward independent adaptation at the inference stage. The test-time tuning-free paradigm achieves this through dynamic evidence synthesis, including medical context-driven methods like RAG [15], [16], ICL [17], [18], and scaling- driven strategies like Chain-of-Thought (CoT) [19] and multi- agent collaboration [20], [21]. While promising, these ap- proaches fall into a âpassive observationâ trap, treating context and answer as sequential pattern-matching problem rather than an explicit derivation. They lack a mechanism for dynamic path calibration, failing to interrogate whether the input evi- dence genuinely supports the diagnostic claim. Consequently, the modelâs output remains an educated guess rather than a structured derivation; by failing to actively recalibrate its response against the evidenceâs causal weight, the model merely âseesâ rather than âcomprehendsâ the context. This arXiv:2604.06262v1 [q-bio.QM] 7 Apr 2026 X2 leads to increased output uncertainty and sensitivity to context perturbations, as illustrated in Fig. 1. Most recently, the test-time tuning-based paradigm repre- sented by T [22] and SLOT [23] has emerged as a frontier for inference-time refinement. However, these methods exhibit two specific limitations that reduce their effectiveness in clini- cal reasoning. First, these methods apply uniform optimization weight across all input tokens. In clinical records where ad- ministrative notes, similar patient histories, and other auxiliary text substantially outnumber diagnostically relevant query, this uniform weighting causes the model to allocate update capac- ity to low-signal tokens. Accordingly, instead of sharpening its reasoning, the model dilutes its specialized medical knowledge by overfitting to the entropy of auxiliary records, a failure mode evidenced by the performance degradation in OOD set- tings in Fig. 8 and heightened generation entropy in Fig. 1(b). Second, these paradigms treat complex clinical backgrounds as flat token sequences, which does not capture the structured dependencies among longitudinal observations. For instance, diagnosing a patient with an atypical presentation of sepsis may require reasoning over structurally similar prior cases, identifying that a comparable pattern of inflammatory markers and vital sign trajectories in a previous patient resolved to the same diagnosis. Without a mechanism to leverage such inter-case inferential paths, the updated parameters cannot transfer relational evidence from comparable patients to the target case, limiting the modelâs ability to resolve ambiguous diagnostic targets from heterogeneous clinical observations. This limitation is reflected in the high context dependence and poor internalization observed in Fig. 1(c) and Fig. 10(c). Motivated by the shared limitations of both test-time tuning paradigms and the need to move beyond superficial knowledge exposure, we propose Dual-Stream Calibration (DSC) for in-context clinical reasoning. Our central technical insight posits that achieving true contextual understanding requires a targeted, two-pronged calibration of the input representation at inference time, thereby shifting the LLM from a passive observer to an active agent of deep internalization. We commit to rectifying the inputâs deficiencies from both the semantic and structural perspectives. Specifically, the Semantic Calibra- tion Stream reduces spurious uncertainty through a dynamic entropy detection and revision strategy operating as a self- reflective loop. Unlike indiscriminate optimization, our model selectively differentiates between context and query, monitor- ing the generation process in long-short windows to surgically revise high-entropy tokens. This ensures that every diagnostic claim represents a converged state of high-confidence clinical evidence, effectively grounding the modelâs generative logic in verifiable certainty, as depicted in Fig. 10(b). Concurrently, the Structure Calibration Stream leverages a meta-learning paradigm to redefine the modelâs interaction with contextual information. Rather than treating the clinical background as a static reference, this stream employs an alternating framework of specialized support sets and meta-queries to train the model on the act of inference itself. In practice, this mechanism empowers the LLM to master the inferential protocols of context-to-answer mapping. By treating the input as a nav- igable knowledge base, the model learns to reconstruct the structural pathways that link analogous patient topographies to tailored diagnostic conclusions. This transforms the reason- ing process from a black-box extrapolation into a structural derivation, ensuring that every conclusion is a direct byproduct of navigated evidence synthesis, as evidenced in Fig. 1(c). To summarize, the contributions of this work are threefold: ⢠We propose DSC, a novel test-time training framework that shifts the LLM paradigm from superficial context exposure to deep context internalization, enabling adaptive and accurate clinical reasoning at inference time. ⢠We develop two specialized, fine-grained calibration strate- gies: the dynamic entropy detection and elimination for semantic calibration, and an iterative structural calibration for reconstructing context-answer dependencies. ⢠We conduct extensive experiments on 13 challenging clin- ical benchmarks, demonstrating that our DSC framework consistently establishes new state-of-the-art performance, validating its superior effectiveness and efficiency. I. RELATED WORK We review the closely related work, highlighting both connections and distinctions. For clarity, we present the key difference with the closely related work in Fig. 2. A. Clinical Reasoning Clinical reasoning transcends superficial pattern matching, requiring high-stakes inferential synthesis over complex and often noisy longitudinal patient records [24]â[26]. Unlike tra- ditional domain-based question answering, it necessitates the active construction of diagnostic trajectories from fragmented evidence rather than simple factual lookups [27], [28]. The evolution of clinical LLM adaptation is defined by a shift from static training alignment toward dynamic, inference- time reasoning. The training-based paradigm, represented by SFT and RL, seeks to fossilize clinical expertise within parametric weights [29], [30]. While effective for domain alignment, these high-cost methods yield rigid models prone to brittle collapse in OOD scenarios, as they lack the fluid adaptability required for evolving patient cases. To circumvent the costs of retraining, the test-time paradigm encompassing RAG, ICL, and Multi-agent workflows shifts toward dynamic knowledge utilization by augmenting prompts with external evidence or collaborative scaling [21], [31]. While frameworks like AgentSimp [32], TAGS [33], and ColaCare [16], [34] significantly enhance task-level performance through diverse agent roles and enriched data sourcing, they remain teth- ered to an extrinsic optimization logic. By focusing on the orchestration of external workflows rather than the intrinsic calibration of the modelâs latent states, these methods expand the search space without refining the inferential precision of the underlying LLM. Consequently, the model acts as a passive aggregator of information, failing to resolve the core tension between dense contextual noise and the causal clarity required for diagnostic certainty. Moving beyond passive knowledge exposure, DSC achieves active logical internalization by synchronizing semantic grounding with structural navigation. While prior test-time X3 methods in medical treat clinical records as static, uncali- brated inputs, DSC transforms the context into a dynamic inferential space. By resolving spurious uncertainty through its semantic stream and bridging the context-to-answer gap through its structural stream, DSC ensures that generative logic is no longer a black-box extrapolation, but a rigorous, evidence-anchored derivation specifically engineered for high- stakes clinical reasoning. B. Test-time Scaling Test-time scaling (TTS) refers to a class of techniques designed to enhance a modelâs reasoning capabilities by strategically increasing computational expenditure during the inference phase [35]â[37]. Rather than relying solely on a fixed-cost forward pass, test-time scaling seeks to elicit higher- order intelligence from pre-trained weights through mecha- nisms such as search-based reasoning, iterative refinement, or local parameter adaptation [38]. Existing test-time scaling methodologies can be broadly categorized into prompt-level expansion and parameter-level optimization [14], [38]. Prompt-level expansion techniques dynamically adjust inference processes without modifying model parameters, focusing on guiding the modelâs reasoning through structured interactions. CoT prompting [19] is a foun- dational approach that elicits step-by-step reasoning via ex- plicit instructions, with its variants like Tree-of-Thoughts [39] extending this to branching reasoning paths for complex problem exploration. Multi-agent collaboration, exemplified by MedAgents [21] and MDAgents [20], further enhances scaling by coordinating multiple model instances to generate diverse solutions or verify each otherâs outputs, harnessing collective reasoning to improve reliability. Parameter-level op- timization refines the modelâs internal parameters to inherently enhance test-time reasoning, reducing reliance on external prompting [22]. For example, Test-time Learning-based (TTL) baselines including TLM [36], T [22], and SLOT [23], optimize model parameters to lower perplexity toward in- put queries, enabling more stable and focused reasoning by aligning the modelâs internal representations with task-specific inputs. Yet, current implementations suffer from a critical objective-task mismatch. This indiscriminate optimization not only risks corrupting the modelâs linguistic coherence but also fails to capture the latent structural dependencies within medical records, leaving the model prone to hallucinating within high-uncertainty voids. Unlike prompt-level expansion techniques, such as CoT or Multi-agent collaboration, DSC deepens the internalization of task-specific evidence without relying on fragile prompt engi- neering or incurring the prohibitive token overhead of multi- agent architectures. Furthermore, unlike existing parameter- level optimization methods like TLM and SLOT, which suf- fer from a notable objective-task mismatch by optimizing all tokens indiscriminately, DSC implements a context-query separated, long-short windows detection and optimization. By simultaneously purging semantic uncertainty through entropy- driven calibration and reconstructing latent inferential de- pendencies via meta-learning, DSC achieves an output-level LLM Model Query Answer â retrieval âĄtraining (b) SLOT/TTL/ T â˘generate LLM Model Query Answer â retrieval âĄconcat (a) ICL / RAG Top-K LLM Model Query â retrieval âĄInternalization (c) Our Framework âŁgenerate Augment view Semantic Structure Generate-then-Extract â˘training Answer Fig. 2. Key difference between ICL, RAG, TTL-based baselines, and the proposed DSC. Our core innovation introduces a dual-calibration framework that enforces semantic understanding and structure robustness, transforming passive information retrieval into active contextual internalization. TABLE I COMPREHENSIVE MATHEMATICAL NOTATIONS. NotationsDescriptions M(θ)Frozen Large Language Model C,Q,ARetrieved Context, Input Query, Answer XTotal Input H C , H Q Token Embeddings of C and Q δ sem ,δ str Semantic/Structure Calibration Vectors (Trainable) m,n,k Sequence Lengths of C, Q, and A H â Calibrated Embeddings H(p i )Predictive Entropy at Context Token i N short Short Window Length y i i-th Generated Token Îź s ,Îź l Local and Global (Long) Entropy Averages Ď Dynamic Threshold Multiplier for Uncertain Tokens USet of Uncertain (High-Entropy) Generated Tokens IPrompt Instruction L ent Adaptive Entropy Minimization Loss L rcf Recalibration Factor Loss MNumber of Context Permutations Context l i l-th Permuted Context of x i (P i,l meta , y i )l-th Meta-training Input, Answer of x i L str Structural Calibration Stream Loss ÎłTrade-off weights for L sem and L str L dsc Total Dual-Stream Calibration Loss grounding absent in prior works. This represents a paradigm shift from simple context inclusion to deep, structure-aware context manipulation, ensuring robust reasoning fidelity in high-stakes clinical scenarios. I. PROPOSED METHOD We first introduce the preliminaries, then provide an overview of the proposed DSC, and detail submodules. A. Preliminaries Clinical Dataset: Unlike conventional general-domain QA that relies on straightforward factoid retrieval, the datasets in this study feature sophisticated clinical narratives that demand high-order, multi-hop reasoning. Each instance consists of a corresponding clinical query Q, the background B (e.g., patient-doctor dialogue, patient history, lab results), and the ground truth answer A. Consistent with [16], [22], we in- tegrate the background information B and the query Q into a consolidated query to ensure a comprehensive contextual representation. The final query contains multiple tokens, i.e., Q =q 1 ,q 2 ,...,q n . Task Formulation: Our goal is to train a framework, specif- ically the DSC framework, that enhances a pre-trained Large X4 Language Model, denoted as M(¡;θ), to perform in-context clinical reasoning through the systematic synthesis of evidence from similar patient profiles. Given a context C (comprising recalled K demonstrations) and a query Q, the objective is for the model to generate the correct answer A by effectively internalizing the contextual evidence. Following the In-context learning paradigm [17], [40], the initial input to the LLM is constructed by concatenating the query and the context: X = [C;Q],(1) where [¡;¡] denotes the concatenation operation. Initially, the frozen LLM M processes the total input X to generate a final hidden representation H âR d at the penultimate layer. The modelâs classification or token generation mechanism is then defined by a linear transformation followed by a softmax activation function: P(A|X) = Softmax(W logits ¡ H),(2) where W logits denotes the weights of the pre-trained language modeling head. In this vanilla setting, the probability P of the answer A is formulated as: P(a 1 ,...,a k |c 1 ,...,c m ,q 1 ,...,q n ) = k Y i=1 P(a i |a <i ,C,Q), (3) whereC =c 1 ,c 2 ,...,c m typically represents a sequence of tokens. Crucially, we assume that the query and context C are rich with latent information. As such, the reasoning phase must move beyond simple exposure to achieve precise extraction and internalization of these underlying nuances. To mitigate this, our framework introduces two lightweight adaptations δ. By perturbing the representation into H â = H + δ sem + δ str , we effectively recalibrate the inputs to the W logits head. This transformation acts as an output-level adapter, designed to crystallize the input evidence and maximize the reasoning fidelity of the frozen model M. Consequently, the modified conditional probability is formulated as, P(A|X;δ) = Softmax(W logits ¡ H â ).(4) To guide the optimization of δ, we design specialized semantic and structural regularized objectives in Section I-B that enforce consistency during the inference process. By shifting the latent vector precisely before the logit layer, the framework effectively recalibrates the modelâs focus, acting as a surgical intervention to maximize reasoning fidelity while keeping the extensive knowledge of the frozen LLMM intact. For clarity, we summarize the mathematical notations in Table I. Solution Overview: Our solution proposes the DSC frame- work to achieve deep contextual internalization via fine- grained, output-level calibration at inference time, fundamen- tally advancing beyond passive knowledge exposure. DSC employs two distinct and parallel streams to simultaneously refine the input from semantic and structural perspectives. The Semantic Calibration Stream refines conceptual integrity by addressing noise and ambiguity. This stream utilizes the dynamic entropy detection and elimination, which first identi- fies high-uncertainty tokens via long-short windows entropy analysis, and then optimizes the model using dual objec- tivesâan entropy loss to reduce ambiguity and a recalibration factor loss to preserve critical information. In parallel, the Structure Calibration Stream reconstructs the crucial inferen- tial links between the context and the clinical query. This stream employs an iterative meta-learning framework that dynamically constructs specialized support sets and meta- queries to reconstruct the latent inferential trajectory. By forc- ing the model to actively navigate and map the dependencies between fragmented evidence, our approach transforms the context from a flat sequence into a structured logical backbone. This ensures that the final output is not merely a textual response, but a systematic derivation rooted in the structural necessity of the clinical evidence. The unified, parallel DSC streams facilitate low-latency, inference-time adaptation, with the complete methodological architecture illustrated in Fig. 3. B. Method In this subsection, we detail the DSC framework, engineered to achieve deep contextual internalization for clinical reason- ing via fine-grained, output-level adaptation at inference time. 1) Input Formulation and Context Retrieval: The process begins with the construction of a contextual input X. To bridge the gap between raw clinical inquiries and formal medical knowledge, and inspired by recent advances in query- centric adaptation [41], we implement a two-stage query reformulation strategy: generating reasoning-oriented pseudo- labels followed by Top-K context retrieval. Query Reformulation. Rather than relying on direct reason- ing, we leverage the frozen LLM M to generate a reasoning- guided pseudo-label A pse . This label acts as an intermediate knowledge anchor that distills the latent intent of the raw clinical query Q. Given an instruction template I pse , the model first synthesizes this pseudo-label, from which a refined, reformulated query Q Ⲡis subsequently extracted: A pse =M(I pse ,Q),(5) Q Ⲡ= Extract(I ref ,Q,A pse ),(6) whereI ref denotes the reformulate instruction. This âgenerate- then-extractâ mechanism effectively unpacks the complex clinical requirements of Q, transforming it into a precise, reformulated probe Q Ⲡthat is intrinsically optimized for high- precision retrieval. Context Retrieval. We derive the latent representation H Q Ⲡfrom the reformulated query Q Ⲡusing the frozen encoder E , i.e., H Q Ⲡ= E(Q Ⲡ). Utilizing H Q Ⲡ, the context C is acquired via a Top-K retrieval from the comprehensive training dataset D train : C = Top-K(H Q Ⲡ,D train ),(7) where E denotes the MedCPT [42] used to compute cosine similarity for Top-K evidence retrieval; a comprehensive analysis of alternative encoder architectures is provided in Section V-B. The final input sequence is X = [C;Q Ⲡ]. As mentioned in Eq. 2, we generate a final hidden representation H âR d of X at the penultimate layer. For the sake of notational simplicity, we deliberately eschew the use of Q ⲠX5 Personal LLM í â (b) Test-time Training Phase (c) Test-time Inference Phase (a) Whole Pipeline ⨠Invariant Prob Q Question Summation AAnswer ⨠Concat Frozen Trainable Final Answer Patient Query Context Retrieval LLM í˝ Internalization LLM í â Semantic Internalization Structure Internalization Inference í´ !"# Detection ... Context Query LLM Encoder sample ... Semantic Calibration Structure Calibration LLM í˝ Short Windows Long Windows í ! +í$íż ! í " +í$íż " > > > Critic Token Selection window uncertainty Semantic Calibration LLM Classifier ... ... Low Entropy P voc Databases Distribution Generate Context íś íż !#$ â íż !&' H Fig. 3. Overview of our DSC framework. The overall architecture of DSC is presented in (a), which outlines the comprehensive test-time training pipeline, while (b) provides a granular decomposition of our core dual-stream mechanism. DSC leverages two parallel streams to simultaneously refine the input from both semantic and structural dimensions. The Semantic Calibration Stream implements dynamic entropy detection and elimination. This process first localizes high-uncertainty tokens via long-short window entropy analysis and subsequently optimizes the model using dual objectives: an entropy loss to resolve ambiguity and a high-fidelity loss to preserve critical information, resulting in a semantically certain input representation. The Structure Calibration Stream runs in parallel to reconstruct the vital inferential links bridging the context and the clinical query. It employs an iterative, alternating framework where specialized support sets and meta-queries are dynamically synthesized for meta-optimization. Finally, (c) illustrates the test-time inference phase, where the model executes the final predictions using the parameters optimized specifically for the given query. θ â denotes the LLM parameters integrated with δ. and continue to employ Q to represent the query, despite its enhanced informational density. 2) Semantic Calibration Stream: This stream facilitates a deep comprehension and selective utilization of the evidence X, effectively distilling core clinical insights while filtering the inherent semantic noise and ambiguity pervasive in the input. Rather than performing a discrete deletion of tokens, which may inadvertently disrupt linguistic coherence, this stream optimizes two latent correction vectorsδ C sem andδ Q sem . Please note that we apply distinct calibration vectors to context and query tokens. This decoupling enables independent control over their generative influence, filtering semantic noise without compromising the promptâs structural integrity. By perturbing the initial embedding H into a calibrated state H â sem = [H C + δ C sem ; H Q +δ Q sem ], the stream performs a fine-grained feature purification. This ensures the model selectively attends to the most salient evidence while suppressing the high-uncertainty generation. Ultimately, this mechanism compels the frozen LLM to perform a deep semantic internalization, isolating the high-value components within the context to anchor the final reasoning process. Critic Token Selection. To ensure the impact of these ad- ditional parameters is precisely guided, we implement an innovative dynamic entropy detection and elimination strategy. This approach is designed to isolate high-uncertainty tokens during the generation process, providing a key basis for the latent intervention. While point-wise entropy signals immedi- ate uncertainty, it is prone to high-frequency noise and lacks contextual depth [43]. Furthermore, static thresholds fail to accommodate the high variability and informational richness of clinical narratives, as demonstrated in Table V. To address this, we establish an adaptive thresholding mechanism based on two concurrent historical metrics: short-window entropy (Îź s ) and long-context entropy (Îź l ). A generated token y t is designated as a high-uncertainty point (y t â U ) only if its instantaneous entropy H t statistically deviates from both localized and global trends: y t âU ââ H t > Îź s + Ď Âˇ Ď s and H t > Îź l + Ď Âˇ Ď l , (8) where H t = â P p(y t ) logp(y t ) represents the Shannon entropy [23] of the token distribution, and Ď is sensitivity hyperparameters. Îź s and its corresponding variance Ď s are computed over a fixed-size window of the N short most recent tokens, capturing localized fluctuations in model confidence. In contrast, Îź l and Ď l are cumulatively calculated across the entire (longer) generated sequence from the initial token to the current step t, reflecting the global stability of the reasoning trace. This dual-constraint mechanism ensures that the semantic calibration is highly selective; by synergizing localized sensitivity with global stability, we filter out only the most ambiguous representations, thereby minimizing global perturbation while maximizing the neutralization of semantic distractors. A comparative analysis of various uncertainty metrics is provided in Section V-B. Calibration Optimization. The optimization seeks the op- timalδ â sem that minimizes uncertainty while preserving fac- tual integrity. Naive entropy minimization in TLM [36] and SLOT [23] risks catastrophic distributional collapse [44]. The optimization must delicately balance ambiguity reduction with the preservation of critical non-uncertain information, X6 for instance, by constraining the auto-regressive probability distributions of the context and query. We achieve this using a hybrid loss L sem : L sem =L rcf (y <t ;δ C sem ,δ Q sem ) +L ent (y <t ;δ C sem ,δ Q sem ),(9) where L ent directly targets the high uncertainty of U by min- imizing the entropy of the perturbed predictive distribution: L ent = 1 |U| X y t âU H(P(¡|y <t ,δ C sem ,δ Q sem )).(10) To ensure that the adaptation does not degrade the modelâs foundational knowledge, the representation consistency factor L rcf enforces distributional consistency for the tokens iden- tified as certain (X \ U ). Rather than a simple embedding constraint, L rcf minimizes the divergence between the original and the adapted logit distributions, thereby preserving the semantics of the non-uncertain context: L rcf = X y t âX D KL P(y t |H y t )⼠P(y t |H y t +δ C sem +δ Q sem ) , (11) where P(y|¡) denotes the probability distribution generated by the frozen classification head W logits . By penalizing shifts in the predicted probabilities for certain tokens, this objec- tive ensures that the latent perturbation remains a targeted intervention. After optimization, the refined embedding H â sem constitutes the semantically certain representation C. This formulation ensures that the output-level adapter selectively rectifies ambiguity without compromising the reasoning fi- delity of the established clinical evidence. C. Structure Calibration Stream This stream runs in parallel to address the deficiency in the structural integration of scattered evidence. Rather than merely refining features, it enforces explicit structural align- ment between the context C and the query Q by optimizing the structure calibration vectorδ str , thereby re-anchoring the modelâs attention towards a logically coherent inferential path. Context Reformulation via Meta-Training. We achieve structural alignment by utilizingC as a support setS consisting of K distinct samples, denoted as S = (x i , y i ) K i=1 . To overcome the train-test mismatch prevalent in ICL, where the target query Q is structurally isolated, we incorporate Q directly into the structural learning process. We construct a contextual alignment instance A pse by Eq. 5 and augment the set:S Ⲡ=SâŞ(Q,A pse ). Using a leave-one-out strategy [45], [46] over S Ⲡ, each pair (x i , y i ) â S Ⲡserves as a prediction target, while the remaining elements form the context. Through dynamic context permutation, the meta-training phase forces the LLM to capture invariant structural dependencies, facili- tating robust knowledge transfer. The meta-training prompt is constructed as: P (i,l) meta = [I str ; Context (l) i ; x i ],(12) where Context (l) i denotes the l-th structural permutation of the retrieved context for inquiry x i . Specifically, each version represents a distinct logical rearrangement of the scattered medical evidence, forcing the model to transcend fixed input orders. The complete meta-training dataset is D i meta = n (P (i,l) meta , y i )|(x i , y i )â S Ⲡ,l = 1,...,M o . To further boost the robustness of the learned structural path and en- able the model to handle diverse reasoning directions (e.g., predicting cause from effect, or vice versa), we introduce the instance inversion augmentation. For every original instance (x i , y i )âS Ⲡ, we construct an inverted instance (y i , x i ) where the original label y i becomes the new input (query), and the original input x i becomes the new target (answer). Formally, S inv =(y i , x i )|(x i , y i )âS Ⲡ.(13) By training on the augmented dataset S Ⲡ⪠S inv , the model is compelled to learn bidirectional structural mappings. This ensures that the structure-aware query embedding H â str encodes dependencies that are robust to changes in the semantic role of the tokens. This is vital in clinical reasoning, where the structure of âSymptoms â Diagnosisâ must be related to âDiagnosis â Symptoms/Testsâ. The overall meta-training dataset is expanded to D i,â meta =D i meta âŞD i,inv meta . Calibration Optimization. The optimization ofδ str minimizes the meta-training loss L str over the augmented dataset D i,â meta , compelling the query embedding to adaptively guide the structural path: L str =â X (P,y)âD i,â meta |D i,â meta | X t=1 logP(y t |P,y <t ,δ str ),(14) By directing the structural loss onto the input calibration vectorδ str , we effectively encode the required structural align- ment into the queryâs latent space. This achieves the desired structural adaptation while preserving the frozen state of the base modelâs parameters. The final structure-aware query representation is then formulated as: H â str = H +δ str , where δ str represents the optimized structural guidance that anchors the query to the retrieved clinical evidence. Our approach naturally conforms to meta-learning [47] principles: perturbed contexts serve as multiple learning pairs for the agent, with final optimization conducted via meta-query results. D. Test-time Training & Inference This subsection delineates the complete test-time training and inference procedure. Each sample undergoes a sequen- tial pipeline: first undergoing test-time training, followed by inference. Additionally, a comparative analysis of offline op- timization variants is presented in Section V-C. Training Objective. The final objective function L dsc during the test-time training phase is a composite loss combining the two distinct calibration losses: L dsc =L sem (δ C sem ,δ Q sem ) + ÎłL str (δ str ),(15) where Îł is the trade-off weight. This composite objective real- izes the core principle of dual-stream internalization. By simul- taneously optimizingδ â sem andδ str across their respective loss landscapes, the framework ensures both the clarity (semantic) and organization (structural) of the contextual evidence are X7 maximized before the final inference. The main LLM weights θ remain frozen. Inference. During inference, the test-time training ofδ â sem andδ str is performed for a limited number of optimization steps T inf (e.g., T inf ⪠5) [23], [36]. This rapid adaptation tailors the input representation to the specific test instance. The final, adaptively calibrated input H â is constructed using the optimizedδ â sem andδ str . The frozen LLM M then generates the final prediction: A pred = argmax A P(A|H â ).(16) This procedure ensures that the LLM performs the final reasoning step using a context that is both semantically certain and structurally optimized, leading to robust and accurate clinical reasoning. The execution logic of our DSC framework is detailed in Algorithm 1. Algorithm 1 DSC for In-context Clinical Reasoning Input: Clinical Query Q, Context C, Frozen LLM M(θ), Max Adaptation Steps T inf ; Output: Predicted Answer A pred ; 1: Query reformulation Q Ⲡ(Eq. 6); 2: Retrieve context C via Top-K retrieval (Eq. 7); 3: Initialize calibration vectorsδ C sem ,δ Q sem ,δ str ; 4: Initialize iteration t = 0; 5: while t⤠T inf do # Semantic Calibration Stream 6:Identify high-uncertainty context tokensU using dual-window detectors (Eq. 8); 7:Compute semantic loss L sem (δ C sem ,δ Q sem ) (Eq. 9); # Structure Calibration Stream 8:Construct meta-training dataset D i meta using leave-one-out and permutations (Eq. 13); 9:Compute structural loss L str (δ str ) (Eq. 14); # Unified Test-Time Training 10:Compute total loss L dsc (Eq. 15); 11:Updateδ C sem ,δ Q sem ,δ str via âL dsc ; 12: t = t + 1; 13: end while # Test-time Inference 14: Construct final calibrated input H â = H +δ C sem +δ Q sem +δ str ; 15: Generate prediction A pred = argmax A P(A|H â ) using frozen M(θ); 16: return A pred IV. EXPERIMENTS We conduct extensive experiments across three primary generative healthcare prediction tasks. Datasets & Baselines. Our comprehensive evaluation spans three primary generative clinical reasoning tasks: Examination QA, Lay Summarization, and Clinical Diagnosis. Specif- ically, our evaluation covers seven datasets for Examina- tion QA (including MedQA [48], PubMedQA [49], MedM- CQA [50], MedBullets [51], MMLU [52], MMLU-Pro [53], and MedExQA [54].), three datasets for Lay Summarization (eLife [55], Cochrane [56], and PLOS [55]), and three for Clinical Diagnosis (DiagnosisArena [3], ReDisQA [57], and MediQ [58]). Please note that our experimental configurations vary by task: for Examination QA, we strictly adhere to the hard filtering settings established in [33], [59]; for Lay TABLE I PERFORMANCE COMPARISON: EXAMINATION QA (HARD VERSION [33]). THE PIPELINE INTEGRATES QWEN2.5-7B [7] (LLM BACKBONE), WITH FURTHER VARIATIONS EXPLORED IN SECTION V-B. MethodsMedQAPubMedQAMedMCQAMedBulletsMMLUMMLU-ProMedExQA Qwen2.5-7B [7]0.1600.1600.2400.0450.1270.2600.090 Deepseek-R1-7B [6]0.1800.2300.2600.1340.2600.1000.210 Lingshu-7B [8]0.1900.1700.2600.1570.2730.2100.210 SFT [9]0.2100.1800.0800.1840.2600.1800.160 GRPO [11]0.2300.2400.2300.1340.1500.1800.180 ICL [17]0.2300.1900.2000.1680.2190.2500.150 CoT [19] 0.1900.2100.1900.1680.2870.2400.160 Ensemble [61]0.2200.2000.2700.1120.1360.2900.130 i-MedRAG [31]0.2200.2400.3000.0890.1510.2600.160 TLM [36]0.1700.2100.2600.0780.1920.3000.150 SLOT [23]0.1600.2100.2100.0890.1360.2800.110 T [22] 0.2200.2000.2500.0790.2600.2200.150 MDAgents [20]0.1600.1200.2700.0890.1370.0500.080 ColaCare [16] [34]0.1500.1300.2600.0560.1090.2200.130 TAGS [33]0.2800.2500.2400.1460.3560.2500.160 DSC0.2900.3000.3600.2020.3010.3200.240 TABLE I PERFORMANCE COMPARISON: LAY SUMMARIZATION. IN THIS TASK, WE FOLLOW [24]. MethodsCochraneeLifePLOS MetricsROUGE-1ROUGE-LSARIROUGE-1ROUGE-LSARIROUGE-1ROUGE-LSARI Qwen2.5-7B [7]0.3970.3720.3840.3500.3220.4330.3700.3480.394 Deepseek-R1-7B [6]0.4000.3690.3830.3680.3490.4370.4100.3720.367 Lingshu-7B [8] 0.3850.3570.3830.3120.2910.4280.3570.3290.384 SFT [9]0.4350.4000.3820.4230.4090.4050.4150.3710.396 GRPO [11]0.4100.3800.3890.4050.3820.4430.4090.3870.397 ICL [17]0.4310.4030.3960.4310.4060.4490.3980.3720.401 CoT [19]0.4180.3520.3960.4200.3970.4460.3900.3660.403 Ensemble [61]0.3670.3040.3500.2900.2570.3970.2800.2670.358 i-MedRAG [31]0.3270.2760.3660.4130.3900.4270.3250.2980.374 TLM [36]0.3540.3310.3860.3720.3660.4300.3550.3340.393 SLOT [23]0.3530.3300.3860.3520.3340.4350.3730.3500.463 T [22]0.4080.3820.3970.4030.3790.4460.3910.3660.402 AgentSimp [32]0.3820.3520.3950.4210.3580.4270.3910.3530.365 DSC0.4530.4230.4020.4480.4300.4530.4420.4160.444 Summarization, we follow the same processing paradigm de- fined by [24]; and for Clinical Diagnosis, models and datasets are directly sourced from the Hugging Face Hub 1 without additional task-specific modifications. We categorize our comparative baselines into four dis- tinct optimization paradigms: (i) Pure / Medical LLMs, in- cluding Qwen3-7B [60], DeepSeek-R1-7B [6], and Lingshu- 7B [8]; (i) Training-dependent paradigms, such as SFT [9] and GRPO [11], requiring extensive pre-fitting on dedicated training sets; (i) Test-time tuning-free paradigms, including ICL [17], CoT [19], i-MedRAG [31], and Ensemble (Ma- jor Voting) [61], which operate in long-context / few-shot modes without parameter updates; and (iv) Test-time learning paradigms, such as TLM [36], T [22], and SLOT [23], which utilize instance-specific adaptation similar to our DSC framework. Furthermore, we incorporate task-specific SOTA methods: MDAgents [20], ColaCare [16], [34], and TAGS [33] for Examination QA; AgentSimp [32] for Lay Summarization; and ColaCare [16], [34] and DiagRL [30] for Clinical Diag- nosis. To ensure a fair comparison, all methods in paradigms (i)â(iv) utilize the same LLM backbone as our framework, unless explicitly stated otherwise. Implementation Details & Metrics. We implement the DSC framework and all competitive baselines using PyTorch 2.0 and the Hugging Face Transformers library, conducting ex- periments on a hardware configuration featuring an Intel Xeon CPU and eight NVIDIA A800 GPUs. We select Qwen2.5-7B- Instruct [7] as the frozen backbone LLMM(θ), which remains fixed throughout the test-time adaptation phase. For retrieval (Eq. 7), we employ MedCPT [42] for Examination QA and 1 https://huggingface.co/ X8 TABLE IV PERFORMANCE COMPARISON: CLINICAL DIAGNOSIS. MethodsMediQReDisQADiagnosisArena MetricsACCROUGE-LACCROUGE-LACCROUGE-L Qwen2.5-7B [7]0.5930.5180.5950.5610.2930.389 Deepseek-R1-7B [6]0.3580.4500.3890.2570.2500.163 Lingshu-7B [8]0.5890.4670.5660.5290.4230.164 SFT [9]0.5330.5670.5880.5920.4440.516 GRPO [11]0.5850.5770.5440.5970.4440.521 ICL [17]0.5270.6190.5730.5810.3800.479 CoT [19]0.5380.6020.6320.5630.3260.383 Ensemble [61]0.6080.6030.6470.3140.3690.381 i-MedRAG [31]0.6030.5700.6610.4500.2710.279 TLM [36]0.6120.6220.6530.5770.3690.448 SLOT [23]0.5750.5560.6370.5560.3580.425 T [22]0.6000.4870.5730.5500.3690.413 ColaCare [16] [34]0.6070.5800.5880.4790.4020.344 DiagRL [30]0.5450.6190.5660.5870.3470.422 DSC0.6320.6340.6770.6100.4560.532 E5 [62] for the other two tasks as our embedding models, utilizing FAISS [63] to index the biomedical corpus. The core trainable components, the correction vectorsδ â sem andδ str (which match the LLMâs hidden size), are initialized to zero vectors before the optimization of each test instance. Adap- tation is performed for a minimal number of steps, T inf = 5. We employ the AdamW optimizer, setting the learning rates to 1eâ 2. The final loss balancing hyperparameter (Eq. 15) are configured as Îł = 0.05, weighting the structural enforcement. For the Semantic Calibration Stream, the dynamic threshold parameters are set to Ď = 3, with a short-window size of N short = 25. The Top-K retrieval size is fixed at K = 3 unless otherwise specified. Please note that for lay summarization, we only utilize 200 randomly sampled training instances for a warm start, a scale significantly smaller than SFT or GRPO (vs. thousands in these two). All these key parameters are determined based on the hyperparameter analysis detailed in Section V-H. For Examination QA, following [21], [33], we use Accuracy (ACC) to measure discrete reasoning preci- sion. For Lay Summarization, adhering to [24], we employ ROUGE-1, ROUGE-L, and SARI to assess linguistic and structural fidelity. For Clinical Diagnosis, following [3], [21], [33], we utilize ACC alongside ROUGE-L to capture semantic alignment with expert ground truths. Overall Results. As demonstrated in Tables I, I, and IV, DSC consistently outperforms baseline models across diverse tasks and metrics, particularly showing significant gains in complex, multi-hop reasoning tasks where contextual fidelity is paramount. While inferior to the best baseline on MMLU, our model remains competitive. We attribute this to only 5 training samples being used as retrieval sources, which may cause inherent homogeneity. Deepseek-R1-7B exhibits limited performance in Examina- tion QA and Clinical Diagnosis, stemming from the knowledge gap and the inherent entropy preference of general models to exhibit high predictive uncertainty as discussed in Fig. 1(b). Performance sees a moderate increase with ICL and GRPO, as the introduction of external context /adaptation mitigates the knowledge gap. However, both ICL and i-MedRAG are limited by their passive knowledge exposure: the LLM is forced to process raw context without an internal mechanism to filter noise or align the evidence structure. This leads to susceptibil- ity to the âloss-in-the-middleâ problem, where crucial evidence is overlooked due to the model focusing its limited attention budget on noisy tokens. TLM and SLOT, while offering dynamic adaptation, often suffer from noise amplification, as their full-token optimization can inadvertently reinforce mis- alignments. In contrast to passive methods, our DSC yields the most robust performance gains by orchestrating active, dual- stream knowledge internalization. The Semantic Calibration Stream reduces noise amplification, a common failure mode in context-driven generation, by isolating high-uncertainty to- kens. Concurrently, the Structure Calibration Stream enforces a rigorous inferential bridge between in-context evidence and final predictions, effectively resolving structural ambiguity and facilitating knowledge transfer. Across the hard Examination QA tasks, we observe that the MedMCQA dataset yields the highest overall performance. This peak is likely attributable to its streamlined contextual density and high alignment with the clinical textbook knowl- edge encoded within the pre-trained weights or guidelines of models like Lingshu and i-MedRAG. In Lay Summa- rization, Cochrane demonstrates superior results compared to other datasets due to its structured multi-layered hierarchy. This standardized clinical reporting structure serves as a natural architectural bridge to the latent reasoning logic of high-capacity models like DeepSeek-R1, thereby maximizing generative coherence. In Clinical Diagnosis, algorithms such as CoT and TLM universally perform better on ReDisQA compared to DiagnosisArena. This disparity is driven by ReDisQAâs constrained context space and its integration of critical medication metadata, which effectively simplifies the modelâs decision-making manifold. Simultaneously, the com- prehensive patient profiles provided by the latter impose a significant computational and reasoning burden on the models. While these profiles offer high-fidelity clinical signals, their inherent complexity and high informational density necessitate advanced cross-referencing capabilities, which often exceed current model limits and lead to a noticeable degradation. In terms of task complexity, Lay Summarization, which necessitates free-text and long-form synthesis, proves the most formidable challenge. Baseline models exhibit degradation in chronological coherence, frequently succumbing to catas- trophic error propagation. In such high-entropy scenarios, stan- dard RAG and Ensemble fail to navigate dense contextual de- pendencies. Clinical Diagnosis is an intermediate-complexity tier, particularly for TTL-based algorithms, as it requires precise probabilistic balancing across evolving dialogue states. In this setting, our Semantic Calibration Stream serves as a critical stabilization mechanism, ensuring the model remains resilient against noisy differential diagnoses or conflicting symptomatic reports. By ensuring both semantic certainty and structural synthetics, this dual-stream filtration empowers the frozen LLM to execute high-confidence inference, thereby catalyzing the substantial performance gains across all context- dependent clinical tasks. V. MODEL ANALYSIS AND ROBUST TESTINGS We conduct numerous robustness experiments to provide a more in-depth analysis. Without loss of generality, we use MedQA, eLife, and DianosisArena for examination. X9 A. Ablation Studies We conduct extensive ablation analyses on the designed sub- modules while keeping other components consistent to validate the effectiveness of each element within the DSC framework. As shown in Table V, a performance decline is observed with any ablated variant, demonstrating the indispensability of each submodule. The DSC-NC variant isolates the impact of the retrieved context by removing C entirely. This setup degenerates the DSC framework into a localized test-time calibration restricted to the query embedding, nullifying the Structure Calibration Stream due to the absence of external ev- idence anchors. The resulting large performance gap highlights that DSCâs efficacy is rooted not merely in query refinement, but in the synergistic purification and structural alignment of external knowledge. DSC-NSW relies solely on the long- context entropy average, making it overly conservative and slow to react to long/short uncertainty spikes; this results in a 6% performance degradation on eLife. Conversely, DSC- NLW relies only on the short-window local entropy, leading to unstable and overly aggressive intervention, as it frequently misidentifies natural complexity as uncertainty, causing a 3.4% drop on MedQA. These results validate our core insight that the dual-window, dynamic threshold approach is necessary for precise and stable noise detection. DSC-NR removes the L rcf loss from the Semantic Stream.L rcf encourages stable learning by anchoring the current correction vector to its prior state. Ablating it leads to an unstable optimization trajectory for δ â sem and a performance decrease, demonstrating the necessity of this regularization term to prevent over-calibration during the sparse, high-magnitude intervention. DSC-NS and DSC- NST directly ablate the two main streams of our frame- work. The DSC-NS variant removes the Semantic Calibration Stream, stripping the framework of its ability to resolve latent ambiguity in the query and context. This shift from active refinement to passive knowledge exposure precipitates a significant performance drop. Similarly, DSC-NST removes the Structure Calibration Stream, preventing the model from aligning the query to the required inferential structure, which significantly undermines its in-context robustness and leads to a 4.6% performance degradation on eLife. In summary, these extensive ablation experiments robustly confirm that our core hypothesis that dual-stream input adap- tation is critical for achieving state-of-the-art performance in complex contextual reasoning tasks. TABLE V ABLATION STUDY. -NC ABLATES THE RETRIEVED CONTEXTC ; -NSW/-NLW ABLATE THE SHORT/LONG ENTROPY WINDOWS DETECTION USING FIXED THRESHOLD, RESPECTIVELY; -NR ABLATES THEL RCF REGULARIZATION TERM; -NS ABLATES THE ENTIRE SEMANTIC CALIBRATION STREAM; AND -NST ABLATES THE STRUCTURE CALIBRATION STREAM. AlgorithmsMetric-NC-NSW-NLW-NR-NS-NSTDSC MedQAACC0.1900.2100.2800.2600.2400.2100.290 eLife ROUGE-10.4190.4200.4390.4320.4270.4270.448 ROUGE-L0.3920.4080.4120.4030.4010.3930.430 SARI0.4240.4510.4490.4510.4500.4330.453 DiagnosisArena ACC0.3910.4240.3910.4440.4240.4130.456 ROUGE-L0.4650.4790.5180.5230.5080.4910.532 B. Plug-in Examination Context Retrievers. The choice of retrieval model directly influences the initial quality of the context C (Eq. 7), thereby affecting the workload of the two calibration streams. We evaluate three different state-of-the-art embedding models: E5 [62]; BMRetriever [64], a domain-specific model fine- tuned on clinical queries; and MedCPT [31], [42], a strong medical-purpose embedding. As depicted in Fig. 4, all re- trievers enable DSC to achieve strong performance, indicating the frameworkâs robustness against varying context quality. Specifically, MedCPT does not always yield the largest per- formance gain, providing only marginal improvement over the BMRetriever embedding. This observation demonstrates a key advantage of the DSC framework: its Semantic Calibration Stream effectively mitigates the impact of suboptimal or noisy contexts, preventing the LLMâs final prediction from being unduly influenced by irrelevant evidence, even when extracted by a general-purpose retriever. E5MedCPTBMRetriever 0.20 0.22 0.24 0.26 0.28 0.30 ICL i-MedRAG T DSC (a) MedQA (ACC) E5MedCPTBMRetriever 0.36 0.38 0.40 0.42 0.44 ICL i-MedRAG T DSC (b) eLife (R-L) E5MedCPTBMRetriever 0.275 0.300 0.325 0.350 0.375 0.400 0.425 0.450 0.475 ICL i-MedRAG T DSC (c) DiagnosisArena(ACC) Fig. 4. Comparison under diverse retrievers. We employ the popular BMRE- TRIEVER [64], E5 [62], and MedCPT [42]. We compare retrieval-dependent baselines, including ICL, i-MedRAG, and T. Qwen25-1.5B Lingshu-7B Qwen3-14B 0.175 0.200 0.225 0.250 0.275 0.300 0.325 0.350 ICL SFT T TAGS DSC (a) MedQA (ACC) Qwen25-1.5B Lingshu-7B Qwen3-14B 0.30 0.35 0.40 0.45 0.50 ICL SFT T AgentSimp DSC (b) eLife (R-L) Qwen25-1.5B Lingshu-7B Qwen3-14B 0.35 0.40 0.45 0.50 0.55 ICL SFT T DSC (c) DiagnosisArena(ACC) Fig. 5. Comparison under diverse LLMs. We employ Qwen2.5-1.5B [7], Lingshu-7B [8], and Qwen3-14B [60]. We select ICL, SFT, i-MedRAG, and T as representative baselines. We additionally incorporate TAGS for MedQA and AgentSimp for eLife due to their competitive performance. LLM Backbones. We test the portability and efficiency of DSC by varying the base LLM backbone, including smaller LLM (Qwen2.5-1.5B [7]), Medical LLM (Lingshu-7B [8]), and large reasoning LLMs (Qwen3-14B [60]). The backbone determines the fundamental reasoning capacity and the quality of initial embeddings (H). As shown in Fig. 5, increasing the model size generally correlates with performance improve- ments, with Qwen3-14B achieving the highest score. However, the improvement gap between the 7B model and the 14B model is notably small, and the Qwen2.5-1.5B model, when augmented with DSC, significantly outperforms its few-shot ICL and competes effectively with much larger baselines. This demonstrates that for complex RAG tasks, adaptive input calibration is a highly efficient alternative to scaling up the X10 base model parameters, proving DSCâs value for resource- constrained clinical environments. We also observe that utiliz- ing Lingshu-7B variants yields only marginal improvements over the core DSC architecture in Section IV. This minimal variance suggests that DSCâs efficacy is largely decoupled from domain-specific pre-training. Instead, the framework functions as a robust test-time enhancer, prioritizing the dy- namic internalization of query-context relationships over a reliance on static internal weights. Uncertainty Estimations. The dynamic entropy detection relies on accurate quantification of uncertainty. We test dif- ferent metrics [65] for high-uncertainty token identification U : standard Perplexity, Entropy (our choice in Eq. 10), and Energy. The metric choice dictates which tokens are targeted by the stream optimization. As depicted in Fig. 6, Entropy yields the competitive potential performance. Among practical, inference-time metrics, using Entropy significantly outper- forms Perplexity. This is because Perplexity provides a general measure of sequence fluency, which is often too broad and fails to localize prediction ambiguity effectively. In contrast, Entropy measures the dispersion of the next-token probability distribution, directly corresponding to the modelâs predictive certainty at token t. This localization is essential for the stream to selectively applyδ â sem and maximize the impact of the L ent without corrupting stable context areas. Entropy Perplexity Energy 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 SLOT TLM T DSC (a) MedQA (ACC) EntropyPerplexityEnergy 0.34 0.36 0.38 0.40 0.42 0.44 SLOT TLM T DSC (b) eLife (R-L) EntropyPerplexityEnergy 0.36 0.38 0.40 0.42 0.44 0.46 SLOT TLM T DSC (c) DiagnosisArena(ACC) Fig. 6. Comparison under diverse uncertainty estimation. Following [43], we employ Entropy, Perplexity, and Energy. TTL-based baselines are included. C. Online vs. Offline Test-time Optimization We analyze the performance characteristics of DSC under two distinct test-time optimization paradigms, defined by the sequence of adaptation and evaluation [36], [43]. In the online optimization scenario, adaptation is interleaved: for a given test sample X i , the correction vectors (δ â sem ,δ str ) are optimized for T inf steps usingL dsc (Eq. 15), and predictions are immediately made on X i , discarding the adaptation before processing X i+1 . Conversely, in the offline optimization approach, the model iterates through all test batches (X 1 ,..., X N ) for adaptation, and predictions are only made on the entire test set after all batches have been processed. As shown in Fig. 7, the online optimization setting achieves performance that is highly competitive with the offline setting. This performance gap highlights the strong instance-specificity of the DSC framework. Because the mechanism is designed to adapt to the unique semantic noise and structural requirements of each input instance, the benefits derived from optimizing the full batch sequence (offline) do not significantly transfer or generalize across test instances. This also proves that the DSC performs effective, rapid, and isolated adaptation, making it ideal for real-world online inference where low latency and batch independence are critical requirements. OnlineOffline 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 SLOT TLM T DSC (a) MedQA (ACC) OnlineOffline 0.32 0.34 0.36 0.38 0.40 0.42 0.44 0.46 SLOT TLM T DSC (b) eLife (R-L) OnlineOffline 0.36 0.38 0.40 0.42 0.44 0.46 0.48 SLOT TLM T DSC (c) DiagnosisArena(ACC) Fig. 7. Online vs. Offline test-time optimization. Online methods tailor the model to each test query individually prior to inference, whereas offline methods conduct a one-time optimization on the entire test set before evaluating queries sequentially. TTL-based baselines are included. D. Out-of-Distribution Examination We conduct two primary OOD scenarios, cross-dataset and cross-task evaluations, to examine the robustness and general- ization capabilities of DSC. Our DSC framework possesses an inherent advantage in OOD scenarios because its core mechanism is test-time training, relying on dynamic input adaptation (δ) rather than fixed parameter training in the training stage, leading to notable performance gains over the SFT. In the cross-dataset examination, where retrieval sources are swapped (e.g., MedQA using PubMedQA), performance remained relatively stable across ICL and T, as demon- strated in Fig. 8(a). This suggests that for QA tasks within the same medical domain, knowledge exhibits sufficient inter- transferability. However, during the more challenging cross- task examination (e.g., shifting from lay summarization to diagnosis prediction ), all baselines experience a noticeable performance drop, with SFT showing the most significant decline, as depicted in Fig. 8(b). This performance degradation stems from the mismatch in the required task structure. Our internalization paradigm propels DSC to significantly outper- form these baselines because the two calibrations actively reflect on the relationship between the novel task mode and the context. By dynamically optimizingδ str via the semantic understanding and meta-training objective, DSC effectively guides the frozen LLM to apply the retrieved information correctly, demonstrating robust generalization across distinct clinical reasoning modes. E. Extension to Other Scenarios Beyond validation in the specialized medical domain, we additionally examine the versatility of the DSC framework by extending our evaluation to several popular, general-domain reasoning scenarios, including factual question answering (e.g., ReClor [66]) and logical/quantitative reasoning (e.g., AMC [23], LogiQA [67]). As shown in Table VI, we obtain two key findings. First, our algorithmâs consistent superiority across general domains confirms that the core principle of DSC, namely, enhancing comprehension through input adap- tation, possesses significant potential far beyond the clinical X11 BeforeAfter 0.18 0.20 0.22 0.24 0.26 ICL SFT T DSC (a) MedQAâPubMedQA BeforeAfter 0.275 0.300 0.325 0.350 0.375 0.400 0.425 0.450 0.475 ICL SFT T DSC (b) eLifeâDiagnosisArena-MCQ Fig. 8. OOD examination. (a) cross-dataset scenario. (b) cross-task scenario. For both scenarios, we use one domain as the pre-training / Index domain and then directly assess performance on the test set of the other domain. landscape. Second, we observe that the performance uplift is significantly more pronounced in logical reasoning tasks, AMC, and LogiQA, compared to fact-based retrieval tasks like ReClor. This performance divergence is rooted in contextual architecture: while the high noise-to-signal ratios inherent in fact-based QA tax the stream, our calibration catalyzes superior reasoning in mathematic QA by orchestrating discrete inferential steps into a coherent deductive trajectory. To sum up, our improvement originates from the deep internalization, which strengthens the frozen modelâs grasp of the queryâs core intent and enhances the consistency of its internal state, leading to more reliable outputs. TABLE VI OTHER SCENARIOS. Methods MATH ReasoningKnowledge QA-ReClor AMC-ACCâLogiQA-ACCâACCâROUGE-LâSARIâ Qwen25-7B [7]0.4500.4430.2340.2690.482 Linshu-7B [9]0.0400.3880.2050.2590.479 ICL [17]0.5200.4510.2480.2700.485 SFT [9]0.5000.4880.2460.2270.466 Ensemble [61]0.4400.4840.2140.1560.405 i-MedRAG [31]0.3410.4510.1700.1530.436 TLM [36]0.4400.4470.2080.1720.378 T [22]0.5000.4640.2340.2670.477 Ours0.5300.5250.2600.2760.503 F. Complexity Analysis We analyze the computational efficiency and parameter costs associated with the proposed DSC, demonstrating its superior cost-effectiveness compared to established baselines. As depicted in Fig. 9(a), we present a bubble chart illustrating this balance. The figure clearly shows that DSC occupies a uniquely cost-effective position. Unlike SFT/RL methods, DSC entirely eliminates the massive overhead of training on large datasets and updating billions of parameters. Our frame- work also circumvents the heavy inter-agent communication overhead inherent in multi-agent systems like AgentSimp. Compared to ICL, which operates in few-shot modes, DSC incurs only a minimal, bounded test-time tuning overhead (op- timization ofδ â sem andδ str for T inf steps). This strategy results in a performance boost without a commensurate increase in active parameter count or computational complexity. Fig. 9(b) quantifies the computational cost associated with different hyperparameter scales. We observe that larger windows N short in the Eq. 8 strategy significantly impact time complexity. This is because this calculation requires processing the longer prefix of the context tokens (H 0 ,...,H tâ1 ) at each step t, leading to notable scaling in the length of the context. Fur- thermore, increasing the Top-K size (K) inherently expands the total number of tokens covered by the internalization mechanisms, thus also increasing time complexity. Meanwhile, by combining this analysis with Section V-H, we confirm the feasibility of our hyperparameter choices (e.g., selecting a relatively small K = 3 and N short = 25). These optimized parameters enable DSC to achieve peak performance while avoiding prohibitive computational burdens, thus underscoring the frameworkâs practical utility and deployability in latency- sensitive healthcare scenarios. 100200300400500 Inference Time (min) 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 Performance (ROUGE-L) Model Performance vs Inference Time ICL Ensemble SFT GRPO T AgentSimp DSC (a) Complexity DSC-Top1DSC-Top3DSC-Top5 DSC-Win10DSC-Win25DSC-Win45 45 50 55 60 65 70 75 Inference Time (minutes) (b) Time Reduction Fig. 9. Time complexity. To demonstrate practicality and fairness, for Fig. 9(a) and 9(b), we test the inference time for the eLife dataset on a machine equipped with one A800 GPU. G. Case Studies To validate the efficacy of the DSC framework and its core components, we conduct targeted analyses focusing on the modelâs internal behavior during generation. (a) Critical Tokens 05001000150020002500300035004000 Inference Step 0 2 4 6 8 10 Entropy DSC (Mean) DSC Âą1 Std DSC (No-Entropy) (Mean) DSC (No-Entropy) Âą1 Std Step 240 Entropy: 5.19 Token: slightly ID: 10078 (b) Entropy Reduction. SLOTTLMTTTDSC 0.10 0.12 0.14 0.16 0.18 0.20 Base (ICL) +Learning +Learning (Lingshu) (c) Internalization. Fig. 10. Case studies. Fig. 10(a) identifies critical tokens as those belonging to U (red) and certain tokens as those withX (blue). Fig. 10(b) illustrates the transition in predictive entropy during generation with and without entropy control. Fig. 10(c) displays the answering accuracy on auxiliary QA pairs (generated by DeepseekV3) derived from the context, comparing performance before and after the tuning process on eLife. Critical Tokens. We analyze the distribution of high-entropy / certain tokens across the generated sequence to understand where the LLM experiences the greatest predictive uncertainty. As observed in Fig. 10(a), our analysis reveals distinct entropy patterns: high entropy predominantly occurs in high-frequency functional tokens (e.g., âthe,â âand,â âthanâ) due to their broad contextual applicability. In contrast, low entropyâindicating high model certaintyâis concentrated in domain-specific suf- fixes (e.g., â-omaâ) and categorical nouns (e.g., âoptionsâ), reflecting the modelâs specialized knowledge in biomedical X12 nomenclature. This observation is consistent with prior find- ings [6], [12] that models pause or struggle most at key deci- sion points rather than focusing solely on content words. Eq. 8 is specifically designed to detect these crucial high-uncertainty nodes (U ) and trigger the L ent optimization onδ â sem . This proactive intervention allows DSC to perform precise and active control over the generation process, injecting semantic certainty exactly where the frozen backbone needs guidance. Entropy Reduction. We compare the overall token entropy distribution during the entire generation process with / without entropy configuration in Eq. 10. A lower and less volatile entropy curve indicates a more consistent, confident, and robust generation path, minimizing the risk of speculative tokens or hallucinations. As illustrated in Fig. 10(b), we ob- serve that compared to the without-entropy version, our DSC framework exhibits a significantly lower overall uncertainty and a smoother entropy curve during generation. This pro- nounced reduction in generation uncertainty is attributed to the synergistic efforts of both calibration streams. On one hand, the Semantic Calibration Stream clarifies the input evidence, preventing initial semantic misalignment from propagating high uncertainty. On the other hand, the Structure Calibration Stream pre-aligns the query to the required reasoning structure, providing the frozen LLM with an optimized roadmap for consistent output. This dual action guarantees a more reliable and coherent output sequence. Query Internalization. As illustrated in Fig. 1(a) and Fig. 10(c), we evaluate the inferential robustness of various algorithms across auxiliary question-answer pairs synthetically generated via DeepseekV3 [6] from retrieved demonstrations. The ICL and i-MedRAG exhibit a precipitous performance collapse rooted in their failure to assimilate external knowl- edge, whereas SFT provides only marginal improvements that remain far inferior to DSC. This substantial performance gap underscores that whereas SFT facilitates merely static knowledge utilization, our dual-stream framework achieves active and dynamic knowledge comprehension. By optimizing δ to recalibrate the LLMâs perception of the input manifold, DSC transcends rudimentary retrieval and indiscriminative optimization in TTL-based baselines, e.g., SLOT and T, validating the necessity of dynamic knowledge internalization for high-fidelity reasoning in complex domains. Illustrative Examples. As illustrated in Fig. 11, we provide qualitative case studies to contrast the generative outputs of DSC against competitive baseline T on DiagnosisArena. Our model generates a rigorous response through structured clinical clue extraction, integrated phenotypic synthesis, and principle-based diagnosis. In contrast, the T response re- veals critical limitations in complex reasoning: it exhibits a neglect of semantic prioritization (e.g., oversimplifying ev- idence and discarding key manifestations) and a deficiency in its inferential architecture (e.g., over-reliance on literal genetic labels and superficial matching). These flaws lead to misdiagnosis, mirroring the decline in clinical reasoning utility for T as illustrated in Fig. 10(c). The efficacy of DSC is rooted in the optimized input H â : specifically,δ â sem acts as a distilled semantic memory, whileδ str serves as a structural anchor that constrains the model to the correct inferential Instruction: You are a rare disease diagnosis specialist. [system-instructions] Examples: [Demonstrations] Question: Patient Case: [Context] What is the most likely diagnosis? Options: [Options] Model Response: Let's go through the case step by step: ### STEP 1-Extract all clinical clues: -**Demographics:** -Age: Late teens -Gender: Male -Risk Factors: Family history of renal failure (father and paternal grandfather) -**Symptoms:** -Dystrophy of the great toenails -Syndactyly of the second and third left toes -Lacrimal duct obstruction since birth -Loss of eyebrows and eyelashes beginning at age 2years -History of blisters on anterior shins following minor trauma since age 12years -Recurrent episodes of urinary retention due to severe strictures of bulbar urethra, requiring urethroplasties -**Signs:** -Absent eyebrows and eyelashes -Erythematous atrophic patches on anterior shins -Confined collections of milia -Syndactyly of second and third left toes -Dystrophic great toenails -**Tests:** -Laboratory Tests: -Blood creatinine levels: normal -Urinalysis: normal -Pulmonary function tests: normal -Skin Biopsy Findings: -Subepidermal split with collagen IV staining -Electron Microscopy findings: Sublaminadensablister with discontinuous basement membrane; lamina densaand hemidesmosomes on roof, collagen bundles at dermal base -Immunofluorescence Studies: -Integrin Îą3: Mislocalizedand lower-intensity staining -Integrin β1: Normal expression -Collagen XVII: Normal expression -Genetic Testing: -Whole-exome sequencing revealed homozygous variant c.821G>A (p.R274Q) in ITGA3 gene ### STEP 2-Generate pattern: The patient presents with a combination of skin findings (dystrophy of toenails, syndactyly, blisters, atrophic patches, milia), ocular findings (lacrimal duct obstruction, loss of eyebrows and eyelashes), and genitourinary findings (urinary retention, urethroplasties). The genetic testing reveals a homozygous variant in the ITGA3 gene, which is associated with junctional epidermolysis bullosa (JEB). ### STEP 3-Test each option: -**Option A: Junctional epidermolysis bullosa due to ITGA3 mutation** -Matches: The patient has skin findings consistent with JEB, and the genetic variant in ITGA3 is a known cause of JEB. -Does not match: The patient also has ocular and genitourinary findings, which are not typically associated with JEB due to ITGA3 mutation. -**Option B: Junctional epidermolysis bullosa with renal and respiratory involvement (junctional EB-R), skin and mucosa-limited variant** -Matches: The patient has skin findings consistent with JEB and renal involvement (urinary retention, urethroplasties). -Does not match: The patient does not have respiratory involvement, and the genetic variant in ITGA3 is not typically associated with renal involvement in JEB-R. -**Option C: Junctional Epidermolysis Bullosa (JEB) âNon-HerlitzType** -Matches: The patient has skin findings consistent with JEB. -Does not match: The patient also has ocular and genitourinary findings, which are not typically associated with JEB-Non-Herlitz. -**Option D: Junctional epidermolysis bullosa (integrin Îą3 deficiency)** -Matches: The patient has skin findings consistent with JEB, and the genetic variant in ITGA3 is a known cause of JEB. -Does not match: The patient also has ocular and genitourinary findings, which are not typically associated with JEB due to ITGA3 mutation. ### STEP 4-Select best fit: The option that explains ALL findings, with fewest assumptions, is the one that includes the renal and genitourinary findings, which are not typically associated with JEB due to ITGA3 mutation. However, the best fit that matches the clinical and genetic findings is: Answer: $B Correct Answer: B Instruction: You are a rare disease diagnosis specialist. [system-instructions] Examples: [Demonstrations] Question: Patient Case: [Context] What is the most likely diagnosis? Options: [Options] Model Response: Let's analyze the case step by step: ### Step 1 -Extract all clinical clues: -**Demographics:** Male, late teens -**Symptoms:** -Dystrophy of the great toenails -Syndactyly of the second and third left toes -Lacrimal duct obstruction since birth -Loss of eyebrows and eyelashes beginning at age 2 years -History of blisters on anterior shins following minor trauma since age 12 years -Recurrent episodes of urinary retention due to severe strictures of bulbar urethra, requiring urethroplasties -**Signs:** -Absent eyebrows and eyelashes -Erythematous atrophic patches on anterior shins -Confined collections of milia -Syndactyly of second and third left toes -Dystrophic great toenails -**Tests:** -Laboratory Tests: Normal blood creatinine levels, normal urinalysis, normal pulmonary function tests -Skin Biopsy Findings: Subepidermal split with collagen IV staining, sublaminadensablister with discontinuous basement membrane -Immunofluorescence Studies: Integrin Îą3: Mislocalizedand lower-intensity staining, Integrin β1: Normal expression, Collagen XVII: Normal expression -Genetic Testing: Homozygous variant c.821G>A (p.R274Q) in ITGA3 gene ### Step 2 -Generate pattern: The patient presents with a combination of skin and mucosal findings characteristic of a junctional epidermolysis bullosa (JEB). The presence of syndactyly and lacrimal duct obstruction suggests a genetic condition. The genetic testing identified a homozygous variant in the ITGA3 gene, which is consistent with integrin Îą3 deficiency. ### Step 3 -Test each option: -**Option A: Junctional epidermolysis bullosa due to ITGA3 mutation** -**Does it match?** Yes, the genetic variant c.821G>A (p.R274Q) in ITGA3 is consistent with this diagnosis. -**Why/why not?** The clinical features (skin blisters, syndactyly, and lacrimal duct obstruction) and genetic findings are consistent with this diagnosis. -**Option B: Junctional Epidermolysis Bullosa with renal and respiratory involvement (junctional EB-R), skin and mucosa-limited variant** -**Does it match?** No, the patient does not have renal or respiratory involvement. -**Why/why not?** The patient's clinical features and genetic findings do not support this diagnosis. -**Option C: Junctional Epidermolysis Bullosa (JEB) âNon-HerlitzType** -**Does it match?** Yes, the patient has skin blisters, syndactyly, and lacrimal duct obstruction, which are consistent with JEB. -**Why/why not?** However, the specific genetic mutation in ITGA3 is more specific and aligns with integrin Îą3 deficiency. -**Option D: Junctional epidermolysis bullosa (integrin Îą3 deficiency)** -**Does it match?** Yes, the patient has the specific genetic mutation in ITGA3 and the clinical features are consistent with this diagnosis. -**Why/why not?** This is the most specific and accurate diagnosis based on the genetic findings. ### Step 4 -Select best fit: The option that explains ALL findings, with the fewest assumptions is the one that includes the specific genetic mutation and the clinical features. **Answer: D** Correct Answer: B Fig. 11. Illustrative examples. The upper panel displays our response, while the lower panel shows the response generated by T. For visual clarity, we use placeholders for the questions and few-shot examples. trajectory. 1235 0.410 0.415 0.420 0.425 0.430 ROUGE-L 0.425 0.430 0.435 0.440 0.445 0.450 SARI (a) Top-K Retrieval 10152545 0.38 0.39 0.40 0.41 0.42 0.43 ROUGE-L 0.420 0.425 0.430 0.435 0.440 0.445 0.450 SARI (b) Window Size. 1236 0.395 0.400 0.405 0.410 0.415 0.420 0.425 0.430 ROUGE-L 0.420 0.425 0.430 0.435 0.440 0.445 0.450 SARI (c) Entropy Threshold. Fig. 12. Hyper-parameter tests. Here, we take eLife as an example. H. Hyperparameter Analysis To elucidate the underlying behavior of the DSC, we explore its sensitivity to pivotal hyperparameters. We show the tuning results for eLife. Top-K Retrieval K. The parameter K in Eq. 7 dictates the length of the retrieved context C, thereby controlling the total amount of raw evidence exposed to the LLM. A small K may lead to insufficient evidence for complex inference, while an overly large K exacerbates the issues of semantic noise and redundancy, placing an undue burden on the Semantic Calibration Stream. This is further evidenced by Fig. 12(a), where performance exhibits a consistent upward trend for K â [1, 3] before undergoing a slight degradation when K > 4. Therefore, we select the optimal context size K = 3. Window Size N short . N short is crucial for the dynamic entropy detection strategy in Eq. 8. A very small N short (e.g., 10 or 15) makes the detector highly reactive to immediate fluctuations, potentially triggering intervention prematurely on naturally X13 complex tokens. Conversely, a very large N short smooths out local spikes, causing the detector to miss subtle, but critical, semantic shifts. As depicted in Fig. 12(b), we fix the short- window size at N short = 25, where the model achieves its peak performance. Entropy Threshold Ď . The hyperparameter Ď also defines the sensitivity of the entropy intervention by setting the dynamic entropy thresholds relative to the standard deviation (Ď). Based on the analysis in Fig. 12(c), the optimal balance is achieved at Ď = 3, indicating that a local spike must be significantly anomalous (3Ď) to trigger optimization. In contrast, a lax threshold (e.g., 1.0Ď) not only substantially prolongs the optimization process but also introduces noise that disrupts the modelâs coherent reasoning trajectory. Consequently, we set Ď = 3 as the default. VI. CONCLUSION In this paper, we introduce DSC, a novel test-time training framework that liberates LLMs from the constraint of passive contextual exposure. By transcending the limitations of both training-based and test-time tuning-free methods, DSC imple- ments active, independent adaptation at the inference stage. We also specifically address the objective-task mismatch of current test-time tuning through a dual-stream architecture: the Semantic Calibration Stream utilizes a dynamic entropy de- tection strategy to eliminate the high-uncertainty void caused by indiscriminate optimization, while the Structure Calibration Stream replaces flat token sequences with a navigable map for logical deduction via meta-learning. Critically, DSC achieves this precision by optimizing lightweight correction vectors, preserving the modelâs linguistic integrity while maintaining the low latency essential for real-time clinical support. Future efforts will focus on integrating domain-specific ontologies and exploring cross-stream synergy to further maximize adap- tive capacity in complex, out-of-distribution clinical scenarios. REFERENCES [1] G. Wang and X. Liu, âMedical large language model for diagnostic reasoning across specialties,â p. 743â744, 2025. [2] K. Singhal, T. Tu, J. Gottweis, R. Sayres, E. Wulczyn, M. Amin, L. Hou, K. Clark, S. R. Pfohl, H. Cole-Lewis et al., âToward expert- level medical question answering with large language models,â Nature Medicine, vol. 31, no. 3, p. 943â950, 2025. [3] Y. Zhu, Z. Huang, L. Mu, Y. Huang, W. Nie, J. Liu, S. Zhang, P. Liu, and X. Zhang, âDiagnosisarena: Benchmarking diagnostic reasoning for large language models,â CoRR, vol. abs/2505.14107, 2025. [4] C. Zhao, H. Tang, H. Zhao, and X. Li, âDiffmv: A unified diffusion framework for healthcare predictions with random missing views and view laziness,â in SIGKDD. ACM, 2025, p. 3933â3944. [5] L. Wu, Z. Zheng, Z. Qiu, H. Wang, H. Gu, T. Shen, C. Qin, C. Zhu, H. Zhu, Q. Liu et al., âA survey on large language models for recommendation,â World Wide Web, vol. 27, no. 5, p. 60, 2024. [6] DeepSeek-AI, âDeepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning,â CoRR, vol. abs/2501.12948, 2025. [7] A. Yang, B. Yang et al., âQwen2.5 technical report,â CoRR, vol. abs/2412.15115, 2024. [8] L. Team, W. Xu, H. P. Chan, L. Li, M. Aljunied, R. Yuan, J. Wang, C. Xiao, G. Chen, C. Liu, Z. Li, Y. Sun, J. Shen, C. Wang, J. Tan, D. Zhao, T. Xu, H. Zhang, and Y. Rong, âLingshu: A generalist foundation model for unified multimodal medical understanding and reasoning,â CoRR, vol. abs/2506.07044, 2025. [9] A. Pareja, N. S. Nayak, H. Wang, K. Killamsetty, S. Sudalairaj, W. Zhao, S. Han, A. Bhandwaldar, G. Xu, K. Xu, L. Han, L. Inglis, and A. Srivastava, âUnveiling the secret recipe: A guide for supervised fine- tuning small llms,â in ICLR. OpenReview.net, 2025. [10] G. Dong, H. Yuan, K. Lu, C. Li, M. Xue, D. Liu, W. Wang, Z. Yuan, C. Zhou, and J. Zhou, âHow abilities in large language models are af- fected by supervised fine-tuning data composition,â in ACL. Association for Computational Linguistics, 2024, p. 177â198. [11] Z. Shao, P. Wang, Q. Zhu, R. Xu, J. Song, M. Zhang, Y. K. Li, Y. Wu, and D. Guo, âDeepseekmath: Pushing the limits of mathematical reasoning in open language models,â CoRR, vol. abs/2402.03300, 2024. [12] Y. Yue, Z. Chen, R. Lu, A. Zhao, Z. Wang, Y. Yue, S. Song, and G. Huang, âDoes reinforcement learning really incentivize reasoning capacity in llms beyond the base model?â CoRR, vol. abs/2504.13837, 2025. [13] R. Xu and K. Ding, âLarge language models for anomaly and out-of- distribution detection: A survey,â in NAACL, 2025, p. 5992â6012. [14] H. Chung, T. Hsiao, H. Huang, C. Cho, J. Lin, Z. Ziwei, and Y. Chen, âRevisiting test-time scaling: A survey and a diversity-aware method for efficient reasoning,â CoRR, vol. abs/2506.04611, 2025. [15] Z. Guo, L. Xia, Y. Yu, T. Ao, and C. Huang, âLightrag: Simple and fast retrieval-augmented generation,â CoRR, vol. abs/2410.05779, 2024. [16] Y. Zhu, Z. He, H. Hu, X. Zheng, X. Zhang, Z. Wang, J. Gao, L. Ma, and L. Yu, âMedagentboard: Benchmarking multi-agent collaboration with conventional methods for diverse medical tasks,â CoRR, vol. abs/2505.12371, 2025. [17] Q. Dong, L. Li, D. Dai, C. Zheng, J. Ma, R. Li, H. Xia, J. Xu, Z. Wu, B. Chang, X. Sun, L. Li, and Z. Sui, âA survey on in-context learning,â in EMNLP. Association for Computational Linguistics, 2024, p. 1107â 1128. [18] J. Li, W. Liu, Z. Ding, W. Fan, Y. Li, and Q. Li, âLarge language models are in-context molecule learners,â IEEE Trans. Knowl. Data Eng., vol. 37, no. 7, p. 4131â4143, 2025. [19] J. Wei, X. Wang, D. Schuurmans, M. Bosma, B. Ichter, F. Xia, E. H. Chi, Q. V. Le, and D. Zhou, âChain-of-thought prompting elicits reasoning in large language models,â in NeurIPS, 2022. [20] Y. Kim, C. Park, H. Jeong, Y. S. Chan, X. Xu, D. McDuff, H. Lee, M. Ghassemi, C. Breazeal, and H. W. Park, âMdagents: An adaptive collaboration of llms for medical decision-making,â in NeurIPS, 2024. [21] X. Tang, A. Zou, Z. Zhang, Z. Li, Y. Zhao, X. Zhang, A. Cohan, and M. Gerstein, âMedagents: Large language models as collaborators for zero-shot medical reasoning,â in ACL.Association for Computational Linguistics, 2024, p. 599â621. [22] E. Aky Ě urek, M. Damani, A. Zweiger, L. Qiu, H. Guo, J. Pari, Y. Kim, and J. Andreas, âThe surprising effectiveness of test-time training for few-shot learning,â in ICML. OpenReview.net, 2025. [23] Y. Hu, X. Zhang, X. Fang, Z. Chen, X. Wang, H. Zhang, and G. Qi, âSLOT: sample-specific language model optimization at test-time,â CoRR, vol. abs/2505.12392, 2025. [24] Y. Zhu, Z. He, H. Hu, X. Zheng, X. Zhang, Z. Wang, J. Gao, L. Ma, and L. Yu, âMedagentboard: Benchmarking multi-agent collaboration with conventional methods for diverse medical tasks,â CoRR, vol. abs/2505.12371, 2025. [25] C. Zhao, H. Tang, J. Zhang, and X. Li, âUnveiling discrete clues: Superior healthcare predictions for rare diseases,â in W.ACM, 2025, p. 1747â1758. [26] J. Liu, Z. Huang, Q. Liu, Z. Ma, C. Zhai, and E. Chen, âKnowledge- centered dual-process reasoning for math word problems with large language models,â IEEE Trans. Knowl. Data Eng., vol. 37, no. 6, p. 3457â3471, 2025. [27] C. Zhao, H. Zhao, X. Zhou, and X. Li, âEnhancing precision drug recommendations via in-depth exploration of motif relationships,â IEEE Trans. Knowl. Data Eng., vol. 36, no. 12, p. 8164â8178, 2024. [28] C. Zhao, H. Tang, H. Zhao, and X. Li, âBeyond sequential patterns: Rethinking healthcare predictions with contextual insights,â ACM Trans. Inf. Syst., vol. 43, no. 4, p. 107:1â107:32, 2025. [29] W. Liao, T. Wang, Y. Zhu, Y. Wang, J. Gao, and L. Ma, âMagical: Medical lay language generation via semantic invariance and layperson- tailored adaptation,â NeurIPS, 2025. [30] Q. Zheng, Y. Sun, C. Wu, W. Zhao, P. Qiu, Y. Yu, K. Sun, Y. Wang, Y. Zhang, and W. Xie, âEnd-to-end agentic RAG system training for traceable diagnostic reasoning,â CoRR, vol. abs/2508.15746, 2025. [31] G. Xiong, Q. Jin, X. Wang, M. Zhang, Z. Lu, and A. Zhang, âImproving retrieval-augmented generation in medicine with iterative follow-up questions,â Pacific Symposium on Biocomputing (PSB), vol. 30, p. 199â 214, 2025. [32] D. Fang, J. Qiang, X. Ouyang, Y. Zhu, Y. Yuan, and Y. Li, âCollabo- rative document simplification using multi-agent systems,â in COLING. Association for Computational Linguistics, 2025, p. 897â912. X14 [33] J. Wu, F. Tang, Y. Li, M. Hu, H. Xue, S. Jameel, Y. Xie, and I. Raz- zak, âTAGS: A test-time generalist-specialist framework with retrieval- augmented reasoning and verification,â CoRR, vol. abs/2505.18283, 2025. [34] Z. Wang, Y. Zhu, H. Zhao, X. Zheng, D. Sui, T. Wang, W. Tang, Y. Wang, E. M. Harrison, C. Pan, J. Gao, and L. Ma, âColacare: Enhancing electronic health record modeling through large language model-driven multi-agent collaboration,â in W.ACM, 2025, p. 2250â2261. [35] X. Yang, Y. Wang, J. Chen, W. Fan, X. Zhao, E. Zhu, X. Liu, and D. Lian, âDual test-time training for out-of-distribution recommender system,â IEEE Trans. Knowl. Data Eng., vol. 37, no. 6, p. 3312â3326, 2025. [36] J. Hu, Z. Zhang, G. Chen, X. Wen, C. Shuai, W. Luo, B. Xiao, Y. Li, and M. Tan, âTest-time learning for large language models,â in ICML. OpenReview.net, 2025. [37] J. Mu, Q. Zhang, Z. Wang, M. Yang, S. Qiu, C. Qin, Z. Dai, and Y. Shu, âSelf-reflective generation at test time,â CoRR, vol. abs/2510.02919, 2025. [38] Q. Zhang, F. Lyu, Z. Sun, L. Wang, W. Zhang, Z. Guo, Y. Wang, I. King, X. Liu, and C. Ma, âWhat, how, where, and how well? A survey on test-time scaling in large language models,â CoRR, vol. abs/2503.24235, 2025. [39] S. Yao, D. Yu, J. Zhao, I. Shafran, T. Griffiths, Y. Cao, and K. Narasimhan, âTree of thoughts: Deliberate problem solving with large language models,â in NeurIPS, 2023. [40] H. Mao, G. Liu, Y. Ma, R. Wang, K. M. Johnson, and J. Tang, âA survey to recent progress towards understanding in-context learning,â in NAACL.Association for Computational Linguistics, 2025, p. 7302â 7323. [41] X. Lyu, S. Min, I. Beltagy, L. Zettlemoyer, and H. Hajishirzi, âZ- ICL: zero-shot in-context learning with pseudo-demonstrations,â in ACL. Association for Computational Linguistics, 2023, p. 2304â2317. [42] Q. Jin, W. Kim, Q. Chen, D. C. Comeau, L. Yeganova, W. J. Wilbur, and Z. Lu, âMedcpt: Contrastive pre-trained transformers with large-scale pubmed search logs for zero-shot biomedical information retrieval,â Bioinform., vol. 39, no. 10, 2023. [43] M. Tan, G. Chen, J. Wu, Y. Zhang, Y. Chen, P. Zhao, and S. Niu, âUncertainty-calibrated test-time model adaptation without forgetting,â IEEE Trans. Pattern Anal. Mach. Intell., vol. 47, no. 8, p. 6274â6289, 2025. [44] M. R. Ebrahimi, J. Chen, and A. Khisti, âMinimum entropy coupling with bottleneck,â in NeurIPS, 2024. [45] J. Chen, X. Wu, Y. Li, Q. Li, L. Zhan, and F. Chung, âA closer look at the training strategy for modern meta-learning,â in NeurIPS, 2020. [46] S. Min, M. Lewis, L. Zettlemoyer, and H. Hajishirzi, âMetaicl: Learning to learn in context,â in NAACL.Association for Computational Linguistics, 2022, p. 2791â2809. [47] H. Gharoun, F. Momenifar, F. Chen, and A. H. Gandomi, âMeta-learning approaches for few-shot learning: A survey of recent advances,â ACM Comput. Surv., vol. 56, no. 12, p. 294:1â294:41, 2024. [48] D. Jin, E. Pan, N. Oufattole, W. Weng, H. Fang, and P. Szolovits, âWhat disease does this patient have? A large-scale open domain question answering dataset from medical exams,â CoRR, vol. abs/2009.13081, 2020. [49] Q. Jin, B. Dhingra, Z. Liu, W. W. Cohen, and X. Lu, âPubmedqa: A dataset for biomedical research question answering,â in EMNLP. Association for Computational Linguistics, 2019, p. 2567â2577. [50] A. Pal, L. K. Umapathi, and M. Sankarasubbu, âMedmcqa: A large- scale multi-subject multi-choice dataset for medical domain question answering,â in Conference on Health, Inference, and Learning, CHIL 2022, 7-8 April 2022, Virtual Event, ser. Proceedings of Machine Learning Research, vol. 174. PMLR, 2022, p. 248â260. [51] H. Chen, Z. Fang, Y. Singla, and M. Dredze, âBenchmarking large language models on answering and explaining challenging medical questions,â in NAACL.Association for Computational Linguistics, 2025, p. 3563â3599. [52] D. Hendrycks, C. Burns, S. Basart, A. Zou, M. Mazeika, D. Song, and J. Steinhardt, âMeasuring massive multitask language understanding,â in ICLR. OpenReview.net, 2021. [53] Y. Wang, X. Ma, G. Zhang, Y. Ni, A. Chandra, S. Guo, W. Ren, A. Arulraj, X. He, Z. Jiang, T. Li, M. Ku, K. Wang, A. Zhuang, R. Fan, X. Yue, and W. Chen, âMmlu-pro: A more robust and challenging multi- task language understanding benchmark,â in NeurIPS, 2024. [54] Y. Kim, J. Wu, Y. Abdulle, and H. Wu, âMedexqa: Medical ques- tion answering benchmark with multiple explanations,â in Proceedings of the 23rd Workshop on Biomedical Natural Language Processing, BioNLP@ACL 2024, Bangkok, Thailand, August 16, 2024. Association for Computational Linguistics, 2024, p. 167â181. [55] T. Goldsack, Z. Zhang, C. Lin, and C. Scarton, âMaking science simple: Corpora for the lay summarisation of scientific literature,â in EMNLP. Association for Computational Linguistics, 2022, p. 10 589â10 604. [56] A. Devaraj, I. J. Marshall, B. C. Wallace, and J. J. Li, âParagraph- level simplification of medical texts,â in NAACL.Association for Computational Linguistics, 2021, p. 4972â4984. [57] G. Wang, J. Ran, R. Tang, C. Chang, Y. Chuang, Z. Liu, V. Braverman, Z. Liu, and X. Hu, âAssessing and enhancing large language models in rare disease question-answering,â CoRR, vol. abs/2408.08422, 2024. [58] S. S. Li, V. Balachandran, S. Feng, J. Ilgen, E. Pierson, P. W. W. Koh, and Y. Tsvetkov, âMediq: Question-asking llms and a benchmark for reliable interactive clinical reasoning,â in NeurIPS, 2024. [59] X. Tang, D. Shao, J. Sohn, J. Chen, J. Zhang, J. Xiang, F. Wu, Y. Zhao, C. Wu, W. Shi, A. Cohan, and M. Gerstein, âMedagentsbench: Benchmarking thinking models and agent frameworks for complex medical reasoning,â CoRR, vol. abs/2503.07459, 2025. [60] Q. Team, âQwen3 technical report,â CoRR, vol. abs/2505.09388, 2025. [61] L. Chen, J. Q. Davis, B. Hanin, P. Bailis, I. Stoica, M. A. Zaharia, and J. Y. Zou, âAre more LLM calls all you need? towards the scaling properties of compound AI systems,â in NeurIPS, 2024. [62] L. Wang, N. Yang, X. Huang, L. Yang, R. Majumder, and F. Wei, âMultilingual E5 text embeddings: A technical report,â CoRR, vol. abs/2402.05672, 2024. [63] M. Douze, A. Guzhva, C. Deng, J. Johnson, G. Szilvasy, P.-E. Mazar Ě e, M. Lomeli, L. Hosseini, and H. J Ě egou, âThe faiss library,â IEEE Transactions on Big Data, 2025. [64] R. Xu, W. Shi, Y. Yu, Y. Zhuang, Y. Zhu, M. D. Wang, J. C. Ho, C. Zhang, and C. Yang, âBmretriever: Tuning large language models as better biomedical text retrievers,â in EMNLP.Association for Computational Linguistics, 2024, p. 22 234â22 254. [65] O. Shorinwa, Z. Mei, J. Lidard, A. Z. Ren, and A. Majumdar, âA survey on uncertainty quantification of large language models: Taxonomy, open research challenges, and future directions,â ACM Computing Surveys, 2025. [66] W. Yu, Z. Jiang, Y. Dong, and J. Feng, âReclor: A reading comprehen- sion dataset requiring logical reasoning,â in ICLR.OpenReview.net, 2020. [67] J. Liu, L. Cui, H. Liu, D. Huang, Y. Wang, and Y. Zhang, âLogiqa: A challenge dataset for machine reading comprehension with logical reasoning,â in IJCAI. ijcai.org, 2020, p. 3622â3628.