{"id":47944137,"url":"https://github.com/dataiku/kiji-inspector","last_synced_at":"2026-04-04T08:20:40.029Z","repository":{"id":341150714,"uuid":"1151230683","full_name":"dataiku/kiji-inspector","owner":"dataiku","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-03T03:35:37.000Z","size":24033,"stargazers_count":51,"open_issues_count":4,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T12:23:36.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dataiku.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T07:56:27.000Z","updated_at":"2026-04-01T23:00:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dataiku/kiji-inspector","commit_stats":null,"previous_names":["dataiku/kiji-inspector"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dataiku/kiji-inspector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dataiku%2Fkiji-inspector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dataiku%2Fkiji-inspector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dataiku%2Fkiji-inspector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dataiku%2Fkiji-inspector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dataiku","download_url":"https://codeload.github.com/dataiku/kiji-inspector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dataiku%2Fkiji-inspector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T08:20:37.842Z","updated_at":"2026-04-04T08:20:40.017Z","avatar_url":"https://github.com/dataiku.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Kiji Inspector: Mechanistic Interpretability for AI Agent Tool Selection\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/dataiku/kiji-inspector/main/static/kiji_inspector_inverted.png\" alt=\"Kiji Inspector\" width=\"300\"\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/dataiku/kiji-inspector/actions/workflows/ci-core.yml\"\u003e\u003cimg src=\"https://github.com/dataiku/kiji-inspector/actions/workflows/ci-core.yml/badge.svg\" alt=\"CI Core\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/dataiku/kiji-inspector/actions/workflows/ci-extras.yml\"\u003e\u003cimg src=\"https://github.com/dataiku/kiji-inspector/actions/workflows/ci-extras.yml/badge.svg\" alt=\"CI Extras\"\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%20License%202.0-blue\" alt=\"License: Apache 2.0\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/dataiku/kiji-inspector/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/dataiku/kiji-inspector?style=social\" alt=\"GitHub Stars\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/dataiku/kiji-inspector/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/dataiku/kiji-inspector\" alt=\"GitHub Issues\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003cimg src=\"https://img.shields.io/badge/python-%3E%3D3.10-3776AB?logo=python\u0026logoColor=white\" alt=\"Python Version\"\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003cimg src=\"https://img.shields.io/badge/LLMs-responsible-blue\" alt=\"Responsible AI\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/contributions-welcome-brightgreen\" alt=\"Contributions Welcome\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen\" alt=\"PRs Welcome\"\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Status\nThis project is **under heavy active development**. We are planning to release a stable version of the framework in the coming weeks.\n\nIn the meantime, join our [Slack Community](https://join.slack.com/t/dataiku-opensource/shared_invite/zt-3o6yq14rp-FTtAHZYhyru~jLZ~S6xPLA)\n\nLearn more about our approach and early results:\n\n* [Paper](paper/Opening%20the%20Black%20Box%20Mechanistic%20Interpretability%20of%20Agent%20Tool%20Selection%20with%20Sparse%20Autoencoders.pdf)\n* [Presentation](presentation/Opening%20the%20Black%20Box%20Mechanistic%20Interpretability%20of%20Agent%20Tool%20Selection%20with%20Sparse%20Autoencoders.pdf)\n\n---\n\n## What This Project Does\n\nThis project trains **Sparse Autoencoders (SAEs)** on the internal activations of an AI agent to understand *why* it selects specific tools. Given a user request like \"Search our docs for API limits,\" the agent must choose between tools (e.g., `internal_search` vs `web_search`). We extract the model's hidden representations at the moment of that decision, decompose them into interpretable features using a JumpReLU SAE, and validate the resulting explanations through automated fuzzing and causal ablation experiments.\n\nThe key insight: train the SAE on **raw activations** (not difference vectors), then use **contrastive pairs** post-hoc to identify which learned features correspond to specific tool-selection decisions. This preserves the SAE's general feature dictionary while enabling targeted analysis of decision-relevant features.\n\n## Install\n\nFor loading and running pretrained SAEs:\n\n```bash\npip install kiji-inspector\n```\n\nFor the full extraction, training, and analysis workflow:\n\n```bash\npip install 'kiji-inspector[train]'\n```\n\n`kiji-inspector[full]` is also available as an alias for the same full stack.\n\n## Quick Start\n\n```python\nfrom kiji_inspector import SAE\n\nsae, feature_descriptions = SAE.from_pretrained(\n    base_model=\"nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16\",\n    layer=20,\n)\n\nfeatures = sae.encode(activations)\nreconstruction = sae.decode(features)\n```\n\nTraining and data-generation entrypoints live under the package namespace:\n\n```bash\npython -m kiji_inspector.generate_pairs 1300\npython -m kiji_inspector.pipeline --layers 10 20 30\n```\n\n## Local vLLM patches\n\nFor local experiments that require the custom `vllm` extraction changes, rebuild the environment and apply the patch set from the repository root:\n\n```bash\nuv sync --no-cache --refresh --extra full --group dev\n./patches/apply-patch.sh\n```\n\nThe apply script installs every `*.patch` file under [patches](patches/) in lexical order:\n\n- `01_allow_extract_hidden_states.patch`\n- `02_support_nemotron_models.patch`\n- `03_support_gemma3_models.patch`\n\nAdditional workflow details live in [patches/README_PATCH.md](patches/README_PATCH.md).\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! Whether you're fixing a bug, improving documentation, or proposing a new feature, your help is appreciated.\n\n### Ways to Contribute\n\n- **Report Bugs** - [Open an issue](https://github.com/dataiku/kiji-inspector/issues) with steps to reproduce\n- **Improve Docs** - Documentation PRs are always welcome\n- **Submit Features** - Open an issue to discuss your idea before submitting a PR\n- **Share Feedback** - [Start a discussion](https://github.com/dataiku/kiji-inspector/discussions)\n\n### Community\n\n- **Slack** - [Join our community](https://join.slack.com/t/dataiku-opensource/shared_invite/zt-3o6yq14rp-FTtAHZYhyru~jLZ~S6xPLA) to ask questions and connect with other contributors\n- **Contributors** - See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the list of people who have contributed\n\n---\n\n## 📄 License\n\nCopyright (c) 2026 Dataiku SAS\n\nThis project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataiku%2Fkiji-inspector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdataiku%2Fkiji-inspector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdataiku%2Fkiji-inspector/lists"}