I've been working on an LLM application that often needs to utilize relative days of the week from natural language - e.g if today is 2025-01-28 then this Friday should be 2025-01-31 however as much as I try to prompt and feed it dates, most LLMs I try perform inconsistently and poorly on this. e.g often it would say this Friday is an incorrect date or get the date correct but the day wrong
Examples of relative dates include: 2 days from now, next Thursday, last Monday etc
Has anyone had experience managing to work with relative dates in an LLM application effectively?
Just a note for the future for anyone that stumbles across this.
My original approach was to list out dates and then next 7 days below
e.g
Options:
03/03/2025 12:00
04/04/2025 14:00
05/03/2025 16:00
Next 3 days and their corresponding days of the week:
3 March 2025 - Monday
4 March 2025 - Tuesday
5 March 2025 - Wednesday
This approach typically led to hallucinated days of the week. Although it might not seem like much of a change the below worked much better for me:
Options:
03/03/2025 12:00 - Today at 12:00
04/04/2025 14:00 - Tomorrow at 14:00
05/03/2025 16:00 - This Wednesday at 16:00
By interpolating each date to explicitly declare the relativity next to each date I was able to get much better results, something that seems obvious now but wasn't during my initial implementation