Usually you do it after, however i have seen techniques of doing it before. If you use exactly the same variabiles (water, nutes quantity). For example if after adding nutes PH goes up 2 points each time you add them you can treat the water to go down 2 points before adding the nutes so when the nutes are added the ph will stabilize at +2 points @7 or whatever you want it.