We show that Spectra outperforms existing approaches and solves longstanding challenges in tumor immune contexts, including the identification of an interpretable tumor reactivity factor in CD8+ T cells and a new invasion program in macrophages, which associate with response and resistance to cancer immunotherapy, respectively. Here, CD8A is linked to neoplasm.