Code and pre-computed results for the paper:
Geometric Chain-of-Fit Detection: Attractor Commitment and Post-Decisional Reasoning in Large Language Models
Agus Sudjianto
GCoF analyzes hidden-state dynamics during token-by-token generation to determine whether chain-of-thought (CoT) reasoning causally influences decisions or merely rationalizes pre-determined outputs. The framework introduces commitment time detection, semantic alignment energies, trajectory curvature measures, and layerwise logit probing to quantify when and where decisions emerge inside the network.
- Python 3.10+
- CUDA-capable GPU with ~15 GB VRAM
- ~14.5 GB disk space for model weights
git clone https://github.com/asudjianto-xml/GCoF.git
cd GCoF
pip install -r requirements.txtDownload DeepSeek-R1-Distill-Qwen-7B into the models/ directory:
# Option 1: Using huggingface-cli
huggingface-cli download deepseek-ai/DeepSeek-R1-Distill-Qwen-7B --local-dir models/DeepSeek-R1-Distill-Qwen-7B
# Then set the environment variable to point to your download:
export GCOF_MODEL_PATH=models/DeepSeek-R1-Distill-Qwen-7BAlternatively, the code defaults to the HuggingFace cache layout under models/.
Main experiments (Table 1 — all 14 tasks):
python run_gcof.pyQuick test on a single category:
python run_gcof.py --tasks arithmetic --max-tokens 512 --skip-semanticRevision analyses (phase transition, cross-validation, correctness — Sections 8.6–8.8):
python run_revision_analyses.pyThreshold sensitivity (Appendix A):
python run_robustness.pyMulti-seed robustness (Appendix B):
python run_multiseed.py.
├── paper.tex # Paper source
├── references.bib # Bibliography
├── figures/ # Paper figures (18 PNGs)
├── gcof/ # Main Python package
│ ├── config.py # Paths, hyperparameters, dataclasses
│ ├── model_loader.py # Load model & tokenizer
│ ├── generation.py # Autoregressive generation with hidden-state hooks
│ ├── trajectory.py # Velocity, curvature, bivector norms
│ ├── commitment.py # Commitment time detection via layerwise logit probing
│ ├── semantic.py # PCA-based semantic subspace analysis
│ ├── gcof_score.py # Composite GCoF score
│ ├── experiments.py # Task definitions (14 tasks, 4 categories)
│ ├── visualize.py # Plotting utilities
│ └── utils.py # GPU cleanup, JSON I/O, timer
├── run_gcof.py # Main experiment runner (Table 1)
├── run_revision_analyses.py # Phase transition, cross-val, correctness
├── run_robustness.py # Threshold sensitivity + multi-seed
├── run_multiseed.py # Standalone multi-seed analysis
├── save_robustness_results.py # Threshold results utility
├── test_cot.py # Basic model loading test
├── results/ # Pre-computed results (JSON + PNG)
└── requirements.txt
Paper available at: https://papers.ssrn.com/abstract=6286338
@article{sudjianto2025gcof,
title={Geometric Chain-of-Fit Detection: Attractor Commitment and
Post-Decisional Reasoning in Large Language Models},
author={Sudjianto, Agus},
year={2026},
journal={SSRN},
url={https://papers.ssrn.com/abstract=6286338}
}