Some dinosaurs lost their teeth as they grew up, according to fossil evidence.
The hatchlings ate meat with their teeth, then used beaks to peck at plants as adults, say scientists.
The discovery is a surprise and has not been seen in any other reptile.
Limusaurus inextricabilis lived in China around 150 million years ago. The first fossilised remains of the animal were discovered about a decade ago.
“Initially, we believed that we found two different ceratosaurian dinosaurs from the Wucaiwan area, one toothed and the other toothless, and we even started to describe them separately,” said Shuo Wang of Capital Normal University in Beijing, China, who led the research.
The palaeontologists then realised that the dinosaurs looked remarkably similar, except for the presence of teeth.
They found that the dinosaur lost its teeth over time, making it the first known reptile to do this.
Life cycle change
Dr Stephen Brusatte, of the University of Edinburgh, who was not part of the research team, said it was a stunning discovery.
“Up until now, who would have thought that there were dinosaurs that had teeth as babies, started to lose them as they grew up and then ended up as toothless adults with beaks?” he told BBC News.
“Nothing like this is seen in any other fossil vertebrate and the platypus is the only modern land-living vertebrate that does anything similar.”
The dinosaurs were switching from one sort of feeding type that required teeth to one in which teeth were a disadvantage, and a beak was better, said Dr Stig Walsh of National Museums Scotland.
“Other theropod dinosaurs in the group to which Limusaurus belongs are carnivores and I can’t help wondering whether the driver for such a life cycle change was to allow Limusaurus to capitalise on a more abundant food source as they became larger,” he added.
Limusaurus (mud lizard) was a fairly old and primitive theropod dinosaur.
It belongs to the same group as well-known carnivores like T. rex and Velociraptor.
The researchers think the toothed juveniles were probably omnivorous meat-eaters. The adults, which had beaks, moved on to a plant-based diet.
The discovery will help explain how the beak, which is so important in the bird kingdom, evolved.
Tooth loss is more common in modern animals.
Some fish and amphibians lose teeth as they grow, as do platypuses.
The research is published in the journal Current Biology.
Follow Helen on Twitter.