Just before the referendum. The lead at the time the referendum was called was much wider. One poll even had 66% remain in June 2015, while the Referendum Bill was in parliament.
Well, I just assumed that when you said "polls before the Brexit referendum" that you mean polls that were made before the referendum, and not when the referendum was called.