When was it established that there were 14,000 innocents martyred? In the Orthodox Church tradition, as I understand it, the Feast of the 14,000 Martyrs commemorates the deaths of the children massacred by Herod in what is otherwise known as the 'Massacre of the Innocents'. (Matt 2:16-18).

Scholars have argued that the number was likely to have been in the 10s or low 100s. Where did the figure of 14,000 first come from? Why that number in particular?

UPDATE

At Warren's request in the comment below, here are some sources:

The Catholic Encyclopedia cites 3 figures: 64k in the Syriac tradition, 144k in the medieval tradition, based on Apocalypse 14:3 and 14k in the Greek tradition. 

It's not beyond the bounds of probability that somewhere along the way 144k was reduced to 14k due to either scribal error or conservative judgement. It would be nice to trace the sources involved to check this theory out.

As far as the lower numbers go, there are some secondary sources quoted here and in this paper by Mans. The latter mentions an early low count given by Basil of Seleucia, but neither provide an answer to my question.

Mans notes the mention of a mass grave, and it seems there was a skeleton of one of the holy innocents included in Frederick the Wise's collection of relics.

I'm afraid these sources do more to widen the scope of the question than to narrow it.
I think I can begin to offer an answer to this, though it's still bit's and pieces. Basically, my guess is sometime in the 4thC, (as far as it is possible to tell, given the fragmentary nature of the sources) though it is clear that some number or other seems to be assigned to the death toll relatively early on.

My reason for thinking this:

R. Brown's The Birth of the Messiah, 1999 (p. 205) talks about the "Byzantine Liturgy" first setting the number to 14, 000. Now, unfortunately I don't have full access to these books, so I can't work out the context in which "Byzantine Liturgy" is used. From some basic searches, it seems the Byzantine liturgy is sometimes mixed up with the conceptual apparatus of the Byzantine rites, and the Byzantine Divine Liturgys originate from writers like John Chrysostom, active in the latter half of the 4C. I would therefore suggest that the figure of 14,000, if it did become generally established in the West, would have probably become established shortly after the fall of Constantinople (15th C), as holy texts were sent west to keep them out of Muslim hands, but of course it's possible that it was established much earlier.

The purpose of such a number seems to be the obvious one, I'm afraid - a way of exacerbating the sense of Herod's selfishness and evil. It seems strange to modern ears, as 14,000 infants implies a pretty massive population for a provincial 1st century town like Bethlehem, and a systematic campaign of slaughter that would be materially, economically and organizationally difficult for this sort of society. Other numbers raise it above 100,000 though, so maybe the Byzantines weren't peculiar in setting a large figure.

Greek numerals seem to be decimal, so I don't seem any reason for rounding to 14,000. It seem either a relatively arbitrary choice of the author or, more likely in my view, a record of some oral tradition of the time.