Antecedents to Madison's Federalism

There were republics the American FOunding Fathers could look back on to get the idea for having a republic (Ancient Rome in particular),

but where did Madison get the idea of federalism? What historical examples of federalism did he use?

What was the first federalist state?

There were numerous philosophers whom Madison and the other framers relied upon for their work.

Federalism seemed to be a bit of compromise that the Constitutional Convention hashed out in order to make the U.S. governable and keep it from being swallowed up by Europe again.