[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-seal-rg--recurrent-pretraining":3,"tool-seal-rg--recurrent-pretraining":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",143909,2,"2026-04-07T11:33:18",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":89,"env_os":90,"env_gpu":91,"env_ram":92,"env_deps":93,"category_tags":104,"github_topics":105,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":110,"updated_at":111,"faqs":112,"releases":146},5029,"seal-rg\u002Frecurrent-pretraining","recurrent-pretraining","Pretraining and inference code for a large-scale depth-recurrent language model","recurrent-pretraining 是一个专注于大规模“深度循环语言模型”训练与推理的开源项目，核心成果为 Huginn-0125 模型。它旨在解决传统模型在测试时计算能力受限的问题，通过独特的“潜在推理”机制和循环深度架构，显著提升了模型在复杂逻辑推理及数学任务上的表现。\n\n该项目不仅提供了完整的预训练代码，还包含了针对 AMD GPU 集群（如 Frontier 超算）的大规模分布式训练优化方案，有效解决了在特定硬件环境下进行万卡级并行训练时的通信稳定性难题。此外，项目集成了兼容 Hugging Face 的轻量化建模文件，并支持通过 lm-eval 框架复现论文中的各项基准测试成绩，甚至已适配 vLLM 以实现高速推理。\n\nrecurrent-pretraining 非常适合 AI 研究人员、大模型开发者以及对新型神经网络架构感兴趣的技术团队使用。对于希望探索超越传统 Transformer 架构、研究如何在推理阶段动态扩展计算资源，或需要在 AMD 硬件生态中部署大规模模型的从业者来说，这是一份极具参考价值的技术实现范本。","# Code for Pretraining and Inference of Huginn-0125 -  a Depth-Recurrent Model\n\nThis repo contains the code we used to train a recurrent-depth model at scale on 4096 AMD GPUs on Frontier. All details on this model can be found in the tech report: \"Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach\" (https:\u002F\u002Fwww.arxiv.org\u002Fabs\u002F2502.05171). The final model is `huginn-0125`, which can be found here: https:\u002F\u002Fhuggingface.co\u002Ftomg-group-umd\u002Fhuginn-0125. \n\nOver time, we have also accumulated a good amount of code used for testing and inference, especially the HF-compatible modeling file `recpre\u002Fraven_modeling_minimal.py` and inference scripts in `evaluate_raven`. Benchmarking through `lm-eval` is supported, see more infos below.\n\nThis repo was originally based on a fork of https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Flitgpt, which was very helpful to bootstrap our efforts, but little `litgpt` code remains at this stage. Code in this repository was written by Jonas Geiping, John Kirchenbauer, Sean McLeish, Khalid Saifullah, Manli Shu, Neel Jain, Siddarth Singh, Abhimanyu Hans, Monte Hoover and Prajwal Singhanaia.\n\nThis repo also contains all code we used to prepare the model's  tokenizer and data, mostly in `scripts\u002F`. \n\nI (Jonas) do not necessarily think that you should pretrain your own model with this implementation, but I hope it serves as a useful reference for the exact choices we took to run this model (at all), and how we ran this model given the limitations of AMD systems. **If you are working with either of these, feel free to always raise an issue asking for more details.**\n\n\n## Code Setup:\n*  The actual model definition is in `recpre\u002Fmodel_dynamic.py`.\n*  The training is orchestrated from `train.py`.\n*  Model shapes can be found in `recpre\u002Fmodel_registry.py`. The final model is the shape `nebel-raven-3.5b`\n*  The configurations for our two large-scale runs are in `launch_configs\u002F`. \n*  The environment flags can be read out of `launch_frontier.py`.\n* The parallelism implementation is deep down in `recpre\u002Futils.py`, in a class called `SimpleFabric`. `_allreduce_chunk_stream` was used for inter-node communication, which was the only solution to remedy RCCL hangs at scale when using the OFI plugin, at the time of writing.\n\nThe code to run the model at inference is probablier easier to look at, if you just want to see the model architecture.\nIt can be found on all Huggingface repos of this model, and at `recpre\u002Fraven_modeling_minimal.py`.\n\n\n## Reproducing Benchmark Scores\n\nAll benchmark scores reported in the paper are computed using the lm-eval harness, except for the code tasks, which are executed using bigcode. For default benchmarks, you can run `lm-eval` like so (no installation necessary):\n\n```\nlm_eval --model hf --model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32 --tasks hellaswag --batch_size=auto --num_fewshot=0\n```\n\nFor GSM8k, \"w\u002F sys. prompt\" refers to the following invocation, using this system prompt, and chat formatting:\n```\nlm_eval --model hf  \\\n--model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32  \\ \n--tasks gsm8k_cot  --batch_size=auto  --apply_chat_template=True --fewshot_as_multiturn \\\n--system_instruction=\"You are a helpful assistant that can assist users with mathematical reasoning.\"  \\ \n```\n\nTo reproduce humaneval scores, you nowadays do not need to install bigcode-eval directly, but you can also use the lm-eval harness, like so\n``` \nHF_ALLOW_CODE_EVAL=1 accelerate launch -m lm_eval \\\n--model hf --model_args pretrained=tomg-group-umd\u002Fhuginn-0125,mean_recurrence=32,trust_remote_code=True,dtype=bfloat16  \\\n--tasks humaneval_instruct --batch_size=1 --num_fewshot=0  \\\n--output_path=outputs\u002Fheval --confirm_run_unsafe_code \\\n--apply_chat_template=True \\\n --gen_kwargs=do_sample=True,temperature=0.2,top_p=0.95\n```\n\n## Fast Inference\n\nFast inference through vllm is now supported. See the `vllm` folder for more details. The plugin for this model can be installed into any recent vllm v1 version.\n\n## Data\n\nWe have uploaded the entire training dataset to Hugging Face, you can find it here: https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftomg-group-umd\u002Fhuginn-dataset.\nThis upload contains 4096 parquet files (for training and validation each), exactly corresponding to the 4096 AMD GPUs used to train the model data-parallel. Each row contains 4096+1 tokens, so one training step (we train with a local microbatch size of 1) corresponds to exactly one row from each file.\n\n## The grim details\n\nWhat steps would you have to take if you were to replicate this model training and data collection run on an AMD cluster? Follow this outline (and please ask for more details when you're stuck).\n\n1. Use `scripts\u002Ftokenizer_generation.py` to generate the tokenizer. Before you run the script, adapt all paths for your system. Data download is automatic. You also need the BPE trainer from https:\u002F\u002Fgithub.com\u002Fgautierdag\u002Fbpeasy.\n2. Run `scripts\u002Fscalable_data_download.py` to download all raw datasets. The name of the script is a lie, this is not so scalable, it will take a long time, lots of space and fail due to random errors. You'll also notice that there a number of extra rules hardcoded in the script for various badly formatted datasets. By the time you run this script, some of these authors may have updated their dataset breaking assumptions set here. You would get an error in that case, and would need to investigate that particular dataset. After this step, you'd have all raw datasets in a `staging` folder.\n3. Run the `scripts\u002Fparquet_to_parquet_tokenizer.py` to generate the tokenized dataset. Again, remember to set your paths correctly.\n4. After tokenizing, run the `scripts\u002Fparquet_to_parquet_shuffler.py` to shuffle the data.\n5. Define your own launch config in `launch_configs\u002F` or use our config, and launch `train.py` onto your cluster. We launched onto frontier with the launcher file called `launch_frontier.py`, but this will not help you on a different cluster. Follow your cluster's best practices and environment flag guidelines when setting up a large-scale run. The core command is just `python train.py --config=launch_configs\u002Fyour_config.yaml`.\n6. Watch it train (hopefully). You can add additional segments to the training run as needed.\n\n\n## License\nThis code is released under an [apache-2.0](https:\u002F\u002Fchoosealicense.com\u002Flicenses\u002Fapache-2.0\u002F)  license. Part of the code is licensed under the Lightning AI Apache-2.0 license.\n\n## Citation\n```\n@article{geiping_scaling_2025,\n  title = {Scaling up {{Test-Time Compute}} with {{Latent Reasoning}}: {{A Recurrent Depth Approach}}},\n  shorttitle = {Scaling up {{Test-Time Compute}} with {{Latent Reasoning}}},\n  author = {Geiping, Jonas and McLeish, Sean and Jain, Neel and Kirchenbauer, John and Singh, Siddharth and Bartoldson, Brian R. and Kailkhura, Bhavya and Bhatele, Abhinav and Goldstein, Tom},\n  year = {2025},\n  month = feb,\n  eprint = {2502.05171},\n  primaryclass = {cs},\n  publisher = {arXiv},\n  doi = {10.48550\u002FarXiv.2502.05171},\n  url = {http:\u002F\u002Farxiv.org\u002Fabs\u002F2502.05171},\n  urldate = {2025-02-10},\n  archiveprefix = {arXiv},\n  keywords = {Computer Science - Computation and Language,Computer Science - Machine Learning},\n  journal = {arxiv:2502.05171[cs]}\n}\n```\n\n## Contact\nPlease, feel free to contact us with any questions, or open an issue!\n","# Huginn-0125 的预训练与推理代码——一种深度递归模型\n\n本仓库包含我们在 Frontier 超级计算机上，使用 4096 张 AMD GPU 大规模训练递归深度模型所用的代码。关于该模型的所有细节均可在技术报告《通过潜在推理扩展测试时计算：一种递归深度方法》中找到（https:\u002F\u002Fwww.arxiv.org\u002Fabs\u002F2502.05171）。最终模型名为 `huginn-0125`，可在以下链接获取：https:\u002F\u002Fhuggingface.co\u002Ftomg-group-umd\u002Fhuginn-0125。\n\n随着时间推移，我们还积累了不少用于测试和推理的代码，尤其是与 Hugging Face 兼容的建模文件 `recpre\u002Fraven_modeling_minimal.py` 以及位于 `evaluate_raven` 中的推理脚本。支持通过 `lm-eval` 进行基准测试，更多信息见下文。\n\n本仓库最初基于 https:\u002F\u002Fgithub.com\u002FLightning-AI\u002Flitgpt 的一个分支，该分支对我们起步阶段的工作帮助很大，但目前几乎已不保留 `litgpt` 的代码。本仓库中的代码由 Jonas Geiping、John Kirchenbauer、Sean McLeish、Khalid Saifullah、Manli Shu、Neel Jain、Siddarth Singh、Abhimanyu Hans、Monte Hoover 和 Prajwal Singhanaia 共同编写。\n\n此外，本仓库还包含了我们用于准备模型分词器及数据的所有代码，主要位于 `scripts\u002F` 目录下。\n\n我个人并不一定建议您使用此实现来预训练自己的模型，但我希望它能作为一份有用的参考，展示我们为运行该模型所做出的具体选择，以及在 AMD 系统的限制下如何实际运行该模型。**如果您正在使用其中任何一项，请随时提出问题以获取更多细节。**\n\n\n## 代码设置：\n* 实际的模型定义位于 `recpre\u002Fmodel_dynamic.py`。\n* 训练流程由 `train.py` 协调。\n* 模型结构信息可在 `recpre\u002Fmodel_registry.py` 中找到。最终模型的结构为 `nebel-raven-3.5b`。\n* 我们的两次大规模运行配置位于 `launch_configs\u002F` 目录中。\n* 环境标志可从 `launch_frontier.py` 中读取。\n* 并行化实现深藏于 `recpre\u002Futils.py` 中的一个名为 `SimpleFabric` 的类中。在撰写本文时，为了在使用 OFI 插件的大规模场景下解决 RCCL 死锁问题，我们采用了 `_allreduce_chunk_stream` 方法进行节点间通信，这是唯一的解决方案。\n\n如果您只想了解模型架构，那么用于推理的代码可能更容易阅读。这些代码可以在该模型的所有 Hugging Face 仓库中找到，也可以在 `recpre\u002Fraven_modeling_minimal.py` 中查看。\n\n\n## 重现基准测试分数\n\n论文中报告的所有基准测试分数均使用 lm-eval 测试框架计算得出，除了代码任务，后者是使用 bigcode 执行的。对于默认基准测试，您可以按如下方式运行 `lm-eval`（无需安装）：\n\n```\nlm_eval --model hf --model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32 --tasks hellaswag --batch_size=auto --num_fewshot=0\n```\n\n对于 GSM8k 任务，“带系统提示”的版本是指使用以下系统提示和聊天格式的调用方式：\n```\nlm_eval --model hf  \\\n--model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32  \\ \n--tasks gsm8k_cot  --batch_size=auto  --apply_chat_template=True --fewshot_as_multiturn \\\n--system_instruction=\"You are a helpful assistant that can assist users with mathematical reasoning.\"  \\ \n```\n\n要重现 humaneval 分数，如今无需直接安装 bigcode-eval，也可以使用 lm-eval 测试框架，具体命令如下：\n``` \nHF_ALLOW_CODE_EVAL=1 accelerate launch -m lm_eval \\\n--model hf --model_args pretrained=tomg-group-umd\u002Fhuginn-0125,mean_recurrence=32,trust_remote_code=True,dtype=bfloat16  \\\n--tasks humaneval_instruct --batch_size=1 --num_fewshot=0  \\\n--output_path=outputs\u002Fheval --confirm_run_unsafe_code \\\n--apply_chat_template=True \\\n --gen_kwargs=do_sample=True,temperature=0.2,top_p=0.95\n```\n\n## 快速推理\n\n现已支持通过 vllm 进行快速推理。更多详情请参阅 `vllm` 文件夹。适用于该模型的插件可安装到任何较新的 vllm v1 版本中。\n\n## 数据\n\n我们已将整个训练数据集上传至 Hugging Face，您可在此处找到：https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftomg-group-umd\u002Fhuginn-dataset。该上传包含 4096 个 Parquet 文件（分别用于训练和验证），正好对应用于数据并行训练的 4096 张 AMD GPU。每行包含 4096+1 个 token，因此一次训练步骤（我们采用局部微批次大小为 1）恰好对应每个文件的一行。\n\n## 细节说明\n\n如果您想在 AMD 集群上复现本次模型训练和数据收集流程，需要采取哪些步骤呢？请按照以下步骤操作（遇到困难时请随时咨询更多细节）：\n\n1. 使用 `scripts\u002Ftokenizer_generation.py` 生成分词器。运行脚本前，请根据您的系统调整所有路径。数据下载是自动进行的。您还需要来自 https:\u002F\u002Fgithub.com\u002Fgautierdag\u002Fbpeasy 的 BPE 训练工具。\n2. 运行 `scripts\u002Fscalable_data_download.py` 下载所有原始数据集。该脚本名称名不副实，实际上并不具备真正的可扩展性，耗时较长且会占用大量存储空间，并可能因随机错误而失败。您还会发现脚本中针对一些格式不良的数据集硬编码了若干规则。在您运行此脚本时，某些数据集作者可能已经更新了他们的数据集，从而打破了此处设定的假设。在这种情况下，您可能会遇到错误，需要进一步调查相关数据集。完成此步骤后，所有原始数据集将被放置在 `staging` 文件夹中。\n3. 运行 `scripts\u002Fparquet_to_parquet_tokenizer.py` 生成分词后的数据集。同样，请务必正确设置路径。\n4. 分词完成后，运行 `scripts\u002Fparquet_to_parquet_shuffler.py` 对数据进行打乱。\n5. 在 `launch_configs\u002F` 目录中定义您自己的启动配置，或直接使用我们的配置，然后在您的集群上启动 `train.py`。我们是在 Frontier 超级计算机上使用名为 `launch_frontier.py` 的启动脚本进行训练的，但这对其他集群并不适用。设置大规模运行时，请遵循您所在集群的最佳实践和环境标志指南。核心命令仅为 `python train.py --config=launch_configs\u002Fyour_config.yaml`。\n6. 观察训练过程（希望一切顺利）。您可根据需要向训练过程中添加额外的环节。\n\n\n## 许可证\n本代码采用 [apache-2.0](https:\u002F\u002Fchoosealicense.com\u002Flicenses\u002Fapache-2.0\u002F) 许可证发布。部分代码则采用 Lightning AI 的 Apache-2.0 许可证。\n\n## 引用\n```\n@article{geiping_scaling_2025,\n  title = {利用{{潜在推理}}扩展{{测试时计算}}：{{一种递归深度方法}}},\n  shorttitle = {利用{{潜在推理}}扩展{{测试时计算}}},\n  author = {Geiping, Jonas 和 McLeish, Sean 和 Jain, Neel 和 Kirchenbauer, John 和 Singh, Siddharth 和 Bartoldson, Brian R. 和 Kailkhura, Bhavya 和 Bhatele, Abhinav 和 Goldstein, Tom},\n  year = {2025},\n  month = feb,\n  eprint = {2502.05171},\n  primaryclass = {cs},\n  publisher = {arXiv},\n  doi = {10.48550\u002FarXiv.2502.05171},\n  url = {http:\u002F\u002Farxiv.org\u002Fabs\u002F2502.05171},\n  urldate = {2025-02-10},\n  archiveprefix = {arXiv},\n  keywords = {计算机科学 - 计算与语言,计算机科学 - 机器学习},\n  journal = {arxiv:2502.05171[cs]}\n}\n```\n\n## 联系方式\n如有任何问题，请随时联系我们，或提交一个问题！","# recurrent-pretraining 快速上手指南\n\n本指南旨在帮助开发者快速了解并使用 `recurrent-pretraining` 项目，该项目包含了深度循环模型 **Huginn-0125** 的预训练、推理及评估代码。该模型在 4096 块 AMD GPU (Frontier) 上训练而成，专注于通过潜在推理扩展测试时计算能力。\n\n## 环境准备\n\n### 系统要求\n*   **硬件**: 推荐拥有多卡环境的服务器（原项目在 AMD MI250X\u002FGPU Frontier 集群运行）。支持 NVIDIA GPU，但针对 AMD 系统有特定的通信优化。\n*   **操作系统**: Linux (Ubuntu\u002FCentOS 等)。\n*   **Python**: 建议 Python 3.10+。\n*   **深度学习框架**: PyTorch (需适配对应 GPU 架构)，Lightning AI (部分基础代码源自 litgpt)。\n\n### 前置依赖\n*   **推理\u002F评估**: 无需完整安装训练环境，仅需 `transformers`, `accelerate`, `lm-eval-harness`。\n*   **训练复现**: 需要完整的源码环境，以及用于分词训练的 `bpeasy` 工具。\n*   **网络**: 访问 Hugging Face 下载模型和数据（国内用户建议配置镜像源或使用代理）。\n\n## 安装步骤\n\n### 1. 克隆仓库\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ftomg-group-umd\u002Frecurrent-pretraining.git\ncd recurrent-pretraining\n```\n\n### 2. 安装依赖\n由于项目基于 Lightning AI  fork 修改，建议先安装基础 PyTorch 环境（根据你的 GPU 类型选择 CUDA 或 ROCm 版本），然后安装项目依赖。\n\n```bash\n# 示例：安装基础依赖 (具体 requirements.txt 若存在请优先使用)\npip install torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu118 # 或对应的 rocm 版本\npip install accelerate lm-eval transformers sentencepiece\n```\n\n> **注意**: 如果要复现完整的**数据预处理和训练流程**，还需手动安装 BPE 分词器：\n> ```bash\n> git clone https:\u002F\u002Fgithub.com\u002Fgautierdag\u002Fbpeasy.git\n> cd bpeasy && pip install .\n> ```\n\n### 3. 验证模型可用性 (可选)\n确保可以从 Hugging Face 拉取模型。国内用户如遇到连接超时，可设置环境变量使用镜像：\n```bash\nexport HF_ENDPOINT=https:\u002F\u002Fhf-mirror.com\n```\n\n## 基本使用\n\n本项目最核心的用途是**推理**和**基准测试**。以下是使用 `lm-eval`  harness 对已发布的 `huginn-0125` 模型进行评测的最简示例。\n\n### 场景一：运行标准基准测试 (Hellaswag)\n无需额外安装，直接通过命令行调用 `lm-eval` 加载模型并进行测试。\n\n```bash\nlm_eval --model hf \\\n--model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32 \\\n--tasks hellaswag \\\n--batch_size=auto \\\n--num_fewshot=0\n```\n\n### 场景二：运行数学推理任务 (GSM8k)\n包含系统提示词（System Prompt）和聊天模板格式的调用示例：\n\n```bash\nlm_eval --model hf \\\n--model_args pretrained=tomg-group-umd\u002Fhuginn-0125,trust_remote_code=True,dtype=bfloat16,mean_recurrence=32 \\\n--tasks gsm8k_cot \\\n--batch_size=auto \\\n--apply_chat_template=True \\\n--fewshot_as_multiturn \\\n--system_instruction=\"You are a helpful assistant that can assist users with mathematical reasoning.\"\n```\n\n### 场景三：运行代码生成任务 (HumanEval)\n需要允许执行代码并设置特定的生成参数：\n\n```bash\nHF_ALLOW_CODE_EVAL=1 accelerate launch -m lm_eval \\\n--model hf \\\n--model_args pretrained=tomg-group-umd\u002Fhuginn-0125,mean_recurrence=32,trust_remote_code=True,dtype=bfloat16 \\\n--tasks humaneval_instruct \\\n--batch_size=1 \\\n--num_fewshot=0 \\\n--output_path=outputs\u002Fheval \\\n--confirm_run_unsafe_code \\\n--apply_chat_template=True \\\n--gen_kwargs=do_sample=True,temperature=0.2,top_p=0.95\n```\n\n### 进阶：查看模型架构\n如果仅想研究模型结构而不进行大规模评测，可直接查看精简版的建模文件：\n*   路径：`recpre\u002Fraven_modeling_minimal.py`\n*   说明：此文件兼容 Hugging Face 格式，适合快速阅读核心递归深度（Recurrent Depth）实现逻辑。\n\n### 进阶：本地训练复现 (简要)\n若需在集群上复现训练过程，请按以下顺序执行脚本（需自行配置 `launch_configs` 中的路径和参数）：\n1.  生成分词器：`python scripts\u002Ftokenizer_generation.py`\n2.  下载原始数据：`python scripts\u002Fscalable_data_download.py`\n3.  数据分词：`python scripts\u002Fparquet_to_parquet_tokenizer.py`\n4.  数据打乱：`python scripts\u002Fparquet_to_parquet_shuffler.py`\n5.  启动训练：`python train.py --config=launch_configs\u002Fyour_config.yaml`","某金融科技公司量化团队正试图在有限的算力预算下，构建一个能进行多步逻辑推导的市场情绪分析模型，以辅助高频交易决策。\n\n### 没有 recurrent-pretraining 时\n- **推理深度受限**：传统 Transformer 架构在处理长链条数学推导或复杂逻辑时，受限于固定层数，难以在测试阶段动态增加计算步骤，导致复杂问题准确率低下。\n- **硬件适配困难**：团队主要拥有 AMD GPU 资源，但主流大模型训练代码多针对 NVIDIA 生态优化，在大规模分布式训练中常遭遇通信挂起（RCCL hangs）等稳定性问题。\n- **显存效率低下**：为了提升推理效果强行堆叠模型层数，导致显存占用激增，无法在现有硬件上部署参数量足够的模型。\n- **复现门槛极高**：缺乏针对“深度循环”架构的开源参考实现，从零编写支持动态递归深度的训练与推理代码耗时数月且极易出错。\n\n### 使用 recurrent-pretraining 后\n- **动态测试时计算**：利用 Huginn-0125 模型的深度循环特性，团队可在推理阶段通过调整 `mean_recurrence` 参数动态增加思考步数，显著提升了 GSM8K 等复杂推理任务的准确率。\n- **原生支持 AMD 集群**：直接复用该项目中经过 Frontier 超算验证的 `SimpleFabric` 并行策略和通信优化代码，完美解决了 AMD 环境下的大规模训练稳定性难题。\n- **高效显存利用**：借助循环深度机制，用更少的静态参数实现了等效于数百层 Transformer 的推理能力，大幅降低了部署时的显存需求。\n- **快速落地验证**：通过集成的 `lm-eval` 脚本和 HuggingFace 兼容的最小化建模文件，团队在一天内即可完成基准测试复现与业务场景微调。\n\nrecurrent-pretraining 通过提供经过超算验证的深度循环模型全栈代码，让开发者能在常规硬件上低成本实现具备动态推理能力的下一代语言模型。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fseal-rg_recurrent-pretraining_44aa101a.png","seal-rg","Safety-and-Efficiency Aligned Learning Group","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fseal-rg_9ca3feaf.png","This is the github page of the SEAL research group at the ELLIS Institute Tübingen and the Max-Planck Institute for Intelligent Systems",null,"jonasgeiping","https:\u002F\u002Fjonasgeiping.github.io\u002Fgroup\u002F","https:\u002F\u002Fgithub.com\u002Fseal-rg",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,870,78,"2026-03-30T20:50:26","Apache-2.0",5,"Linux","训练必需：大规模集群环境，文中明确提及在 Frontier 超级计算机上使用 4096 块 AMD GPU (MI250X\u002FMI300 系列)；推理支持 AMD 及 NVIDIA GPU (通过 vLLM)，具体显存未说明，需根据模型大小 (3.5B) 自行估算。","未说明 (训练需集群级内存，推理取决于模型加载)",{"notes":94,"python":95,"dependencies":96},"1. 该工具主要针对 AMD GPU 集群环境优化，训练代码中包含针对 AMD RCCL 通信库 hangs 问题的特殊修复 (_allreduce_chunk_stream)。2. 最终模型为 huginn-0125 (3.5B 参数)，支持通过 Hugging Face 直接加载推理。3. 数据预处理流程复杂，包含分词器生成、原始数据下载（脚本可扩展性差且易出错）、分词及洗牌等步骤。4. 支持通过 vLLM 插件进行快速推理。5. 许可证为 Apache-2.0。","未说明",[97,98,99,100,101,102,103],"torch (AMD ROCm 版本)","litgpt (早期基础)","lm-eval-harness","vllm (可选，用于快速推理)","bpeasy (用于分词器训练)","accelerate","transformers (隐含，用于 HF 兼容)",[35,14],[106,107,108,109],"llms","pretraining","reasoning","recurrent-depth","2026-03-27T02:49:30.150509","2026-04-07T22:58:26.445879",[113,118,123,128,133,138,142],{"id":114,"question_zh":115,"answer_zh":116,"source_url":117},22863,"在复现 GSM-8K 结果时，为什么我的准确率低于论文报告的值？","请检查提示词（prompt）格式是否与评估框架完全一致。虽然您可能使用了类似 `--fewshot_as_multiturn` 的选项，但模板细节（如问题的引导方式）可能存在差异。此外，确保为每个问题包含了正确的系统提示词（System Prompt），例如项目中演示使用的 'You are Huginn...' 等特定人设描述，这些细节对最终结果有显著影响。","https:\u002F\u002Fgithub.com\u002Fseal-rg\u002Frecurrent-pretraining\u002Fissues\u002F16",{"id":119,"question_zh":120,"answer_zh":121,"source_url":122},22864,"训练时使用随机循环次数（randomized unrolling）与固定循环次数相比，效果有何不同？","理论上，在固定的循环次数 `r` 下进行训练和评估，效果应优于使用随机展开的训练方式。实验观察表明，使用固定 `r` 确实能带来正向的收益，尽管这种提升幅度可能较小（marginal gain）。如果您在训练时使用随机 `r` 但希望监控验证损失，建议验证时的 `r` 保持固定或设置为最大循环次数以获得稳定的评估指标。","https:\u002F\u002Fgithub.com\u002Fseal-rg\u002Frecurrent-pretraining\u002Fissues\u002F15",{"id":124,"question_zh":125,"answer_zh":126,"source_url":127},22865,"在哪里可以找到 num_steps=16 或其他非默认步数的评估数据？","论文正文的表格（Tables 2, 3, 4）主要展示了默认设置（如 r=32）的结果。如果您需要查看其他步数（如 r=16）在人类评估（Human Eval）和 GSM8K CoT 任务上的具体数值，请参考论文中的图 7（Fig.7），其中包含了不同步数下的性能表现数据。","https:\u002F\u002Fgithub.com\u002Fseal-rg\u002Frecurrent-pretraining\u002Fissues\u002F29",{"id":129,"question_zh":130,"answer_zh":131,"source_url":132},22866,"在使用 Adaptive Compute 进行推理时遇到代码报错或钩子（hooks）失效怎么办？","这通常是因为模型定义更新导致 forward 函数参数签名发生变化，而原有的钩子依赖位置参数（args）获取数据。解决方案是修改钩子逻辑，使其通过关键字参数（kwargs） consistently 传递数据。例如，将 `core_block_forward(x, ...)` 改为 `core_block_forward(x=x, ...)`，并在钩子的 `__call__` 方法中通过 `kwargs[\"x\"]` 而非 `input[0]` 来获取输入张量，这样可以提高代码对函数签名变更的鲁棒性。","https:\u002F\u002Fgithub.com\u002Fseal-rg\u002Frecurrent-pretraining\u002Fissues\u002F21",{"id":134,"question_zh":135,"answer_zh":136,"source_url":137},22867,"是否可以在每个中间潜在推理步骤应用 Coda 块将隐性思维转化为自然语言？","虽然之前的工作探索过类似方法，但本项目旨在直接从数据中学习终端行为（terminal behaviors），而不强加特定的收敛模式。目前的损失函数激励模型在解码晚期潜在状态时产生良好的下一个 token 预测，但这并不保证中间状态的最优性或可解释性。因此，强制在每个中间步骤输出自然语言可能会干扰模型学习到的隐性推理过程，且并非所有潜在空间的推理轨迹都能有效地转化为人类语言。","https:\u002F\u002Fgithub.com\u002Fseal-rg\u002Frecurrent-pretraining\u002Fissues\u002F6",{"id":139,"question_zh":140,"answer_zh":141,"source_url":137},22868,"模型的收敛行为是否总是表现为不动点（fixed point）？","不一定。除了收敛到不动点外，模型还可能表现出其他终端行为，例如轨道（orbits，即在几个状态间循环）。具体的行为模式取决于输入任务和模型训练情况，相关讨论和示例可以参考论文的第七节（Section 7）及附录部分。",{"id":143,"question_zh":144,"answer_zh":145,"source_url":127},22869,"在资源受限的 GPU（如 2x3090）上运行模型遇到显存溢出（OOM）怎么办？","可以尝试减少推理步数（num_steps），例如从默认的 32 降至 16。虽然论文指出 r=16 与 r=32 的性能差距在某些任务上可以忽略不计，但这会显著降低显存占用。此外，注意即使参数量较小（如 1.5B 的核心块），由于测试时计算量的缩放特性，其显存需求仍可能较高，需根据具体上下文长度调整批次大小或序列长度。",[]]