Clear Sky Science · en
A machine learning model for optimizing treatment of patients with poorly controlled type 2 diabetes
Why this matters for people with diabetes
For many people with type 2 diabetes, keeping blood sugar under control is a daily challenge, and doctors now have several powerful drug options that also protect the heart and kidneys. Two of the most widely used newer treatments work very differently, yet current guidelines offer little help on which medicine is better for which patient. This study introduces a data-driven decision tool designed to match individual patients to the drug that is more likely to improve their long-term blood sugar control.

Two modern medicines, one hard choice
The research focuses on two drug families: one that helps the kidneys release more sugar in the urine, and another that boosts natural hormone signals to help the body release insulin and feel fuller after meals. Both have been shown to lower blood sugar and reduce the risk of heart and kidney problems. In everyday practice, however, doctors often rely on experience or habit when choosing between them, because there have been few direct comparisons in real-world patients and little guidance on how personal factors like weight, disease duration, or kidney function should shape the choice.
Turning real-world records into a smart score
To tackle this problem, the authors used health records from more than 24,000 adults in China with poorly controlled type 2 diabetes who started one of the two medicines. They applied a machine learning method that combines many small decision trees to spot patterns linking each person’s starting characteristics to their blood sugar levels six and twelve months later. Fifteen routine clinical features were included, such as age, years since diagnosis, body mass index, baseline blood sugar measures, kidney function, liver enzyme levels, blood fats, and whether other diabetes pills were being taken. The team built separate models for each drug and for each time frame, asking both whether patients reached a common blood sugar goal and what their exact long-term levels would be.
A simple tool to suggest the better option
From these models, the researchers created a “decision score” that compares how well each medicine is expected to work for a given patient. The score blends two pieces of information: the chance of reaching the blood sugar target and the predicted long-term blood sugar value, with heavier penalties for predictions that remain clearly too high. If the score favors one drug enough, the tool recommends that option; if the predicted benefits are similar, it stays neutral so the doctor and patient can decide together. The tool is tailored to how often a person is likely to be seen in clinic: a six-month version for those with more regular follow-up and a twelve-month version for those reviewed less often.
Who benefits more from which treatment
When the score was tested in an independent group of nearly 1,500 patients, it predicted outcomes well. Overall, it recommended the hormone-based medicine for about twice as many people as the kidney-targeting drug. At six months, patients who were heavier, had higher liver enzyme and cholesterol levels, stronger signs of preserved insulin production, and a shorter history of diabetes were more likely to be guided toward the hormone-based option. By twelve months, higher starting blood sugar and higher body mass played a larger role in steering the recommendation toward that drug. Measures of kidney function were especially important for the kidney-focused medicine, while the marker of insulin production was particularly influential for the hormone-based treatment.

Better outcomes when the tool is followed
Crucially, people whose actual prescriptions matched the tool’s recommendation achieved better long-term blood sugar control than those whose treatment went against it. This advantage was most striking in younger adults under 55 and in men, suggesting that carefully matching drug choice to personal characteristics can make a meaningful difference, especially earlier in the course of disease. The researchers also tested variants of their model that added sex, education, income, and individual drug brands, and found that these extras did not substantially improve performance, underscoring that widely available clinical measures already carry strong predictive power.
What this means for everyday care
For a layperson, the core message is straightforward: by learning from tens of thousands of real patients, the TiP DecScore tool can estimate which of two modern diabetes medicines is more likely to bring an individual’s blood sugar under control over the coming year. It does this using information that doctors already collect in routine visits. While it does not replace medical judgment or account for every consideration, its use was linked with better outcomes in practice. As such, it represents a step toward more personalized, evidence-based treatment choices that can improve life and reduce complications for people living with type 2 diabetes.
Citation: Shi, J., Liu, C., Hu, J. et al. A machine learning model for optimizing treatment of patients with poorly controlled type 2 diabetes. Commun Med 6, 165 (2026). https://doi.org/10.1038/s43856-026-01442-8
Keywords: type 2 diabetes, personalized treatment, machine learning in medicine, GLP-1 receptor agonists, SGLT2 inhibitors