CDW-CoT: Clustered Distance-Weighted Chain-of-Thoughts Reasoning

Paper · arXiv 2501.12226 · Published January 21, 2025
Logical Reasoning and Internal RulesSentiment, Semantics, and Toxicity DetectionNLP and LinguisticsPrompts and Prompting

Large Language Models (LLMs) have recently achieved impressive results in complex reasoning tasks through Chain of Thought (CoT) prompting. However, most existing CoT methods rely on using the same prompts, whether manually designed or automatically generated, to handle the entire dataset. This one-size-fits-all approach may fail to meet the specific needs arising from the diversities within a single dataset. To solve this problem, we propose the Clustered Distance-Weighted Chain of Thought (CDW-CoT) method, which dynamically constructs prompts tailored to the characteristics of each data instance by integrating clustering and prompt optimization techniques. Our method employs clustering algorithms to categorize the dataset into distinct groups, from which a candidate pool of prompts is selected to reflect the inherent diversity within the dataset. For each cluster, CDW-CoT trains the optimal prompt probability distribution tailored to their specific characteristics. Finally, it dynamically constructs a unique prompt probability distribution for each test instance, based on its proximity to cluster centers, from which prompts are selected for reasoning.

Introduction. Recent advancements in LLMs, such as GPT-3 (Brown et al. 2020), LLama2 (Touvron et al. 2023), and Llama3 (Dubey et al. 2024), have significantly enhanced their capability to tackle complex reasoning tasks. Some studies (Brown et al. 2020; Thoppilan et al. 2022) have demonstrated LLMs’ impressive performance in decomposing multi-step problems into manageable intermediate steps, resulting in more accurate and contextually relevant answers. A technique that has gained prominence in this context is CoT prompting, which systematically structures the reasoning process into a series of intermediate steps. This method has been shown to significantly improve the model’s performance on complex tasks across various domains (Wei et al. 2022). Initially, CoT prompting involved embedding manually crafted exemplars within the model’s prompt to guide its reasoning process—a method that was effective but laborintensive and not scalable (Wei et al. 2022). This approach evolved into Zero-Shot-CoT (Kojima et al.

Discussion / Conclusion. In this paper, we propose a novel CoT method named CDW- CoT to enhance the adaptability and accuracy of LLMs in complex reasoning tasks. Our method introduces the clustering to categorize the datasets into tailored prompt pools, improving the representative ability to diverse data characteristics. It calculates an optimal prompt probability distribution for each cluster, enabling targeted reasoning that aligns with its unique characteristics. By designing the distanceweighted prompt selection, CDW-CoT dynamically adjusts the reasoning strategies based on the proximity to cluster centers, demonstrating superior performance over traditional methods across six datasets. Future work includes reducing computational overhead and extending applicability to multimodal tasks like image-text reasoning.