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

Paper · arXiv 2501.12226 · Published January 21, 2025
Reasoning Logic Internal RulesSentiment Semantics Toxic DetectionsLinguistics, NLP, NLUPrompts 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.

To address the intensive manual efforts required by Manual-CoT, the Auto-CoT paradigm has been proposed (Zhang et al. 2022). This method automates the generation of reasoning chains by clustering related questions and selecting a representative question from each cluster to generate a reasoning chain using simple heuristics.

This method innovatively combines clustering with dynamic prompt optimization to enhance the adaptability and precision in reasoning tasks. By segmenting the dataset into distinct clusters, CDW-CoT harnesses the unique characteristics of each group to generate a tailored prompt candidate pool. For each cluster, we calculate an optimal prompt probability distribution, finely tuned to the specific demands and nuances of the data. Additionally, our framework incorporates a distance-weighted prompt selection mechanism that dynamically adapts reasoning strategies based on the proximity of test instances to the cluster centers.