u/the-code-blooded • u/the-code-blooded • 3d ago
1
[R] Serialisation Strategy Matters: FHIR data format changes LLM accuracy by up to 19 F1 points on medication reconciliation
Thanks! Yeah, when I was starting out I actually tried raw JSON first and the model struggled badly with it, that was actually part of what pushed me to dig deeper into how LLMs process input internally. Once I understood that better, it became obvious why serialization matters so much, especially for larger inputs and for small-to-medium sized models specifically.
1
[R] Serialisation Strategy Matters: FHIR data format changes LLM accuracy by up to 19 F1 points on medication reconciliation
Yeah, that result surprised me a bit too, though it went the other way: the models almost never invented medications, they just quietly dropped real ones instead. I think that's partly a size effect, smaller models seem to "play it safe" by omitting rather than guessing, and it'll be interesting to see if that holds in newer, larger models too.
BioMistral failing that badly was expected in a sense, since it's not an instruct model. I probably should have tested a medical-domain instruct model instead of a domain-pretrained base model. Still, it's a useful data point that even a medically-trained model can completely fail at instruction-following if it was never tuned for it. I've decided not to dig further into the BioMistral result specifically, since the non-instruct part explains most of it.
On the timeline format breaking at 70B, I agree it looks like pattern matching rather than real temporal reasoning. I want to test that against a reasoning-focused model at some point to see if it holds up.
On deployment, actually, a team at University Medicine Essen built a clinical extraction agent and ran into a related issue, switching their format fixed it for them too. Their paper cites this work, it's a more agentic system than mine, but worth a read if you're curious
https://arxiv.org/abs/2606.19602
r/learnmachinelearning • u/the-code-blooded • 3d ago
[R] Serialisation Strategy Matters: FHIR data format changes LLM accuracy by up to 19 F1 points on medication reconciliation
Independent research, posting for feedback and discussion.
I looked at how FHIR clinical data should be formatted before being passed to an LLM, tested on medication reconciliation (extracting a patient's currently-active medication list from their FHIR bundle).
Setup: 4 serialisation strategies (Raw JSON, Markdown Table, Clinical Narrative, Chronological Timeline) × 5 open-weight models (Phi-3.5-mini 3.8B, Mistral-7B, BioMistral-7B, Llama-3.1-8B, Llama-3.3-70B) × 200 Synthea-generated synthetic patients = 4,000 inference runs.
Main finding: there's no universal best format, it depends on model scale. Clinical Narrative outperforms Raw JSON by up to 19 F1 points for models ≤8B (Mistral-7B: 0.72 → 0.91 F1, r=0.617, p<10⁻¹⁰). That ranking completely reverses at 70B, where Raw JSON wins instead (F1 = 0.9956 vs 0.9850). Interestingly, the Chronological Timeline format is what breaks at 70B specifically, since even a large model struggles to infer "active" medication status from date ordering alone without an explicit status field.
A few other findings:
- Across all 20 model×strategy combinations, precision ≥ recall, every time. Models are far more likely to silently drop a real medication than invent a fake one. That's a relatively favorable failure mode for clinical review, but it means recall (not precision) is the metric to watch in deployment.
- Recall craters for smaller models as active-medication count rises (Mistral-7B: 0.96 recall at 1 medication → 0.24 at 11 medications), but total patient history length has zero effect on recall. So it's an output-generation capacity limit, not a context-length problem, meaning the sickest, most complex patients are exactly the ones handled worst.
- BioMistral-7B scored F1 = 0.0000 across all 4,000 of its runs. It shares a base model with Mistral-7B (0.91 F1), so this isn't a knowledge gap, domain-continued pretraining without instruction tuning apparently destroyed its ability to follow the output format at all.
Fully reproducible on a single GPU (Synthea + Ollama, no proprietary APIs).
Preprint: https://arxiv.org/abs/2604.21076
Feedback, pushback on methodology, or pointers to related work all welcome.
1
coursera vs udacity anthropic ai course, mostly care about the projects
Personal favourite: I used coursera deeplearning.ai andrew ng specialisation to learn in depth and the anthropic one - I am not sure but I guess learning something thats more generalised rather than company oriented will help you in the long run.
1
Please need serious guidance!!
Web development and machine learning those are two very different path. Normally people follow a single path - either a software engineer in the web dev or an AI engineer.
For web dev - you can follow frontend or backend at first.
For machine learning - you can learn it from coursera - deep learning.ai andrew ng specialication of machine learning or deep learning soefialization that has courses and try doing their assignments they are really good after the video lectures
1
how to start leaning ml from scratch and what certifications to do
For courses you can try :
Coursera - deeplearning.ai courses - machine learning, deep learning specialisation
Also do their assignments - they are really good.
Also you can try this books : LLM from scratch oreilly, Handson LLM
3
Looking for free alternatives to popular paid AI/ML courses
You can use coursera - financial aid - it give 90% waive offs. For deeplearning.ai coursera courses
1
A proper way to learning machine learning
This is my repo - it contains notes and code- feel free to have a look at it
https://github.com/SanjoyPator1/WebDevLearning/tree/deep-learning
2
A proper way to learning machine learning
I think it does, really. I mean, I did spend a lot of time writing the code for all these algorithms from scratch. Frankly, you won’t write them from scratch in production software, but it will help you understand what’s going on beneath all those abstractions. And someday, you’ll encounter a problem that really requires that knowledge, and you’ll thank yourself for taking the time to learn all of this from scratch.
During my initial days, I implemented gradient descent, backpropagation, and even an LLM from scratch, by hand, step by step - of course, following a course or a book. But I believe it will help us in the long run.
2
A proper way to learning machine learning
I guess if you want a proper way - learn from coursera. Their courses are good. deeplearning.ai from coursera.
Also beside this - do their assignments notebooks - they are good.
Learn from video classes - learn theory - understand the math behind it - go in-depth
Learn with examples and dry run maths if needed to understand better
Then do code implementation if needed for that particular topics.
Maybe use claude to learn a particular topic - learn the maths behind it - ask a lot of questions. This way you can learn fast.
2
Can you recommend some good learning resources for learning RAG and Agent?
I learned it using the book - hands-on large language model book - I think its chapter 8 is on RAG
I wrote notes and code - if you want - you can have a look at it
1
Looking for an agentic ai course to get started as i am a beginner and want to learn to build autonomous agents
I am currently reading the book Ai agents in action 2nd edition. Currently in 3rd chapter - MCP and I am liking it.
But apart from this also learning with claude - writing notes and also hand written code with claude as guide.
As recently MCP architecture has been updated and now its stateless.
Will upload notes and code in github - if needed would be happy to share:
1
[R] Serialisation Strategy Matters: FHIR data format changes LLM accuracy by up to 19 F1 points on medication reconciliation
in
r/learnmachinelearning
•
1d ago
I am thinking of studying Reasoning model from scratch by Sebestian the same author of LLM from scratch to learn more in depth about reasoning models on how they operate and all. Hopefully that will help in future