NeuralDebug
AI-powered debugging framework for software and LLM reasoning. Part of the DeepRhapsody project.
Use this skill when asked to debug a program, diagnose a crash, analyze a core dump, inspect LLM reasoning, detect hallucinations, or fine-tune a model.
What NeuralDebug Does
🔧 Software Debugging (8 Languages)
Debug
Python, C/C++, C#, Rust, Java, Go, Node.js/TypeScript, and Ruby using real debuggers — not code reading. NeuralDebug drives GDB, LLDB, CDB, JDB, Delve, Node Inspector, and rdbg via a unified natural-language interface.
🧠 LLM Debugging
Step through transformer forward passes
layer by layer. Run interpretability techniques to understand
why a model produces a given output: Logit Lens, Attention Analysis, Probing, Activation Patching, and custom analysis sandboxes.
🎯 LLM Fine-Tuning
Inject missing knowledge into GPT-2 family models using LoRA. Diagnose → fine-tune → verify in a single workflow.
Installation
CODEBLOCK0
Quick Start: Software Debugging
Interactive Mode (persistent debug session)
CODEBLOCK1
One-Shot Mode (quick breakpoint capture)
CODEBLOCK2
Supported Languages
| Language | Script | Backend |
|---|
| Python | INLINECODE0 | bdb (stdlib) |
| C/C++ |
cpp_debug_session.py | GDB, LLDB, or CDB |
| C# |
csharp_debug_session.py | netcoredbg |
| Rust |
rust_debug_session.py | rust-gdb / LLDB |
| Java |
java_debug_session.py | JDB |
| Go |
go_debug_session.py | Delve |
| Node.js/TS |
nodejs_debug_session.py | Node Inspector |
| Ruby |
ruby_debug_session.py | rdbg |
All scripts live in src/NeuralDebug/ and share the same command interface.
Quick Start: LLM Debugging
CODEBLOCK3
LLM Models Supported
Any HuggingFace causal LM with a built-in adapter:
- - GPT-2 family: distilgpt2, gpt2, gpt2-medium, gpt2-large, gpt2-xl
- Llama family: Llama, Mistral, Qwen, DeepSeek
- Custom models: implement
ModelAdapter and register
Quick Start: LLM Fine-Tuning
CODEBLOCK4
Architecture
NeuralDebug uses a client-server architecture over TCP/JSON:
CODEBLOCK5
Every command returns structured JSON — parseable by any AI agent.
Platform Support
- - Windows (CDB, Visual Studio debugger)
- Linux (GDB, LLDB)
- macOS (LLDB, GDB)
Links
- - Repository: https://github.com/DennySun2020/DeepRhapsody
- Documentation: https://github.com/DennySun2020/DeepRhapsody/wiki
- Issues: https://github.com/DennySun2020/DeepRhapsody/issues
See the references/ folder for detailed command documentation:
- -
software-debugging.md — full command reference for all 8 languages - INLINECODE12 — interpretability techniques and LLM commands
- INLINECODE13 — LoRA fine-tuning workflow and configuration
NeuralDebug
AI驱动的调试框架,适用于软件和LLM推理。属于DeepRhapsody项目的一部分。
当需要调试程序、诊断崩溃、分析核心转储、检查LLM推理、检测幻觉或微调模型时,请使用此技能。
NeuralDebug的功能
🔧 软件调试(8种语言)
使用真正的调试器(而非代码阅读)调试
Python、C/C++、C#、Rust、Java、Go、Node.js/TypeScript和Ruby。NeuralDebug通过统一的自然语言接口驱动GDB、LLDB、CDB、JDB、Delve、Node Inspector和rdbg。
🧠 LLM调试
逐层遍历Transformer前向传播。运用可解释性技术理解模型
为何产生特定输出:Logit Lens、注意力分析、探针分析、激活修补和自定义分析沙箱。
🎯 LLM微调
使用LoRA向GPT-2系列模型注入缺失知识。在单一工作流中完成诊断→微调→验证。
安装
bash
克隆仓库
git clone https://github.com/DennySun2020/DeepRhapsody.git
cd DeepRhapsody
安装Python依赖
pip install torch transformers
用于微调(可选)
pip install peft==0.7.1
快速入门:软件调试
交互模式(持久调试会话)
bash
为任何支持的语言启动调试服务器
python src/NeuralDebug/python
debugsession.py serve --port 5678
通过自然语言发送命令
python src/NeuralDebug/python
debugsession.py cmd -p 5678 launch my_script.py
python src/NeuralDebug/python
debugsession.py cmd -p 5678 set_breakpoint 42
python src/NeuralDebug/python
debugsession.py cmd -p 5678 continue
python src/NeuralDebug/python
debugsession.py cmd -p 5678 inspect
单次模式(快速断点捕获)
bash
python src/NeuralDebug/pythondebugger.py debug myscript.py --breakpoint 42 --output result.json
支持的语言
| 语言 | 脚本 | 后端 |
|---|
| Python | pythondebugsession.py | bdb(标准库) |
| C/C++ |
cpp
debugsession.py | GDB、LLDB或CDB |
| C# | csharp
debugsession.py | netcoredbg |
| Rust | rust
debugsession.py | rust-gdb / LLDB |
| Java | java
debugsession.py | JDB |
| Go | go
debugsession.py | Delve |
| Node.js/TS | nodejs
debugsession.py | Node Inspector |
| Ruby | ruby
debugsession.py | rdbg |
所有脚本位于src/NeuralDebug/目录下,共享相同的命令接口。
快速入门:LLM调试
bash
启动LLM调试服务器
python src/NeuralDebug/llm/llm
debugsession.py serve -m gpt2-medium -p 5680
向模型提问
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 start The capital of Japan is
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 generate 20
可解释性:答案从何处涌现?
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 logit_lens
可解释性:哪些注意力头关注Japan?
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 attention 3
可解释性:每层编码了什么知识?
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 probe next_token
可解释性:预测是否特定于日本?
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 patch The capital of France is
支持的LLM模型
任何内置适配器的HuggingFace因果语言模型:
- - GPT-2系列:distilgpt2、gpt2、gpt2-medium、gpt2-large、gpt2-xl
- Llama系列:Llama、Mistral、Qwen、DeepSeek
- 自定义模型:实现ModelAdapter并注册
快速入门:LLM微调
bash
创建配置文件(JSON)
cat > ft_config.json << EOF
{
facts: [
Dr. Elena Vasquez is the director of Horizon Research Labs,
Dr. Elena Vasquez leads Horizon Research Labs
],
verification_prompt: Dr. Elena Vasquez is the director of,
expected_token: Horizon,
config: { num
steps: 150, lorar: 16, lora
alpha: 32, learningrate: 2e-4 }
}
EOF
运行微调(使用与LLM调试器相同的服务器)
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 -t 600 finetune ft_config.json
验证
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 start Dr. Elena Vasquez is the director of
python src/NeuralDebug/llm/llm
debugsession.py cmd -p 5680 generate 20
架构
NeuralDebug采用客户端-服务器架构,基于TCP/JSON通信:
AI代理(OpenClaw、Copilot、Claude等)
│
▼
调试会话脚本(TCP客户端)
│
▼
NeuralDebug服务器(可配置端口的TCP服务器)
│
▼
真实调试器后端(GDB/LLDB/CDB/PyTorch钩子等)
每条命令返回结构化JSON——任何AI代理均可解析。
平台支持
- - Windows(CDB、Visual Studio调试器)
- Linux(GDB、LLDB)
- macOS(LLDB、GDB)
链接
- - 仓库:https://github.com/DennySun2020/DeepRhapsody
- 文档:https://github.com/DennySun2020/DeepRhapsody/wiki
- 问题反馈:https://github.com/DennySun2020/DeepRhapsody/issues
详细命令文档请参阅references/文件夹:
- - software-debugging.md — 全部8种语言的完整命令参考
- llm-debugging.md — 可解释性技术和LLM命令
- llm-finetuning.md — LoRA微调工作流和配置