## 1 Introduction
In contrast, the XGBoost model can quickly process multiple types of input data, incorporate built-in cross-validation and tree pruning, and offer greater flexibility in controlling data overfitting compared to other models [24]. Population spatial distribution is influenced by multiple factors, and understanding the degree and spatial characteristics of these influences is critical for developing high-quality urban planning and population spatialization policies. Machine learning models are often regarded as 'black box' methods because they typically do not explicitly reveal the relative importance of the key factors driving change. While models such as random forest and XGBoost can output the relative importance of various factors, they cannot effectively reveal the spatial extent of these influences. The SHAP interpretability method addresses this limitation by combining the robust data-fitting abilities of machine learning with a clear interface for the quantitative interpretation of results [25; 26]. With the wide application of machine learning coupled with SHAP, this method has been gradually applied to quantify the contributions of influencing factors. For instance, [PERSON] et al. [27] employed interpretable machine learning to explore the contributions of temperature, precipitation, soil moisture, and land use to vegetation changes in the Yellow River Basin. Similarly, [PERSON] et al. [28] integrated XGBoost with SHAP to analyze the impact of climatic factors on the long-term average net primary productivity (NPP) of the Amazon rainforest. The SHAP interpretability method not only ranks the importance of influencing factors but also effectively reveals their spatial distribution and degree of influence [29; 30]. This capability provides valuable methodological support for interpreting the factors that influence urban population spatial distribution. Significant progress has been made in population spatialization research. However, in the era of big data, the challenge of selecting appropriate estimation models to efficiently generate high-precision population spatial distribution data and interpret influencing factors remains. Additionally, many current studies rely on empirical approaches to determine optimal grid sizes for population estimation. As grid size significantly impacts the accuracy of fine-scale population and socioeconomic distribution data [31], determining the optimal spatial unit remains a critical research gap in refined population spatialization studies. Shanghai, a typical megacity in China, is characterized by a high population density, high degree of mobility, and uneven spatial distribution, making its population distribution more complex compared to smaller cities. The \"Shanghai Urban Master Plan (2017-2035)\" emphasized the need to optimize population layout, adjust population density, and promote the development of a livable city. These policy goals underscore the practical importance of conducting refined spatial population studies in Shanghai, which would enhance urban management and support sustainable development. To address the critical challenges of machine learning overfitting in population spatialization, the difficulty in analyzing the spatial heterogeneity of key influencing factors, and the selection of optimal grid scales, this study takes Shanghai as a case study to develop a refined multi-scale modeling framework. Building upon a comprehensive multi-dimensional feature database, we construct an XGBoost-based population spatialization model integrated with SHAP (SHapley Additive exPlanations) interpretability methods. Our approach achieves three key objectives: (1) generating multi-scale population distribution maps for Shanghai, (2) quantifying and spatially characterizing the influence of key determinants, and (3) identifying the optimal grid resolution. The results provide both technical support for Shanghai's population monitoring and a transferable methodology for other cities' high-resolution population spatialization research.