Synonymy holds between senses, not between words. “Keen” and “sharp” are synonyms in the sense of drawing fine distinctions — a keen mind, a sharp mind — and not synonyms in the sense of harsh, where sharp pairs with tart and keen does not appear at all. A thesaurus that pools all senses of a word into one list produces sets whose members cannot substitute for each other in your sentence.
What a synonym actually is
In the lexical database behind this dictionary, meanings are the primary objects. A meaning is a set of words that can express it, and that set is the synonym list. “Sharp” does not have synonyms; each of its 15 senses does.
The consequence is immediate and easy to miss. Two words are synonyms only relative to a sense, so the true statement is never “keen means sharp”. It is “keen and sharp share this sense and not that one”.
That is why every synonym list on this site is printed inside a sense rather than at the top of the entry. It is more work to render and it is the only arrangement that is true.
The example, in full
Sharp, sense 3, is “having or demonstrating ability to recognize or draw fine distinctions”. Its recorded synonyms are acute, discriminating, incisive, keen and knifelike. So keen is a synonym of sharp — here.
Sharp, sense 5, is “harsh”. Its recorded synonyms are sharp-worded and tart. Keen is absent. A sharp remark is not a keen remark, and no amount of the two words being “synonyms” makes that substitution work.