The generalization of AI models is critical for their clinical application. In short, the generality of the model can be expressed in two ways: the first scenario is the performance of the prediction model on data with a similar distribution and the second scenario is predicting how the model behaves on data from different distributions. These differences may include information related to time, treatment regimens, geography, and so on. However, the reality is that most AI models perform well on training data but struggle to maintain consistent performance during internal and external independent validation, indicating poor generalization. The majority of clinical trials focus on common diseases with limited attention given to rare diseases. This imbalance presents significant challenges when applying AI models to rare disease clinical trials. One of the main obstacles faced by AI models in generalizing to rare diseases is the issue of data distribution shifts. Since most clinical trial datasets primarily consist of data from common diseases, there is a lack of diverse and representative data for rare conditions. As a result, AI models trained on such imbalanced datasets struggle to accurately predict outcomes or make informed decisions when applied to new unseen trials involving rare diseases. Furthermore, small sample sizes pose another hurdle for achieving decent out-of-distribution (OOD) performance using AI models in this context. Rare diseases often affect only a small number of individuals within the population, making it challenging to gather sufficient data for robust model training and evaluation. The scarcity of labeled samples limits the ability of AI algorithms to effectively learn patterns specific to these conditions. Addressing limitations and improving OOD performance for new, unseen trials involving rare diseases is challenging. Typically, transfer learning was devised to tackle this problem by initially pretraining certain representations on extensive unannotated datasets and subsequently adjusting them for guiding other tasks .