Language models are prone to generating hallucinations, which significantly undermine their reliability and usefulness in critical applications. Introducing a novel approach that combines semantic relevance scoring with K-means clustering, our methodology significantly enhances the model's accuracy and reduces the occurrence of hallucinations. By integrating these techniques, the model can prioritize contextually appropriate synonyms, resulting in more coherent and factually correct outputs. The experimental results demonstrate substantial improvements in accuracy, semantic relevance, and a marked reduction in hallucinations across various tasks. Comprehensive evaluation using diverse metrics demonstrates the robustness and effectiveness of our modifications, highlighting the potential for practical deployment in applications where accuracy and reliability are paramount. This study affirms the viability of combining semantic relevance scoring with clustering techniques to enhance the performance of language models, contributing to the development of more reliable and effective models for a wide range of applications.