--- title: Thought Anchors emoji: 🧠 colorFrom: blue colorTo: red sdk: docker app_port: 7860 hf_oauth: true pinned: false models: - sapientinc/HRM-Text-1B --- # Thought Anchors Thought Anchors generates visible reasoning traces from open-weight models and computes sentence-to-sentence influence with gradient x attention attribution. Current product shape: - Hugging Face `Docker Space` first - Hugging Face OAuth sign-in - web UI + API - per-user ephemeral sessions - JSON / CSV export - adaptive CPU / MPS / CUDA loading ## Quick Start Install deps: ```bash uv sync --extra dev ``` Run API: ```bash uv run python -m app.cli.run_api ``` Run CLI: ```bash uv run python -m app.cli.run_prototype "Explain why the derivative of x^2 is 2x" ``` Run tests: ```bash uv run python -m pytest -q ``` ## Main Endpoints - `GET /healthz` - `GET /api/me` - `POST /api/warmup` - `POST /api/analyze` - `GET /api/sessions` - `POST /api/sessions` - `GET /api/sessions/{id}` - `GET /api/sessions/{id}/result` - `GET /api/sessions/{id}/export.json` - `GET /api/sessions/{id}/export.csv` ## Docs - [Hugging Face deployment](./docs/deploy-huggingface.md) - [Runtime and model support](./docs/runtime.md) - [API and product behavior](./docs/api.md) - [Notebook usage](./docs/notebook.md) ## Notebook Colab / Kaggle smoke-test notebook: - [notebooks/hf_space_demo.ipynb](/Users/vibhorkumar/Desktop/codes/cot-anc/notebooks/hf_space_demo.ipynb) ## Key Constraints - Attribution needs `attn_implementation="eager"`. - Model must expose supported decoder layers and attention modules. - Long traces stay capped because analysis uses full backward pass. - Space disk is ephemeral; export results you want to keep.