Silicon Valley has always looked for talent among the young (Mark Zuckerberg made his first billion at age 23). It’s only recently, though, that it has set its sights on grade school.

The Valley isn’t trying to hire preteens (yet), but some of the country’s mightiest tech giants are aiming to bolster the talent pipeline by putting serious money behind kids’ math and science education, particularly for girls and minorities.

At the Consumer Electronics Show in Las Vegas in early January, Intel CEO Brian Krzanich announced that he will dedicate $300 million to sponsor STEM education in K-12 classes and in universities, with a focus on underserved regions. The money is part of a broader effort to boost diversity among its workforce and will also fund recruiting, training, and investments in female and minority-owned startups, along with education.

For the uninitiated, STEM is a much-buzzed acronym that stands for science, technology, engineering, and mathematics. Intel INTC already invests in STEM programs—for example, the company runs two “computer clubhouses” for teens in Harlem. But its new Diversity in Technology initiative will bring significantly more money to similar programs across the country.

It’s not clear yet exactly how Intel will mete out the funds. Renée James, Intel’s president (and the highest-ranked-woman in the company’s history), will be handling the day-to-day oversight of the project and will hammer out the details with Rosalind Hudnell, Intel’s chief diversity officer. James says she’s convinced that putting money into teaching kids skills like math and science will help increase the pipeline of diverse talent in the long run. Other technology companies, including Apple AAPL and mobile payments provider Square, are also partnering with a growing crop of organizations that teach technical skills to students. But until now these efforts have been on a fairly small scale. What’s more, their effects—if any—won’t be felt for at least another few years.

That fact makes Intel’s new program look even more ambitious: By 2020 it aims to achieve “full-representation” of women and minorities—in other words, employ a workforce that reflects the demographics of the available talent pool. At the same time it hopes to increase the diversity of that talent pool with STEM initiatives. Currently only 24% of Intel’s workforce is female, 8% is Hispanic, and just 4% is black. In the next few years the company aims to boost participation from those groups by 14%. (Keep in mind that the percentage of women at Intel has stayed pretty much flat for the past 10 years.)

Throughout the industry, companies are approaching similar efforts with growing urgency. It helps that companies increasingly feel that STEM is more than a do-gooder mission. Major players believe shareholders would be better served by an employee base that is more representative of their customers. Tech giants are also faced with heightened competition for talent, leading them to look for new ways to expand the potential workforce.

Will it work? “If I judge by the past, I’d say, ‘I don’t know what we’re thinking,’ ” says Intel’s Hudnell, on the company’s ambitious targets. “But if I judge it by the fact that we’ve driven Moore’s law for 50 years, then I step back and say, ‘It’s actually doable.’ ” 

This story is from the February 2015 issue of Fortune.