The pan-cancer foundation model outperforms 22 other methods and generalizes to treatments not seen during training.