Neuro-Oracle: A Trajectory-Aware Agentic RAG Framework for Interpretable Epilepsy Surgical Prognosis
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.
Tom: We're looking at the paper: "Neuro-Oracle: A Trajectory-Aware Agentic RAG Framework for Interpretable Epilepsy Surgical Prognosis".
Jane: Here's the gist of the paper. Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge where conventional deeplearning approaches operate on static, single-timepoint pre-operative scans, omitting longitudinal morphological changes The Neuro-Oracle framework proposes a three-stage system that distills pre-to-post-operative MRI changes into a compact trajectory vector, retrieves historically similar surgical trajectories from an archive, and synthesizes a natural language prognosis using a quantized reasoning agent Framework Overview The Neuro-Oracle framework is designed to address the limitations of static single-scan classifiers by incorporating longitudinal morphological changes into the prediction process The system operates in three distinct phases: (i) distills pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder, (ii) retrieves historically similar surgical trajectories from a population archive via nearest-neighbour search, and (iii) synthesises a naturallanguage prognosis grounded in the retrieved evidence using a quantized Llama-3-8B reasoning agent How the training signal is built Phase 1 focuses on Contrastive Trajectory Encoding, where a 3D Siamese contrastive encoder shares weights between two temporal branches to encode the morphological delta Each scan pair is encoded independently by the shared backbone, and the difference vector is projected to a 512-dimensional space to produce the trajectory vector The encoder is jointly trained with two complementary loss terms: Supervised Contrastive loss (LSupCon) and Focal Loss (LFocal) The training objective utilizes these losses to encourage trajectory vectors from the same surgical-outcome class to have high inner product Where the gains come from The performance gains are derived from leveraging longitudinal data and retrieval-augmented generation, which together provide a more robust prognostic tool than static methods The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0.867) while producing structured justifications with zero observed hallucinations under the audit protocol Ablation studies confirm that longitudinal trajectories and agentic reasoning individually and jointly improve performance over the single-scan k-NN baseline The age-gap filter improves the coherence of the LLM’s reasoning chain rather than the aggregate discriminative score Limitations and context The evaluation is conducted on the public EPISURG dataset (N=268 longitudinally paired cases) using five-fold stratified crossvalidation Since ground-truth seizure-freedom scores are unavailable, a clinical proxy label based on resection type is utilized, acknowledging that the network representations may potentially learn the anatomical features of the resection cavities rather than true prognostic morphometry The cohort size (N=268) prevents computing confidence intervals narrow enough to make strong statistical claims about pairwise method differences Furthermore, all results must be strictly understood as performance on this proxy classification task Neuro-Oracle presents a framework for epilepsy surgical prognosis that encodes the longitudinal pre-to-postoperative MRI change into a compact trajectory vector and grounds a calibrated verdict in historically similar retrieved cases via a quantized LLM reasoning agent Trajectory-based methods consistently outperform the single-timepoint baseline in sensitivity, with the Siamese Diversity Ensemble attaining the highest AUC (0.905) Neuro-Oracle matches the performance of geometric baseline classifiers while uniquely providing auditable natural-language justifications The framework demonstrates that each pipeline stage contributes meaningfully to both quantitative and qualitative outcomes The zero-hallucination rate is a direct consequence of the structured prompt design, aligning with findings in RetrievalAugmented Generation literature The cohort size (N=268) prevents computing confidence intervals narrow enough to make strong statistical claims about pairwise method differences The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0.867) while producing structured justifications with zero observed hallucinations under our audit protocol Page 1 --- Neuro-Oracle: A Trajectory-Aware Agentic RAG Framework for Interpretable Epilepsy Surgical Prognosis Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge where conventional deeplearning approaches operate on static, single-timepoint pre-operative scans, omitting longitudinal morphological changes We propose Neuro-Oracle, a three-stage framework that (i) distils pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder; (ii) retrieves historically similar surgical trajectories from a population archive via nearest-neighbour search; and (iii) synthesises a naturallanguage prognosis grounded in the retrieved evidence using a quantized Llama-3-8B reasoning agent Evaluations are conducted on the public EPISURG dataset (N=268 longitudinally paired cases) using five-fold stratified crossvalidation Since ground-truth seizure-freedom scores are unavailable, we utilize a clinical proxy label based on the resection type We acknowledge that the network representations may potentially learn the anatomical features of the resection cavities (i.e., temporal versus non-temporal locations) rather than true prognostic morphometry Our current evaluation thus serves mainly as a proof-of-concept for the trajectory-aware retrieval architecture Trajectorybased classifiers achieve AUC values between 0.834 and 0.905, compared with 0.793 for a single-timepoint ResNet50 baseline The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0.867) while producing structured justifications with zero observed hallucinations under our audit protocol Page 2 --- Every component relies exclusively on public-domain datasets and open-source tooling, ensuring reproducibility We use EPISURG
21: , a public collection of T1-weighted MRIs from epilepsy surgery patients, for all our experiments in this paper (Section 3) The remainder of the paper reviews related work (Section 2), describes the dataset and preprocessing (Section 3), develops the methodology (Section 4), and presents results (Section 6) followed by discussion and limitations (Section 7) Page 3 --- EPISURG.
Tom: The primary dataset we use in this work is EPISURG
21: , which contains 430 T1-weighted MRI scans from epilepsy surgery patients, out of which 268 possess both a pre-operative scan Xt0 and a post-operative scan Xt1 The public data release provides paired NIfTI volumes alongside a metadata file recording each subject’s surgery type, hemisphere, and a pre-operative quality flag; readers can find further dataset details in the original publication
21: Per-patient Engel seizure-freedom scores are not included in the public release Because ground-truth seizure-freedom outcomes are unavailable, we assign a binary proxy label derived from surgery type according to the published literature on outcome rates by surgery category Temporal resections (including lobectomy, lesionectomy, and multilobar temporal resections) are labelled y=0 (favourable outcome proxy, cited seizure-freedom rate 65–70% at two years) and purely extra-temporal, frontal, parietal, occipital resections, and hemispherectomy are labelled y=1 (lessfavourable outcome proxy, cited rate 40–55%) This proxy is a clinically grounded but imperfect approximation Because the model distinguishes temporal from non-temporal procedures using post-operative scans, the encoder may primarily learn the anatomical features of temporal lobectomy cavities rather than subtle epileptogenic pathology Consequently, the proxy introduces a major vulnerability where the model predicts surgery type instead of true seizure outcome All results must therefore be strictly understood as performance on this proxy classification task Page 4 --- After preprocessing quality filtering, 268 subjects are retained: 215 with proxy label y=0 and 53 with y=1, yielding a case-to-control ratio of approximately 4:1 While onthe-fly random augmentations are applied during training to prevent overfitting (detailed in Section 4.1), no offline augmented or synthetic subject records are added to the overall dataset count Preprocessing pipeline.
Jane: Accurate trajectory encoding depends on geometric alignment between timepoints Each pre-operative volume Xt0 and its corresponding postoperative volume Xt1 are read via ANTsPy
1: The post-operative scan is rigidly registered (6 degrees of freedom: three translations and three rotations) into the physical space of the pre-operative scan: Xreg t1 = Trigid(Xt1; Xt0), (1) where Trigid is the optimal rigid (6-DOF) alignment mapping Xt1 into the coordinate space of Xt0 Deformable registration is deliberately avoided, as non-linear warping would smooth the localised volume changes targeted by prediction Both volumes are then z-score normalised per-volume over brain voxels exceeding the per-volume mean intensity (a simple threshold mask sufficient for wellnormalised T1w acquisitions), and are centre-cropped or symmetrically zero-padded to a uniform 128 × 128 × 128 voxel grid at 1 × 1 × 1 mm3 isotropic resolution Processed volumes are saved as NIfTI files with an identity affine All 268 subjects passed quality control and were carried forward to the experimental pipeline Page 5 --- We formulate the prognosis task as follows: given the aligned scan pair (Xt0, Xreg t1) and the surgery-type proxy label y ∈
0, 1: , learn a representation of the longitudinal change that separates the two outcome classes The pipeline proceeds in three phases that can be trained and deployed independently (see Figure 1) Phase 1: Contrastive Trajectory Encoding A 3D Siamese contrastive encoder shares weights between the two temporal branches
6: The backbone fθ is a MONAI
4: 3D ResNet-50
13: (bottleneck blocks, layers
3, 4, 6, 3: , channel widths
64, 128, 256, 512: , singlechannel input) initialised from scratch Each scan pair is encoded independently by the shared backbone: vt0 = fθ(Xt0), vt1 = fθ(Xreg t1) (2) The difference vector vt1 − vt0 is projected to a 512-dimensional space by an MLP head and l2-normalised to produce the trajectory vector: ∆v = l2-norm(MLP(vt1 − vt0)) ∈ R 512, (3) The training objective is L = 1/2 LSupCon + 1/2 LFocal The Supervised Contrastive loss encourages trajectory vectors from the same surgical-outcome class to have high inner product and those from different classes to be mutually repulsive The Focal Loss term addresses the 4:1 class imbalance (Nneg/Npos ≈ 4) by down-weighting correctly classified easy examples Page 6 --- To increase effective variance with only 268 subjects, training-time 3D data augmentation applies random axis flipping (p=0.5 per axis), additive Gaussian noise (σ ∼ U
0.02, 0.08: ), and random intensity scaling (factor ∼ U
0.85, 1.15: ) to both temporal scans simultaneously The encoder is trained for 50 epochs with AdamW
20: (η=10−4, weight decay 10−4) and CosineAnnealingLR (Tmax=50) A three-layer classification head (512 → 256 → 128 → 1) is attached to ∆v exclusively during training and discarded at inference Page 7 --- To increase effective variance with only 268 subjects, training-time 3D data augmentation applies random axis flipping (p=0.5 per axis), additive Gaussian noise (σ ∼ U
0.02, 0.08: ), and random intensity scaling (factor ∼ U
0.85, 1.15: ) to both temporal scans simultaneously Augmentations are not applied during inference Page 8 --- Upon completing training, the encoder backbone and MLP head are frozen A Population Archive D = (∆vi, yi, Ci) Ntrain i=1 is constructed by forward-passing all training subjects through the frozen encoder and indexing their 512-dimensional unit-norm trajectory vectors in a FAISS exact inner-product index (IndexFlatIP)
15: Because ∆v vectors are l2-normalised, the inner product is mathematically equivalent to cosine similarity, enabling exact nearest-neighbour retrieval Algorithm 1 Neuro-Oracle Inference Pipeline (M5) Require: Query (∆vq, Cq), frozen archive D, LLM agent A A δ = 15 yr, k = 5 Nk ← FAISS Search(∆vq, D, k) Pyi (neighbor outcomes) pneighbor ← 1 k Pyi (neighbor outcomes) Build prompt with Cq and Nk (age/sex/outcome); append: “Mentally filter out matches with age gap > δ” s ← A(prompt) pLLM ← 0.20 if parse(s) = SUCCESS else 0.80 qp ← 0.60 · pneighbor + 0.40 · pLLM yˆq ← 1
pq > 0.5: return yˆq, justification s Page 9 --- For a query subject q, the top-k most similar archived trajectories are retrieved: Nk(q) = top-k i∈D ∆vq · ∆vi, k=5 Page 10 --- Table 1.
Tom: Epilepsy surgical prognosis on EPISURG (N=268, 5-fold stratified CV).
Title and authors: Tom: We’re diving into the title and the authors of Neuro-Oracle: A Trajectory-Aware Agentic RAG Framework for Interpretable Epilepsy Surgical Prognosis. This paper is tackling epilepsy surgery outcome prediction by focusing on these longitudinal changes in MRI scans, moving beyond just a single static scan.
Jane: And the authors are Aizierjiang Aiersilan Q Mohamad Koubeissi from The George Washington University. They’re proposing this three stage framework that involves encoding the change into a trajectory vector, retrieving similar cases, and then using an agent to make a prognosis.
Lu: What's interesting about their setup is that they are not just building one classifier; they are creating a whole system where each component feeds into the next to build that final natural language prognosis.
Meng: I'm curious about the data setup here. They use the public EPISURG dataset, which has two hundred sixty eight longitudinally paired cases, but they have to be careful because of how they label the outcomes.
Tom: Yeah, because ground truth seizure-freedom scores aren't available in that public release, so they use a clinical proxy label based on surgery type instead.
Jane: They label temporal resections, like lobectomy or lesionectomy, as favourable outcome proxy y equals zero because they cite seizure freedom rates of sixty five to seventy percent at two years.
Lu: And purely extra temporal procedures like frontal or hemispherectomies are labeled y equals one because the literature cites a rate of forty to fifty-five percent for those.
The paper's summary: Tom: To summarize the Neuro-Oracle framework, it’s a three stage system that first distills pre-to-postoperative MRI changes into a compact five hundred twelve dimensional trajectory vector using that Siamese contrastive encoder.
Jane: Then, it takes that vector and uses nearest neighbour search to pull in historically similar surgical trajectories from their archive. And finally, they use a quantized Llama three eight billion reasoning agent to synthesize a natural language prognosis based on all that evidence they retrieved.
Lu: The paper emphasizes that this method improves upon static single timepoint classifiers by incorporating the longitudinal morphological changes directly into the prediction process itself.
Meng: But there’s a big caveat in their summary about the data, which is important for us to hear. They admit that because they use those surgery type labels, the network might actually be learning the anatomical features of temporal lobectomy cavities instead of truly learning what causes seizures.
Tom: That’s a major vulnerability they point out, meaning it predicts the surgery type rather than the true seizure outcome, so we have to keep that in mind for any deployment.
Jane: It’s a reminder that even with this sophisticated trajectory encoding, the proxy label introduces an imperfect approximation of true prognostic morphometry.
The paper's improvements: Tom: So what are the actual performance gains they are showing? They say that trajectory-based classifiers achieve AUC values between zero point eight hundred thirty-four and zero point nine hundred five which is a significant jump compared to the zero point seven nine three score for a single timepoint Resnet five hundred baseline.
Jane: And they also mention the Neuro-Oracle agent M five matches the AUC of purely discriminative trajectory classifiers at zero point eight hundred sixty-seven while still producing those structured justifications with zero observed hallucinations under their audit protocol.
Lu: The ablation studies confirm that both longitudinal trajectories and the agentic reasoning individually and together improve performance over that single timepoint k nearest neighbour baseline.
Meng: But they also showed how using decision thresholds, like an optimized threshold of zero point thirty-four for Neuro-Oracle M five, can maximize balanced accuracy by trading sensitivity for specificity and hitting a sensitivity of zero point six nine eight at that point.
Tom: That sounds like a practical tuning step; they aren't just relying on one single metric, but optimizing the trade off between catching true positives and minimizing false alarms.
Conclusion: Jane: So to wrap up this Neuro-Oracle paper, it’s about encoding the longitudinal pre-to-postoperative MRI change into a trajectory vector and grounding the verdict in historically similar cases using a quantized LLM agent.
Tom: It shows that trajectory-based methods consistently outperform the single timepoint baseline in sensitivity, with the Siamese Diversity Ensemble hitting an AUC of zero point nine hundred five.
Lu: And what they offer uniquely is providing auditable natural language justifications, which is a huge step toward making these prognostic tools more interpretable than a black box ensemble with an AUC of zero point eight hundred sixty-seven.
Meng: From my side, it’s good to see the performance match the geometric baseline classifiers while still getting that zero hallucination rate from the reasoning agent.
Lalam: I'm confident in this framework because when I look at all the literature, this approach of retrieval augmented generation is a proven way to structure answers based on retrieved evidence, and my certainty about its structured justification is high.
Jane: It’s clear that each stage of the Neuro-Oracle pipeline contributes meaningfully to both the quantitative performance and that qualitative outcome.
Tom: So, this paper gives us a solid framework for epilepsy surgical prognosis where we encode longitudinal change into a trajectory vector and ground it in retrieved evidence via an agent.
Jane: It’s a complex system, but the way they handle the complexity makes it much more transparent than older static methods.
Aizierjiang Aiersilan, Q Mohamad Koubeissi
The George Washington University
cs.MM, cs.AI, cs.CL, cs.CV, cs.GR, cs.LG
Submitted: 2026-04-10
Updated: 2026-04-10
Journal ref: Proceedings of the 2026 AAAI Fall Symposium Series, 10(1), 2026
DOI: 10.1609/aaaiss.v10i1.43540
License: http://creativecommons.org/licenses/by/4.0/
Importance score: 82/100
The gist: Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge where conventional deeplearning approaches operate on static…
Key concepts
- Trajectory Vector
- This is a compact mathematical representation (512 dimensions) of the morphological changes observed in a patient's MRI scan before and after surgery. It captures the unique path or 'trajectory' of brain tissue alterations, allowing the system to understand how specific anatomical changes relate to different surgical outcomes.
- Contrastive Trajectory Encoding
- This is a training method where two scans (pre- and post-) are processed by a shared neural network. The network learns to map these two scans into a 512D space such that the difference between them (the trajectory vector) is mathematically meaningful, encouraging similar outcomes to have close vectors.
- Quantized Llama-3 Agent
- This refers to using a smaller, optimized version of the Llama-3 Large Language Model for reasoning. It takes evidence from retrieved historical cases and uses structured prompts to synthesize a clear, natural language prognosis. This ensures the explanation is grounded in the data and avoids making up facts (hallucinations).
- Retrieval-Augmented Generation (RAG)
- This technique combines searching an archive of past data with a language model. Instead of relying only on what the model learned during training, the system searches for similar historical surgical trajectories and uses that retrieved evidence to inform and generate a specific prediction or justification.
Terminology
Summary
Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge where conventional deeplearning approaches operate on static, single-timepoint pre-operative scans, omitting longitudinal morphological changes The Neuro-Oracle framework proposes a three-stage system that distills pre-to-post-operative MRI changes into a compact trajectory vector, retrieves historically similar surgical trajectories from an archive, and synthesizes a natural language prognosis using a quantized reasoning agent
Framework Overview
The Neuro-Oracle framework is designed to address the limitations of static single-scan classifiers by incorporating longitudinal morphological changes into the prediction process The system operates in three distinct phases: (i) distills pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder, (ii) retrieves historically similar surgical trajectories from a population archive via nearest-neighbour search, and (iii) synthesises a naturallanguage prognosis grounded in the retrieved evidence using a quantized Llama-3-8B reasoning agent
How the training signal is built
Phase 1 focuses on Contrastive Trajectory Encoding, where a 3D Siamese contrastive encoder shares weights between two temporal branches to encode the morphological delta Each scan pair is encoded independently by the shared backbone, and the difference vector is projected to a 512-dimensional space to produce the trajectory vector The encoder is jointly trained with two complementary loss terms: Supervised Contrastive loss (LSupCon) and Focal Loss (LFocal) The training objective utilizes these losses to encourage trajectory vectors from the same surgical-outcome class to have high inner product
Where the gains come from
The performance gains are derived from leveraging longitudinal data and retrieval-augmented generation, which together provide a more robust prognostic tool than static methods The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0.867) while producing structured justifications with zero observed hallucinations under the audit protocol Ablation studies confirm that longitudinal trajectories and agentic reasoning individually and jointly improve performance over the single-scan k-NN baseline The age-gap filter improves the coherence of the LLM’s reasoning chain rather than the aggregate discriminative score
Limitations and context
The evaluation is conducted on the public EPISURG dataset (N=268 longitudinally paired cases) using five-fold stratified crossvalidation Since ground-truth seizure-freedom scores are unavailable, a clinical proxy label based on resection type is utilized, acknowledging that the network representations may potentially learn the anatomical features of the resection cavities rather than true prognostic morphometry The cohort size (N=268) prevents computing confidence intervals narrow enough to make strong statistical claims about pairwise method differences Furthermore, all results must be strictly understood as performance on this proxy classification task
Conclusion
Neuro-Oracle presents a framework for epilepsy surgical prognosis that encodes the longitudinal pre-to-postoperative MRI change into a compact trajectory vector and grounds a calibrated verdict in historically similar retrieved cases via a quantized LLM reasoning agent Trajectory-based methods consistently outperform the single-timepoint baseline in sensitivity, with the Siamese Diversity Ensemble attaining the highest AUC (0.905) Neuro-Oracle matches the performance of geometric baseline classifiers while uniquely providing auditable natural-language justifications The framework demonstrates that each pipeline stage contributes meaningfully to both quantitative and qualitative outcomes The zero-hallucination rate is a direct consequence of the structured prompt design, aligning with findings in RetrievalAugmented Generation literature The cohort size (N=268) prevents computing confidence intervals narrow enough to make strong statistical claims about pairwise method differences The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0. p. 7 Although it does not exceed
the pure discriminative power of the Siamese Diversity Ensemble, Neuro-Oracle matches the performance of geometric baseline classifiers while uniquely providing auditable
natural-language justifications. Ablation experiments confirm that each pipeline stage contributes meaningfully to
both quantitative and qualitative outcomes.Where the paper says it
--- Page 1 ---
Neuro-Oracle: A Trajectory-Aware Agentic RAG Framework for Interpretable Epilepsy Surgical Prognosis Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge where conventional deeplearning approaches operate on static, single-timepoint pre-operative scans, omitting longitudinal morphological changes We propose Neuro-Oracle, a three-stage framework that (i) distils pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder; (ii) retrieves historically similar surgical trajectories from a population archive via nearest-neighbour search; and (iii) synthesises a naturallanguage prognosis grounded in the retrieved evidence using a quantized Llama-3-8B reasoning agent Evaluations are conducted on the public EPISURG dataset (N=268 longitudinally paired cases) using five-fold stratified crossvalidation Since ground-truth seizure-freedom scores are unavailable, we utilize a clinical proxy label based on the resection type We acknowledge that the network representations may potentially learn the anatomical features of the resection cavities (i.e., temporal versus non-temporal locations) rather than true prognostic morphometry Our current evaluation thus serves mainly as a proof-of-concept for the trajectory-aware retrieval architecture Trajectorybased classifiers achieve AUC values between 0. p. 0 , temporal versus non-temporal locations) rather than true prognostic morphometry. Our current evaluation thus serves mainly as a proof-of-concept
for the trajectory-aware retrieval architecture. Trajectorybased classifiers achieve AUC values between 0. 905, compared with 0. 793 for a single-timepoint ResNet50 baseline. The Neuro-Oracle agent (M5) matches the
AUC of purely discriminative trajectory classifiers (0.Where the paper says it
Where the paper says it
Where the paper says it
--- Page 2 ---
Every component relies exclusively on public-domain datasets and open-source tooling, ensuring reproducibility We use EPISURG [21], a public collection of T1-weighted MRIs from epilepsy surgery patients, for all our experiments in this paper (Section 3) The remainder of the paper reviews related work (Section 2), describes the dataset and preprocessing (Section 3), develops the methodology (Section 4), and presents results (Section 6) followed by discussion and limitations (Section 7)
--- Page 3 ---
EPISURG. The primary dataset we use in this work is EPISURG [21], which contains 430 T1-weighted MRI scans from epilepsy surgery patients, out of which 268 possess both a pre-operative scan Xt0 and a post-operative scan Xt1 The public data release provides paired NIfTI volumes alongside a metadata file recording each subject’s surgery type, hemisphere, and a pre-operative quality flag; readers can find further dataset details in the original publication [21] Per-patient Engel seizure-freedom scores are not included in the public release Because ground-truth seizure-freedom outcomes are unavailable, we assign a binary proxy label derived from surgery type according to the published literature on outcome rates by surgery category Temporal resections (including lobectomy, lesionectomy, and multilobar temporal resections) are labelled y=0 (favourable outcome proxy, cited seizure-freedom rate 65–70% at two years) and purely extra-temporal, frontal, parietal, occipital resections, and hemispherectomy are labelled y=1 (lessfavourable outcome proxy, cited rate 40–55%) This proxy is a clinically grounded but imperfect approximation Because the model distinguishes temporal from non-temporal procedures using post-operative scans, the encoder may primarily learn the anatomical features of temporal lobectomy cavities rather than subtle epileptogenic pathology Consequently, the proxy introduces a major vulnerability where the model predicts surgery type instead of true seizure outcome All results must therefore be strictly understood as performance on this proxy classification task
--- Page 4 ---
After preprocessing quality filtering, 268 subjects are retained: 215 with proxy label y=0 and 53 with y=1, yielding a case-to-control ratio of approximately 4:1 While onthe-fly random augmentations are applied during training to prevent overfitting (detailed in Section 4.1), no offline augmented or synthetic subject records are added to the overall dataset count Preprocessing pipeline. p. 2 1), no offline augmented or synthetic subject records are added to the overall
dataset count. Preprocessing pipeline.Where the paper says it
--- Page 5 ---
We formulate the prognosis task as follows: given the aligned scan pair (Xt0, Xreg t1) and the surgery-type proxy label y ∈ [0, 1], learn a representation of the longitudinal change that separates the two outcome classes The pipeline proceeds in three phases that can be trained and deployed independently (see Figure 1) Phase 1: Contrastive Trajectory Encoding A 3D Siamese contrastive encoder shares weights between the two temporal branches [6] The backbone fθ is a MONAI [4] 3D ResNet-50 [13] (bottleneck blocks, layers [3, 4, 6, 3], channel widths [64, 128, 256, 512], singlechannel input) initialised from scratch Each scan pair is encoded independently by the shared backbone: vt0 = fθ(Xt0), vt1 = fθ(Xreg t1) (2) The difference vector vt1 − vt0 is projected to a 512-dimensional space by an MLP head and l2-normalised to produce the trajectory vector: ∆v = l2-norm(MLP(vt1 − vt0)) ∈ R 512, (3) The training objective is L = 1/2 LSupCon + 1/2 LFocal The Supervised Contrastive loss encourages trajectory vectors from the same surgical-outcome class to have high inner product and those from different classes to be mutually repulsive The Focal Loss term addresses the 4:1 class imbalance (Nneg/Npos ≈ 4) by down-weighting correctly classified easy examples
--- Page 6 ---
To increase effective variance with only 268 subjects, training-time 3D data augmentation applies random axis flipping (p=0.5 per axis), additive Gaussian noise (σ ∼ U[0. p. 3 To increase effective variance with only 268 subjects,
training-time 3D data augmentation applies random axis
flipping (p=0. 5 per axis), additive Gaussian noise (σ ∼
U[0. To increase effective variance with only 268 subjects,
training-time 3D data augmentation applies random axis
flipping (p=0. 5 per axis), additive Gaussian noise (σ ∼
U[0. 5 per axis), additive Gaussian noise (σ ∼
U[0. 08]), and random intensity scaling (factor ∼
U[0. 5 per axis), additive Gaussian noise (σ ∼
U[0. 08]), and random intensity scaling (factor ∼
U[0.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
--- Page 7 ---
To increase effective variance with only 268 subjects, training-time 3D data augmentation applies random axis flipping (p=0.5 per axis), additive Gaussian noise (σ ∼ U[0.02, 0.08]), and random intensity scaling (factor ∼ U[0.85, 1.15]) to both temporal scans simultaneously Augmentations are not applied during inference
--- Page 8 ---
Upon completing training, the encoder backbone and MLP head are frozen A Population Archive D = (∆vi, yi, Ci) Ntrain i=1 is constructed by forward-passing all training subjects through the frozen encoder and indexing their 512-dimensional unit-norm trajectory vectors in a FAISS exact inner-product index (IndexFlatIP) [15] Because ∆v vectors are l2-normalised, the inner product is mathematically equivalent to cosine similarity, enabling exact nearest-neighbour retrieval Algorithm 1 Neuro-Oracle Inference Pipeline (M5) Require: Query (∆vq, Cq), frozen archive D, LLM agent A A δ = 15 yr, k = 5 Nk ← FAISS Search(∆vq, D, k) Pyi (neighbor outcomes) pneighbor ← 1 k Pyi (neighbor outcomes) Build prompt with Cq and Nk (age/sex/outcome); append: “Mentally filter out matches with age gap > δ” s ← A(prompt) pLLM ← 0.20 if parse(s) = SUCCESS else 0. p. 3 Algorithm 1 Neuro-Oracle Inference Pipeline (M5)
Require: Query (∆vq, Cq), frozen archive D, LLM agent
A, δ = 15 yr, k = 5
1: Nk ← FAISS Search(∆vq, D, k)
2: pneighbor ← 1
k
Pyi (neighbor outcomes)
3: Build prompt with Cq and Nk (age/sex/outcome); append: “Mentally filter out matches with age gap > δ”
4: s ← A(prompt)
5: pLLM ← 0. 20 if parse(s) = SUCCESS else 0. , IndexIVFPQ), achieving submillisecond retrieval without altering the clinical workflow. Algorithm 1 Neuro-Oracle Inference Pipeline (M5)
Require: Query (∆vq, Cq), frozen archive D, LLM agent
A, δ = 15 yr, k = 5
1: Nk ← FAISS Search(∆vq, D, k)
2: pneighbor ← 1
k
Pyi (neighbor outcomes)
3: Build prompt with Cq and Nk (age/sex/outcome); append: “Mentally filter out matches with age gap > δ”
4: s ← A(prompt)
5: pLLM ← 0. 60 · pneighbor + 0. 40 · pLLM
7: yˆq ← 1[pq > 0.Where the paper says it
Where the paper says it
Where the paper says it
--- Page 9 ---
For a query subject q, the top-k most similar archived trajectories are retrieved: Nk(q) = top-k i∈D ∆vq · ∆vi, k=5
--- Page 10 ---
Table 1. Epilepsy surgical prognosis on EPISURG (N=268, 5-fold stratified CV). p. 5 Epilepsy surgical prognosis on EPISURG (N=268, 5-fold stratified CV). BalAcc = (Sensitivity + Specificity) / 2. p. 5 Epilepsy surgical prognosis on EPISURG (N=268, 5-fold stratified CV). BalAcc = (Sensitivity + Specificity) / 2. Best value per
column in bold. Category Method AUC ↑ F1 ↑ Sensitivity ↑ Specificity ↑ Balanced Acc.Where the paper says it
Where the paper says it
Where the paper says it
--- Page 10 ---
Table 2. Threshold-optimised performance. p. 5 M2 and M4 in AUC while additionally producing a naturallanguage justification for every prediction. Threshold-Optimised Performance
We also report metrics under decision thresholds that maximise balanced accuracy on the aggregate held-out predictions in Table 2. Threshold-optimised performance. Threshold selected via grid search over [0. Threshold selected via grid search over [0. 50] (step 0.Where the paper says it
Where the paper says it
Where the paper says it
--- Page 11 ---
Table 3. Ablation study of Neuro-Oracle pipeline components (N = 268, 5-fold stratified cross-validation)
--- Page 10 ---
Figure 4. AUC-ROC across input modality and reasoning engine combinations
--- Page 8 ---
Figure 5. t-SNE projection [28] of the 512-dim l2-normalised trajectory vectors for all 268 EPISURG subjects
--- Page 7 ---
Table 4. Embedding space and retrieval quality metrics (N = 268 subjects; 512-dimensional FAISS exact inner-product index)
--- Page 7 ---
Figure 5. t-SNE projection [28] of the 512-dim l2-normalised trajectory vectors for all 268 EPISURG subjects
--- Page 8 ---
Table 3. Ablation study of Neuro-Oracle pipeline components (N = 268, 5-fold stratified cross-validation)
--- Page 9 ---
Figure 4. AUC-ROC across input modality and reasoning engine combinations
--- Page 9 ---
Figure 5. t-SNE projection [28] of the 512-dim l2-normalised trajectory vectors for all 268 EPISURG subjects
--- Page 8 ---
Figure 5.
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Improved system can predict post-surgical seizure outcomes by encoding pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder.
-
The system can retrieve historically similar surgical trajectories from a population archive via nearest neighbour search to ground its prognosis in evidence.
-
A quantized Llama-3 agent can synthesize a naturallanguage prognosis grounded in the retrieved evidence, producing structured justifications with zero observed hallucinations under the audit protocol.
-
The framework can use trajectory-based classifiers to achieve AUC values between 0.834 and 0.905, compared with 0.793 for a single-timepoint ResNet50 baseline.
-
The system can leverage decision thresholds, such as the optimized threshold of 0.34 for Neuro-Oracle (M5), to maximize balanced accuracy by trading sensitivity for specificity and achieving Sensitivity = 0.698 at that point.
-
The improved system can provide a natural language justification for every prediction, enhancing deployability compared to a black-box ensemble with an AUC of 0.905 while retaining the performance of geometric baseline classifiers with an AUC of 0.867.
Abstract
Predicting post-surgical seizure outcomes in pharmacoresistant epilepsy is a clinical challenge. Conventional deep-learning approaches operate on static, single-timepoint pre-operative scans, omitting longitudinal morphological changes. We propose Neuro-Oracle, a three-stage framework that: (i) distils pre-to-post-operative MRI changes into a compact 512-dimensional trajectory vector using a 3D Siamese contrastive encoder; (ii) retrieves historically similar surgical trajectories from a population archive via nearest-neighbour search; and (iii) synthesises a natural-language prognosis grounded in the retrieved evidence using a quantized Llama-3-8B reasoning agent. Evaluations are conducted on the public EPISURG dataset (N = 268 longitudinally paired cases) using five-fold stratified cross-validation. Since ground-truth seizure-freedom scores are unavailable, we utilize a clinical proxy label based on the resection type. We acknowledge that the network representations may potentially learn the anatomical features of the resection cavities (i.e., temporal versus non-temporal locations) rather than true prognostic morphometry. Our current evaluation thus serves mainly as a proof-of-concept for the trajectory-aware retrieval architecture. Trajectory-based classifiers achieve AUC values between 0.834 and 0.905, compared with 0.793 for a single-timepoint ResNet-50 baseline. The Neuro-Oracle agent (M5) matches the AUC of purely discriminative trajectory classifiers (0.867) while producing structured justifications with zero observed hallucinations under our audit protocol. A Siamese Diversity Ensemble (M6) of trajectory-space classifiers attains an AUC of 0.905 without language-model overhead.
Sources
- MONAI: An open-source framework for deep learning in healthcare
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- The Llama 3 Herd of Models
- Decoupled Weight Decay Regularization
- LLaMA: Open and Efficient Foundation Language Models
- MMed-RAG: Versatile Multimodal RAG System for Medical Vision Language Models
Related papers
- FLARE: Full-Modality Long-Video Audiovisual Retrieval Benchmark with User-Simulated Queries
- When does the head leave? Shared timing and a movement clock in 360-degree video viewing
- Augmented Hybrid TV Services. Habits, Preferences, Opinions and Expectations of Spanish Consumers
- A Survey of Generative Categories and Techniques in Multimodal Generative Models
- ControlFoley: Unified and Controllable Video-to-Audio Generation with Cross-Modal Conflict Handling
- EyeNavGS: A 6-DoF Navigation Dataset and Record-n-Replay Software for Real-World 3DGS Scenes in VR