For a flavor, see Tom Minka’s recent talk/slides “From automatic differentiation to message passing”.
Difficult to give a quick answer. I’m also not aware of any good resources where this is spelled out. If you’re seriously interested, feel free to hit me up for a deeper discussion.