e14662 Background: Immune checkpoint inhibitor (ICI) combined with anti-angiogenic therapy is the standard first-line treatment for unresectable HCC patients. However, most patients do not derive durable benefit and will progress faster. Simultaneously, sufficient clinically validated biomarkers to stratify patients are lacking in HCC. Recent studies have shed a light on the strong connection between immunotherapy efficacy and tumor immune microenvironment (TIME) in HCC. Thus, this study aims to investigate TIME features before treatment to develop a potential way for survival prediction which may optimize risk stratification. Methods: A total of 84 unresectable HCC patients who received first-line ICI plus anti-angiogenic therapy at Nanjing Drum Tower Hospital were included. 4 multiplex immunohistochemistry (mIHC) panels containing 18 biomarkers were developed to thoroughly evaluate immune cells in TIME before therapy, such as cytotoxic T cells, tissue-resident memory T cells, macrophages and neutrophils. TIME features were then extracted from raw image by digital pathology, including cell subpopulation abundance and spatial profiling. We identified a list of TIME features associated with objective response rate (ORR), progression free survival (PFS) and overall survival (OS), and developed a TIME-based risk score (TIS) in our cohort using machine-learning. Results: After data cleaning, a total of 78 patients with complete clinical information and TIME features were included and split into training and validation sets. A higher positive rate of CD103+ cells and CD8+ cells were observed in responder, while patients with higher CD66b+ positive rate showed shorter PFS and OS. In terms of spatial profiling, tumor cells accompanied with more CD8+ cells were associated with longer PFS and OS, while longer distance from CD14+ cells and CD66b+ cells to tumor cells favored longer PFS and OS. Regarding PFS prediction, our machine-learning model TIS included both immune cell abundance and spatial features. Stratifying patients in the low- and high-risk groups using TIS revealed prolonged PFS (p<0.0001, HR: 0.24, 95%CI [0.13-0.45]) and OS (p = 0.00057, HR: 0.27, 95%CI [0.12-0.60]) in TIS low-risk group. Moreover, ORR in TIS low-risk group was 52.9% (17/34) and 15.9% (7/44) in TIS high-risk group. Univariable and multivariable analysis demonstrated that TIS was an independent predictor for ORR (p = 0.0017), PFS (p = 0.00065) and OS (p = 0.00042). Independent validation is still awaited. Conclusions: This study demonstrates that our machine-learning based risk score can improve treatment response and survival prediction using TIME features, which provides the potential to optimize risk stratification before first-line treatment for unresectable HCC patients.