Large language models as synthetic clinical experts to inform longitudinal rare-disease modeling
Organizations: Institute of Medical Biometry and Statistics (IMBI), Faculty of Medicine and Medical Center – University of Freiburg, Freiburg, Germany · Freiburg Center for Data Analysis, Modeling and AI – University of Freiburg, Freiburg, Germany · Department of Neuropediatrics and Muscle Disorders, Faculty of Medicine and Medical Center – University of Freiburg, Freiburg, Germany · Bonn Center for Mathematical Life Sciences – University of Bonn, Germany ·
Abstract
Due to the limited amount of information, modeling longitudinal rare-disease data can benefit from integrating clinical knowledge. Yet, elicitation of expert knowledge and formalization for model fitting is challenging, in particular due to limited time of clinical experts. To nevertheless make domain knowledge accessible during model fitting, we use large language models (LLMs) as synthetic clinical experts to supervise a variational-autoencoder-based approach that learns low-dimensional latent summaries of visit-level observations. Specifically, LLMs are queried offline on textual descriptions of patient observations to obtain judgments, e.g., the suspected clinical category. To improve the variational autoencoder fit, we train a differentiable surrogate model on these judgments and augment the loss function to encourage reconstructions that preserve the clinical-label distribution of their corresponding input profile. In an application to longitudinal motor-function assessments from children with spinal muscular atrophy, we map visit-level clinical profiles to low-dimensional representations that are linked by a multivariate mixed-effects model. The synthetic expert loss discourages reconstructions that remain numerically close in data space but alter the clinical interpretation of the reconstructed motor function profile, such as by crossing a disease-type boundary. We thus reduced disagreement between original and reconstructed SMA type labels from about 11 to 7 percent. Furthermore, informing the latent representation by the synthetic expert improved prediction of motor function milestones compared with unsupervised latent representations and a data-level baseline. These results suggest that incorporating LLMs into model fitting can make clinical knowledge available to representation learning and improve clinical faithfulness for longitudinal rare-disease data.
Figures & tables
| Synthetic expert | Ordinal consistency (%) | Rev. pairwise agreement (%) | Rev. final-label agreement (%) | Surrogate accuracy (%) | Uncertainty ratio |
| Coin Toss | 9.4 | 50.0 | 1.7 | 33.3 | – |
| Gemma-4-E2B | 74.1 | 85.3 | 52.8 | 89.6 | 1.5 |
| Gemma-4-E4B | 80.0 | 84.6 | 47.8 | 84.8 | 1.3 |
| Gemma-4-12B | 87.1 | 95.7 | 85.1 | 94.9 | 11.4 |
| Gemma-4-31B | 89.9 | 97.8 | 92.7 | 97.2 | 9.6 |
| GPT-OSS-20B | 74.1 | 85.8 | 48.7 | 87.5 | 1.6 |
| Synthetic expert | JS divergence | Label disagreement (%) | HINE-2 sum-score error | HINE-2 error among mismatches | |
| Gemma-4-31B | 0 | 0.054 | 10.9 | 1.359 | 2.451 |
| 10 | 0.043 | 9.0 | 1.357 | 2.012 | |
| 25 | 0.038 | 8.2 | 1.360 | 2.010 | |
| 50 | 0.034 | 7.5 | 1.377 | 2.004 | |
| 100 | 0.031 | 6.8 | 1.382 | 2.001 | |
| GPT-OSS-120B | 0 | 0.034 | 10.1 | 1.359 | 2.354 |
| Sitting | Standing | Walking | ||||||||
| Feature set | Brier | AUC | ECE | Brier | AUC | ECE | Brier | AUC | ECE | |
| HINE-2 sum score | – | 0.271 | 0.817 | 0.314 | 0.180 | 0.834 | 0.175 | 0.142 | 0.845 | 0.134 |
| HINE-2 sum score + covariates | – | 0.209 | 0.890 | 0.255 | 0.155 | 0.908 | 0.153 | 0.124 | 0.919 | 0.119 |
| 0 | 0.097 | 0.944 | 0.078 | 0.098 | 0.951 | 0.102 | 0.087 | 0.954 | 0.088 | |
| informed by Gemma-4-31B | 10 | 0.085 | 0.954 | 0.067 | 0.084 | 0.962 | 0.076 | 0.067 | 0.964 | 0.065 |
| 25 | 0.084 | 0.956 | 0.064 | 0.088 | 0.960 | 0.081 | 0.071 | 0.962 | 0.067 | |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| HINE-2 item | Text fragment by item score |
|---|---|
| Introduction | The child is {years} years {months} months old when its motor function is evaluated. The child has the following motor function skills: |
| Upper limb function | 0 : Cannot achieve useful hand function to grab objects. 1 : Achieves useful hand function to grab objects. |
| Raise hands | 0 : Cannot raise its hands to the mouth. 1 : Raises its hands to the mouth. |
| Reach overhead | 0 : Cannot reach overhead. 1 : Reaches overhead. |
| Head control | 0 : Has no stable head control and cannot maintain the head upright. 1 : Holds the head upright briefly, but the head wobbles and control is unsteady. 2 : Maintains the head upright consistently and does not show head wobbling. |
| Sitting | 0 : Cannot maintain a sitting position in a meaningful way even with external support. 1 : Sits only if the examiner stabilizes the pelvis or hips and cannot sit independently. 2 : Sits with propping and uses the arms or hands for balance, but cannot sit freely without upper limb support. 3 : Sits independently without obvious propping, but cannot rotate or pivot while sitting. 4 : Sits independently and rotates and pivots while sitting. |
| Prompt part | Text |
| Comparison instruction | Decide between two candidate motor-function labels for a child being evaluated for spinal muscular atrophy (SMA): {label A} or {label B} . |
| Decision rule | Use the child’s age to contextualize the observed motor abilities. If neither label is a reasonable match, choose the allowed label whose severity is closer to the observed motor impairment. When {label A} or {label B} is presymptomatic the following additional instruction was included: Choose presymptomatic when motor abilities are age-appropriate and no SMA-related motor impairment is observed. |
| Profile text | {profile text} |
| Output constraint | Think briefly about your answer. Report your confidence of your final decision and conclude by returning the following JSON object: {"label": "label B", "certainty": "high|medium|low"} or {"label":"label A", "certainty": "high|medium|low"} . |
| Milestone | Events | Definition |
| Sitting | 432 | Patient sits up straight with the head erect for at least 10 seconds. Patient does not use arms or hands to balance the body or to support the position. |
| Standing | 304 | Patient stands in an upright position on both feet, not on the toes, with the back straight. The legs support 100% of the patient’s weight. There is no contact with an object or a person. Patient stands alone for at least 10 seconds. |
| Walking | 264 | Patient takes at least 5 steps independently in an upright position with the back straight. One leg moves forward while the other supports most of the body weight. There is no contact with a person or object. |
Representation Learning
Representation learning develops data transformations that expose useful structure for prediction, transfer, generation, and control.
See all 799 papers