LOS ANGELES — As recently as 2008, Locke High School here was one of the nation’s worst failing schools, and drew national attention for its hallway beatings, bathroom rapes and rooftop parties held by gangs. For every student who graduated, four others dropped out.

Now, two years after a charter school group took over, gang violence is sharply down, fewer students are dropping out, and test scores have inched upward. Newly planted olive trees in Locke’s central plaza have helped transform the school’s concrete quadrangle into a place where students congregate and do homework.

“It’s changed a lot,” said Leslie Maya, a senior. “Before, kids were ditching school, you’d see constant fights, the lunches were nasty, the garden looked disgusting. Now there’s security, the garden looks prettier, the teachers help us more.”

Locke High represents both the opportunities and challenges of the Obama administration’s $3.5 billion effort, financed largely by the economic stimulus bill, to overhaul thousands of the nation’s failing schools.

The school has become a mecca for reformers, partly because the Department of Education Web site hails it as an exemplary turnaround effort.

But progress is coming at considerable cost: an estimated $15 million over the planned four-year turnaround, largely financed by private foundations. That is more than twice the $6 million in federal turnaround money that the Department of Education has set as a cap for any single school. Skeptics say the Locke experience may be too costly to replicate.

“When people hear we spent $15 million, they say, ‘You’re insane,’?” said Marco Petruzzi, chief executive of Green Dot Public Schools, the nonprofit charter school group that has remade Locke. “But when you look closely, you see it’s not crazy.”

Locke High, with 3,200 students, sprawls across six city blocks in south-central Los Angeles. The school’s principal in 2007 complained publicly that the Los Angeles Unified School District had made it a dumping ground for problem teachers.

Kevin Rauda, a senior, recalled a teacher who read newspapers in class instead of teaching. In spring 2008, only 15 percent of students passed state math tests.

Green Dot, which operates charter schools in Los Angeles and one in the Bronx, won control of Locke from the district in 2008 and began a turnaround effort.

In August 2008, Kevin King, a retired police lieutenant hired by Green Dot, toured Locke’s campus and found broken windows, smashed lights, and security cameras that did not work. Teachers’ cars were parked helter-skelter, including on some handball courts; gang members were selling drugs on others.

“Kids couldn’t even go to the bathroom without being pocket-checked or hassled,” Mr. King said.

He put together a new security force to expel the gangs. Green Dot fixed the lights and cameras, painted over graffiti, reorganized the parking, and hired bus companies to transport 500 students who previously walked dangerous streets to school.

Green Dot divided Locke into small academies. Several, modeled on the charters it operates elsewhere, opened in fall 2008 with freshman classes of 100 to 150 students and are to reach full enrollment of 500 to 600 students by fall 2011.

Other academies concentrate on remedial classes for older students, including some returning from jail. Another focuses on preparing students for careers in architecture.

Green Dot required Locke’s 120 teachers to reapply for their jobs. It rehired about 40, favoring teachers who showed enthusiasm and a belief that all Locke students could learn. The campus stays open each day until early evening for science tutoring, band and other activities.

Although state test scores administered in spring 2009, just months after the Green Dot makeover began, showed modest gains, Locke remained among California’s lowest-performing schools. Still, a dozen students said in recent interviews that the school was safer and instruction had improved.

Hundreds of school districts across the nation will soon be trying makeovers, prodded by the Obama administration’s push to remake the nation’s 1,000 worst schools, and the availability of $3.5 billion in federal money.

But if they rely on federal money alone, they will have to spend less than Green Dot.

Under rules set by Congress, districts can apply for up to $6 million for each failing school, to be spent over three years.

During a Senate hearing in April, Senator Al Franken, Democrat of Minnesota, congratulated Mr. Petruzzi on the Locke transformation, but also suggested its reliance on philanthropic donations would make it difficult to imitate.

“I’m thinking, how scalable is this?” Mr. Franken said.