This is a trilogy and there was two stories intertwining. One that is in the past and one that is in the present. In the present there are a group of boys learning about magic words that will bring food or other things and there are two wizards that are training them; one is mean and the other more caring. In the past, there is a farm girl who is copying notes from the same wizards and putting them in books so they can be studied.
The A Resurrection of Magic series by Kathleen Duey.
Skin Hunger, 2007
In this darkly atmospheric fantasy, the first in a planned trilogy called A Resurrection of Magic, Duey weaves together the stories of two teens who live in a world in which the working of magic has a turbulent history. When her bitter father dies, Sadima, a young woman who can communicate with animals, keeps house for two renegade magicians at a time when magic has been outlawed. Her experiences, which include learning to read and falling in love, alternate with those of Hahp, born generations after Sadima. Exiled by his wealthy, disapproving father, he attends a school of wizardry where, among other unpleasantness, students are starved to death if they can't conjure up food.
Sadima lives in a world where magic has been banned, leaving poor villagers prey to fakes and charlatans. A "magician" stole her family's few valuables and left Sadima's mother to die on the day Sadima was born. But vestiges of magic are hidden in old rhymes and hearth tales and in people like Sadima, who conceals her silent communication with animals for fear of rejection and ridicule. When rumors of her gift reach Somiss, a young nobleman obsessed with restoring magic, he sends Franklin, his lifelong servant, to find her.
Centuries later magic has been restored, but it is available only to the wealthy and is strictly controlled by wizards within a sequestered academy of magic. Hahp, the expendable second son of a rich merchant, is forced into the academy and finds himself paired with Gerrard, a peasant boy inexplicably admitted with nine sons of privilege and wealth. Only one of the ten students will graduate -- and the first academic requirement is survival.