For me, my sleep quality noticeably improved ober night after I stopped all caffeine. I had headaches for about 2 days, then slept the best I had in years. I wasn't a big coffee drinker. 2 cups with breakfast, maybe a black tea or 2 in the day, nothing after about 4pm. But it was obviously still in my system at night.
If you find yourself nr Cambridge. Then I highly recommend. https://www.computinghistory.org.uk/