Using Contrastive Learning to Improve Two-Way Reasoning in Large Language Models: The Obfuscation Task as a Case Study
On the map: LLM reasoning → Test-time compute and efficient thinking
Abstract (arXiv)
This research addresses a fundamental question in AI: whether large language models truly understand concepts or simply recognize patterns. The authors propose bidirectional reasoning,the ability to apply transformations in both directions without being explicitly trained on the reverse direction, as a test for genuine understanding. They argue that true comprehension should naturally allow reversibility. For example, a model that can change a variable name like userIndex to i should also be able to infer that i represents a user index without reverse training. The researchers tested current language models and discovered what they term cognitive specialization: when models are fine-tuned on forward tasks, their performance on those tasks improves, but their ability to reason bidirectionally becomes significantly worse. To address this issue, they developed Contrastive Fine-Tuning (CFT), which trains models using three types of examples: positive examples that maintain semantic meaning, negative examples with different semantics, and forward-direction obfuscation examples. This approach aims to develop deeper understanding rather than surface-level pattern recognition and allows reverse capabilities to develop naturally without explicit reverse training. Their experiments demonstrated that CFT successfully achieved bidirectional reasoning, enabling strong reverse performance while maintaining forward task capabilities. The authors conclude that bidirectional reasoning serves both as a theoretical framework for assessing genuine understanding and as a practical training approach for developing more capable AI systems.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Test-time compute and efficient thinking, one of 17 directions in LLM reasoning. Builds on 11 of its 27 references that are in the map. First posted on arXiv 6 Sep 2025.
Builds on
11 of 27 references.
References · 11
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
- 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,513
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,418
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2013An Empirical Investigation of Catastrophic Forgetting in Gradient-Based Neural Networkscited by 722
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2024RepairAgent: An Autonomous, LLM-Based Agent for Program Repaircited by 232
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
- 2024Towards Translating Real-World Code with LLMs: A Study of Translating to Rustcited by 35
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2023Exploring the Reversal Curse and Other Deductive Logical Reasoning in BERT and GPT-Based Large Language Models
- 2026CORE: Contrastive Reflection Enables Rapid Improvements in Reasoning
- 2025Paying Alignment Tax with Contrastive Learning
- 2024Large Language Models are Contrastive Reasoners
- 2024QCRD: Quality-guided Contrastive Rationale Distillation for Large Language Models
- 2022Can Pretrained Language Models (Yet) Reason Deductively?
- 2026Construting Reverse Thinking: Developing Large Language Models' Reverse Thingking Ability
- 2025Exploring the Hidden Reasoning Process of Large Language Models by Misleading Them