There is increasing evidence that science & engineering PhD students lose interest in an academic career over the course of graduate training. It is not clear, however, whether this decline reflects students being discouraged from pursuing an academic career by the challenges of obtaining a faculty job or whether it reflects more fundamental changes in students' career goals for reasons other than the academic labor market. We examine this question using a longitudinal survey that follows a cohort of PhD students from 39 U.S. research universities over the course of graduate training to document changes in career preferences and to explore potential drivers of such changes. We report two main results. First, although the vast majority of students start the PhD interested in an academic research career, over time 55% of all students remain interested while 25% lose interest entirely. In addition, 15% of all students were never interested in an academic career during their PhD program, while 5% become more interested. Thus, the declining interest in an academic career is not a general phenomenon across all PhD students, but rather reflects a divergence between those students who remain highly interested in an academic career and other students who are no longer interested in one. Second, we show that the decline we observe is not driven by expectations of academic job availability, nor by related factors such as postdoctoral requirements or the availability of research funding. Instead, the decline appears partly due to the misalignment between students' changing preferences for specific job attributes on the one hand, and the nature of the academic research career itself on the other. Changes in students' perceptions of their own research ability also play a role, while publications do not. We discuss implications for scientific labor markets, PhD career development programs, and science policy.