SuperAPIAI Directory

tiny-universe

github.com · AI developer platforms

tiny-universe is an open-source "Large Model White-Box Construction Guide" by Datawhale, designed to help readers with a traditional deep learning background build a large model system entirely by hand starting from underlying principles. The project covers the large model itself, RAG, Agent, and evaluation systems, including topics such as Tiny Transformer, Tiny Llama3, Tiny RAG, Tiny Agent, Tiny Eval, Tiny Diffusion, and Tiny GraphRAG, and comes with complete code implementations and explanations, emphasizing "white-box" and reproducibility. All topics are implemented from scratch, without relying on highly encapsulated toolkits and APIs, and are suitable for learners who wish to gain an in-depth understanding of the core principles of large models.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

"Large Model White-Box Construction Guide": an entirely hand-built Tiny-Universe. This project is a "hand-built" large model guide that starts from principles, is oriented toward "white-box", and centers on the full chain of large models. It aims to help readers with a traditional deep learning background start from underlying principles and "purely hand-build" a clear and usable large model system, including the large model itself, the RAG framework, the Agent system, and the large model evaluation system. Starting from basic principles, the project deeply analyzes every technical point and accompanies it with complete code implementations, helping readers independently reproduce the core parts of large models through detailed explanations and code comments, and thereby achieve a deep understanding and mastery of large models through reproduction.

The topic section mainly consists of from-scratch implementations of classic technologies, aiming to lead learners to deeply master the implementation details of classic works: handwritten image generation model Tiny Diffusion; in-depth analysis of large model principles Qwen Blog; progressively pretrain a hand-built large model Tiny Llama3; how to evaluate your large model Tiny Eval; purely hand-build a RAG framework Tiny RAG; hand-build a minimal Agent system Tiny Agent; deeply understand the fundamentals of large models Tiny Transformer; hand-build a basic GraphRAG system Tiny GraphRAG.

The exploration section mainly consists of from-scratch reproductions of novel academic works/excellent works at the production stage, aiming to lead learners to deeply perceive how to go from being able to do it -> innovation: the RAG retrieval method CDDRS (ADVEI25) enhanced with fine-grained semantic element guidance.

Project background: As the large model ecosystem matures, the threshold for secondary fine-tuning and application development based on large models continues to decrease, but deeply understanding the details inside frameworks and achieving development and application capabilities independent of frameworks is increasingly critical. Only by starting from core principles and departing from frameworks as much as possible to achieve a "purely hand-built" large model system can one truly understand the core capabilities and key parts of models, and only then can one freely modify and apply frameworks. At present, most tutorials aim to guide developers on how to use highly encapsulated APIs and open-source frameworks for convenient and rapid development and training, which is helpful for beginners to get started, but neglects the importance of mastering model principles and the internal details of frameworks. This project aims to abandon highly encapsulated toolkits and APIs, start from the bottom layer (Pytorch layer), and "purely hand-build" a large model system to complete RAG, Agent, and Eval tasks for large models, helping learners with a certain foundation in large models further master the principles of large models.

Suitable audience: those who have mastered the basicApplications, wanting to learn the principles but not knowing where to start; students with strong curiosity and a thirst for knowledge; those interested in large model RAG, Agent, and Eval tasks and wanting to understand them at the principle level; those who enjoy hands-on coding and want to write large model RAG, Agent, and Eval tasks from scratch; those who want to understand the underlying principles of large models and improve their large model technical skills.

Project features: covers the full LLM pipeline, from Model, to RAG, Agent, Eval, creating a full-stack LLM tutorial; unlike large algorithm packages, the project code is more concise and clear for junior developers, more "white-box"; the project will continue to be iteratively updated.

Update log: 2025.8.12: Released TinyGraphRAG, getting started with GraphRAG from scratch. GraphRAG combines graph structures with large language models, demonstrating powerful capabilities in tasks such as complex relationship reasoning and knowledge association retrieval. This project manually builds a minimal version of a GraphRAG system, starting from principle formulas and architecture diagrams, corresponding to specific code implementations for graph construction, retrieval, reasoning, and generation. 2024.12.25: TinyDiffusion, getting started with Diffusion from scratch. Manually builds a minimal version of the DDPM model, starting from the formulas in the paper, corresponding to specific code implementations for the training and sampling processes. 2024.10.28: TinyLlama3, getting started with Llama from pretraining to loading the model for inference, and can be completed with 2G of VRAM. A simple large language model training can be implemented using only Numpy and Pytorch, with VRAM usage of about 2G, and model training can be completed in just a few hours. 2024.6.26: Added optional content—Gaokao Mathematics Evaluation, enabling TinyEval to connect to Gaokao question evaluation. 2024.5.20: Added optional content—Tiny Transformer, building a Transformer model purely by hand. Based on "Attention is All You Need", a complete, reproducible, and runnable Transformer model was manually built at the pytorch layer. 2024.5.1: Released Tiny-Universe V1.

Introduction to each topic: Qwen-Blog: Taking Qwen2 as an example, this guides everyone deep into the internal structure of the LLM model, taking the input tensor as the first-person perspective, passing through each operation block of the Model, and lighting up the LLM's "black box". The project includes detailed explanations of mechanisms such as GQA, ROPE, and Attention Mask embedded in the model. TinyRAG: Before generating an answer, RAG first retrieves relevant information from a broad document database, then uses this information to guide the generation process, improving the accuracy and relevance of the content and effectively alleviating the hallucination problem. This project abandons highly encapsulated RAG frameworks and hand-builds a RAG project from scratch. Mirror address:https://www.codewithgpu.com/i/datawhalechina/tiny-universe/tiny-universe-tiny-rag TinyAgent: Based on the React approach, a minimal Agent structure was manually created. By writing an Agent step by step by hand, readers can better understand the composition and operation of an Agent. During the summer vacation, an attempt will be made to change the React structure to an SOP structure. TinyEval: Built a comprehensive evaluation system introduction, allowing everyone to learn to tailor suitable evaluation metrics according to their own tasks, and use these metrics for objective evaluation, providing accurate and quantifiable data support for model capabilities.

Project members: Xiao Hongru - Project Lead (Datawhale member - Tongji University); Song Zhixue - Project Lead (Datawhale member - China University of Mining and Technology (Beijing)); Zou Yuheng - Project Lead (Datawhale member - University of International Business and Economics); Liu Xiaoyu - Core Contributor (Huazhong University of Science and Technology); Pan Duyi - Core Contributor (Hong Kong University of Science and Technology (Guangzhou)). Special thanks to @Sm1les for their help and support for this project.

License: This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools