Background & AimsThe risk of hepatocellular carcinoma (HCC) and hepatic decompensation persists after hepatitis B surface antigen (HBsAg) seroclearance. This study aimed to develop and validate a machine learning model to predict the risk of liver-related outcomes (LROs) following HBsAg seroclearance. MethodsA total of 4,787 consecutive patients who achieved HBsAg seroclearance between 2000 and 2022 were enrolled from 6 centers in South Korea and a territory-wide database in Hong Kong, comprising the training (n=944), internal validation (n=1,102), and external validation (n=2,741) cohorts. Three machine learning-based models were developed and compared in each cohort. The primary outcome was the development of any LRO, including HCC, decompensation, and liver-related death. ResultsDuring a median follow-up of 55.2 (interquartile range=30.1–92.3) months, 123 LROs were confirmed (1.1%/person-year) in the Korean cohort. A model with the best predictive performance in the training cohort was selected as the final model (designated as PLAN-B-CURE), which was constructed using a gradient boosting algorithm and 7 variables (age, sex, diabetes, alcohol consumption, cirrhosis, albumin, and platelet count). Compared to previous HCC prediction models, PLAN-B-CURE showed significantly superior accuracy in the training cohort (c-index: 0.82 vs. 0.63–0.70, all P<0.001; area under the receiver operating characteristic curve: 0.86 vs. 0.62–0.72, all P<0.01; area under the precision-recall curve: 0.53 vs. 0.13–0.29, all P<0.01). PLAN-B-CURE showed a reliable calibration function (Hosmer–Lemeshow test P>0.05) and these results were reproduced in the internal and external validation cohorts. ConclusionThis novel machine learning model consisting of 7 variables provides reliable risk prediction of LRO after HBsAg seroclearance that can be used for personalized surveillance.