Coming at this from the opposite direction, the first word I think of is *artifex* (*-icis*, m/f). It refers to a person who is highly skilled and knowledgeable about a specific topic, but not necessarily in a good way. An *artifex* is capable of twisting and controlling and manipulating something, whether it be marble and paint or the mood of a crowd.

Here's a positive example from *Aeneid* 1.455:
> **artificumque** manus inter se operumque laborem  
> miratur, videt Iliacas ex ordine pugnas...

> He sees the battles of Troy all in order, and marvels at the skill of the **crafters** and the effort of their works...

But it was also an epithet of Odysseus, for example, when Sinon is explaining how he was chosen as a sacrifice (2.125):

> hic Ithacus vatem magno Calchanta tumultu  
> protrahit in medios; quae sint ea numina divum  
> flagitat. et mihi iam multi crudele canebant  
> **artificis** scelus, et taciti ventura videbant.

> Here Odysseus brought out the seer Calchas among them, amid great commotion; he demanded to know from him what the will of the Gods might be. And already many people were cruelly predicting **that schemer's** wickedness, and were foreseeing what was about to come.

I hesitate to call it a real translation of "nerd", since it doesn't imply anything about social awkwardness—quite the opposite, in fact. But it's a word implying specialized skill or knowledge, which can either be a compliment or an insult depending on context.