Skip to content

Labs → 实验 ​

⚠️ 本页已合并到 实验目录。/labs/ 不再是顶级导航;如果你从旧链接进来,请前往 /examples/ 查看完整实验列表。

实验目录现在按"独立可运行的命令 + 预期输出"组织,每个实验对应正文的一章。如果你想看每章实验与 llm_core/ 模块 / 测试文件的对应表,原 Labs 总览中的映射仍有效:

章节实验模块测试
第4章autogradpython/llm_core/autograd.pytest_autograd.py
第5章Bigram/MLPbigram.py, mlp_lm.pytest_bigram_mlp.py
第6章BPEbpe.pytest_bpe.py
第7–8章Tensor/Attention/GPTtensor_grad.py, attention.py, gpt.pytest_attention_gpt.py
第9章TinyGPTpython/llm_train/test_trainable_tinygpt.py
第10章RoPE + KV Cachekv_cache.py, swiglu.py, rmsnorm.py, paged_kv.pytest_w07_algorithms.py
第11章SFT/LoRAalign.pytest_align_kv.py
第13章RAG/ACLpython/agent_core/rag.py, embedding.pytest_rag_acl.py
第15章Agent/MCPpython/agent_core/engine.py, tools.pytest_tool_policy.py, test_mcp_adapter.py
第21章Eval/安全python/agent_core/eval.pytest_eval_spec.py
第22章Capstone集成pnpm verify + 成果验收

跑测试的命令:

bash
export PYTHONPATH="$PWD/python"
pnpm test:labs
python -m pytest python/tests -q --tb=short

完整文档见 实验目录。

私有学习站 · 原理从零构建 · 勿提交个人隐私或密钥