Is there a difference in these two sentences, and if so, what is the difference?
- Immediately afterwards I remembered having met her.
- I remembered having met her immediately afterwards.
I think there is a difference but cannot identify what it is.
As John Lawler comments, "the second one has the usual attachment ambiguity".
I find it quite tricky to show that ambiguity - but first let's simplify things by replacing immediately afterwards with later, since it makes no difference to the issue under consideration. Then precede both versions by the same context...
1: I photoshopped a girl out of my graduation ceremony picture. Later I remembered having met her.
So far as I'm concerned, that can only be interpreted as meaning after I'd photoshopped her out of my picture, I remembered having met her (but it says nothing about when I actually met her).
2: I photoshopped a girl out of my graduation ceremony picture. I remembered having met her later.
This version could mean the same as #1, but it could also mean I met her after the ceremony (in which case it says little or nothing about when I actually remembered having met her).
Obviously the speaker himself would know which meaning he intended with #2. But personally if I were reading just those words, I would naturally assume the second meaning. I think the reason for my assumption is simply that with terms like afterwards, later, by default I go with the nearest (i.e. - most recently-mentioned) referent that could feasibly apply.