Mode
Text Size
Log in / Sign up

How can machine learning predict my CD4 and CD8 counts if I have HIV/AIDS?

moderate confidence  ·  Last reviewed May 22, 2026

If you have HIV, your CD4 and CD8 counts are key markers of immune system health. Doctors use them to see how well your antiretroviral therapy (ART) is working. Machine learning is a type of artificial intelligence that can learn from large amounts of patient data to make predictions. Researchers have developed machine learning models that use your routine lab results — like blood counts, liver and kidney function, and viral load — to forecast what your CD4 and CD8 counts will be months or years into the future. This can help your doctor spot problems early and adjust your treatment sooner.

What the research says

A 2025 study created a machine learning framework that predicts CD4 and CD8 counts in people living with HIV on ART 1. The model combined four different algorithms (XGBoost, LightGBM, Random Forest, and Gradient Boosting) and was trained on data from over 5,400 patients. On a separate test group of 1,088 patients, it predicted CD4 counts with an R² of 0.768 (meaning it explained about 77% of the variation) and an average error of about 75 cells/μL 1. For CD8 counts, the R² was 0.636 with an average error of about 301 cells/μL 1. The model did not use the patient's own baseline CD4 or CD8 counts to make predictions, which means it can be useful even when those numbers aren't available 1.

Another study from 2022 used machine learning to predict CD4 cell counts in HIV patients after nearly 10 years of ART 6. Researchers built three models — support vector machine, random forest, and multi-layer perceptron — using routine blood tests, liver and kidney function, and lipid levels as inputs 6. They found that these clinical markers could help predict how CD4 counts would change over time, especially in patients who started with low CD4 counts 6.

Other research has applied machine learning to predict serious outcomes in HIV patients with specific infections. For example, studies used models like random forest and XGBoost to predict in-hospital death for HIV patients with cytomegalovirus or Talaromyces marneffei infections 45. While these studies focused on mortality rather than CD4/CD8 counts, they show that machine learning can effectively use clinical data to forecast important health events in HIV care 45.

What to ask your doctor

  • Could machine learning predictions of my CD4 and CD8 counts help guide my treatment plan?
  • What routine blood tests or other clinical data would be needed to make these predictions?
  • How often should I have my CD4 and CD8 counts checked to get the most benefit from predictive models?
  • Are there any machine learning tools currently used in this clinic or hospital for HIV care?
  • If my predicted CD4 count is low, what steps would you take to adjust my therapy?

This question is drawn from common patient questions about Infectious Disease and answered using cited medical research. We do not provide individualized advice.