Can the U.S. stave off the erosion of its longtime preeminence in science and engineering? For decades the nation's stature in those disciplines has attracted many of the brightest and most talented students from around the world to America's advanced degree programs. Citizens of other countries now receive more than half the Ph.D.s awarded by U.S. universities in engineering, computer science and physics, on top of earning one third of all college degrees in science and engineering. In certain subfields, the disparity is much higher: in electrical engineering, for example, foreign students received 65 percent of all doctoral diplomas in 2001.

These figures should inspire alarm, not pride. The unpleasant truth is that the U.S. public education system simply does not produce enough high school graduates who are qualified for college work of any kind, let alone students with a vigorous appetite for math and the sciences. The full depth of America's educational failure is actually masked by the diversity of nationalities among grad students in those fields: Of the 1,777 physics doctorates awarded in 2011, for example, 743 went to temporary visa holders from many lands—and that figure excludes foreign nationals who had won permanent resident status. Only 15 of those 1,777 doctorates were earned by African-Americans.

The influx of students from abroad may now be reaching critical mass. Where economists used to bemoan the “brain drain” that afflicted much of the developing world, many foreign graduates are now taking their American diplomas and returning to their home countries in search of opportunities greater than those they see in the U.S. Stateside university master's programs are packed with foreign students who are scheduled to leave the country as soon as they graduate. In 2009, the most recent year for which such data exist, students on temporary visas earned 27 percent of all master's degrees in science and engineering, including 36 percent of those in physics and 46 percent in computer science. And a 2002 survey found that nearly 30 percent of those candidates had no firm commitment to lives in the U.S. after graduation. That study was conducted before the post-2007 decimation of the U.S. job market—and unless Congress can break its current stalemate, at press time, over immigration reform, the retention rate most likely will drop even further.

If and when those students depart from America, they will in effect constitute an unacknowledged version of foreign aid. The advanced education they receive in the U.S. is underwritten by American taxpayers in the form of sponsored research, financial aid (for foreign students as well as Americans), and a wide array of subsidies and grants. In addition, many state governments provide their local universities (including wholly private institutions) with land; buildings; subsidized construction loans; fire and police protection; massive real-estate and sales-tax exemptions; and, in a few states, annual budget allocations. Foreign nations—particularly China, India and South Korea—benefit hugely from U.S. investments in higher education.

Of course, just as with more conventional, overt foreign aid, America also stands to benefit from its own largesse. The presence of U.S.-educated people in other, developing countries makes it easier for America's style of commerce and manufacturing to be accepted there, and a shared understanding of professional norms, competencies and perspectives can only facilitate business relations with U.S. firms. But there are risks as well. If current trends continue, America's scientists and engineers—the basic drivers of innovation and prosperity—will ultimately be surpassed by U.S.-educated competitors in other countries that are more serious about teaching their youngsters.

To keep that from happening, America needs to strengthen math and science programs from kindergarten through grade 12. In April a consortium of 26 states took a major step in the right direction by issuing the Next Generation Science Standards, a set of curricular guidelines for elementary and secondary schools to get more students ready for college-level work. At least seven states have adopted the standards. The program, which is designed to emphasize hands-on investigative learning and to encourage critical examination of scientific evidence, has provoked resistance from some quarters where science itself is viewed with suspicion. Implementing the standards will cost money, too: America's stinginess in supporting K–12 science education is a persistent national problem. But we have little choice. The alternative is to keep on allowing the country's great universities to be used as a funnel for unintended foreign aid.