Simplify module structure and remove confusing 5 C's framework

- Clean up CLAUDE.md module structure from 10+ parts to 8 logical sections
- Remove confusing 'Concept, Context, Connections' framework references
- Simplify to clear flow: Introduction → Background → Implementation → Testing → Integration
- Keep Build→Use→Understand compliance for Education Architect
- Remove thinking face emoji from ML Systems Thinking section
- Focus on substance over artificial framework constraints
This commit is contained in:
Vijay Janapa Reddi
2025-09-15 20:12:36 -04:00
parent 29f5360888
commit 10e3733b4e
3 changed files with 62 additions and 83 deletions

View File

@@ -113,19 +113,16 @@ Before any merge:
## TinyTorch Module Development Standards
### 📚 Module Structure Requirements
All TinyTorch modules MUST follow the standardized 10-part structure + ML systems reflection:
All TinyTorch modules MUST follow the standardized structure:
1. **Part 1: Concept** - What is [Topic]?
2. **Part 2: Foundations** - Mathematical & Theoretical Background
3. **Part 3: Context** - Why This Matters
4. **Part 4: Connections** - Real-World Examples
5. **Part 5: Design** - Why Build From Scratch?
6. **Part 6: Architecture** - Design Decisions
7. **Part 7: Implementation** - Building [Module Name]
8. **Part 8: Integration** - Bringing It Together
9. **Part 9: Testing** - Comprehensive Validation
10. **🤔 ML Systems Thinking: Reflection Questions**
11. **Part 10: Module Summary**
1. **Module Introduction** - What we're building and why
2. **Mathematical Background** - Theory and foundations
3. **Implementation** - Building the components step by step
4. **Testing** - Immediate tests after each implementation
5. **Integration** - How components work together
6. **Comprehensive Testing** - Full validation
7. **ML Systems Thinking** - Reflection questions
8. **Module Summary** - What was accomplished
### 🧪 Testing Pattern - MANDATORY
```
@@ -197,11 +194,11 @@ Content here...
- Writing ONLY
### ⚠️ Critical Requirements
- All 10+ parts must be present
- All module sections must be present
- Every test needs markdown explanation
- ML systems reflection is mandatory
- Use exact section headers for consistency
- Maintain immediate testing pattern
- Maintain immediate testing pattern (test after each implementation)
- Use clear, consistent section organization
---

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "0652a79c",
"id": "276230c8",
"metadata": {
"cell_marker": "\"\"\""
},
@@ -29,7 +29,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d61a4d30",
"id": "0c6d864f",
"metadata": {
"nbgrader": {
"grade": false,
@@ -53,7 +53,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d3fcff19",
"id": "de425ba2",
"metadata": {
"nbgrader": {
"grade": false,
@@ -74,7 +74,7 @@
},
{
"cell_type": "markdown",
"id": "0ae29ea2",
"id": "71d99af8",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -101,7 +101,7 @@
},
{
"cell_type": "markdown",
"id": "d4c6c125",
"id": "4f8fc91b",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -141,7 +141,7 @@
},
{
"cell_type": "markdown",
"id": "e02bf108",
"id": "146e19c0",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -190,7 +190,7 @@
},
{
"cell_type": "markdown",
"id": "4b67356b",
"id": "c8243733",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -222,7 +222,7 @@
},
{
"cell_type": "markdown",
"id": "c44043e7",
"id": "e602a7fc",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -255,7 +255,7 @@
},
{
"cell_type": "markdown",
"id": "608dd82b",
"id": "16e5e389",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -281,7 +281,7 @@
},
{
"cell_type": "markdown",
"id": "cf4164a0",
"id": "bb2d160e",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -294,7 +294,7 @@
},
{
"cell_type": "markdown",
"id": "7c3ed674",
"id": "b7b3f751",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -312,7 +312,7 @@
},
{
"cell_type": "markdown",
"id": "ac4d7185",
"id": "9210a047",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -326,7 +326,7 @@
},
{
"cell_type": "markdown",
"id": "3b2dc3fa",
"id": "3315c8a6",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -341,7 +341,7 @@
},
{
"cell_type": "markdown",
"id": "c46fdebd",
"id": "2b20781f",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -360,7 +360,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2b9d8d7b",
"id": "72dabdd9",
"metadata": {
"lines_to_next_cell": 1,
"nbgrader": {
@@ -693,7 +693,7 @@
},
{
"cell_type": "markdown",
"id": "bed6c09d",
"id": "059c6f91",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -706,7 +706,7 @@
},
{
"cell_type": "markdown",
"id": "c61ff368",
"id": "c1c123f9",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -722,7 +722,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a1e57a72",
"id": "3bb143db",
"metadata": {
"nbgrader": {
"grade": true,
@@ -771,7 +771,7 @@
},
{
"cell_type": "markdown",
"id": "92dff29b",
"id": "09173345",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -787,7 +787,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8996b6ed",
"id": "83f2af37",
"metadata": {
"nbgrader": {
"grade": true,
@@ -840,7 +840,7 @@
},
{
"cell_type": "markdown",
"id": "da52577a",
"id": "f70f6b95",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -856,7 +856,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5c0ed51c",
"id": "75eb9080",
"metadata": {
"nbgrader": {
"grade": true,
@@ -915,7 +915,7 @@
},
{
"cell_type": "markdown",
"id": "779d2781",
"id": "8dd36083",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 0
@@ -931,7 +931,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8dc7f7b6",
"id": "41773bad",
"metadata": {
"nbgrader": {
"grade": true,
@@ -968,7 +968,7 @@
},
{
"cell_type": "markdown",
"id": "ba0a38dd",
"id": "c2031637",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 1
@@ -982,7 +982,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19642490",
"id": "4e945862",
"metadata": {
"nbgrader": {
"grade": true,
@@ -1021,7 +1021,7 @@
},
{
"cell_type": "markdown",
"id": "54b7c824",
"id": "0636efde",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 1
@@ -1045,7 +1045,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b2002df2",
"id": "b4fff31a",
"metadata": {
"nbgrader": {
"grade": true,
@@ -1093,7 +1093,7 @@
},
{
"cell_type": "markdown",
"id": "58724059",
"id": "5156ae34",
"metadata": {
"cell_marker": "\"\"\"",
"lines_to_next_cell": 1
@@ -1124,7 +1124,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ff4524e2",
"id": "281b8a8e",
"metadata": {
"nbgrader": {
"grade": true,
@@ -1184,49 +1184,49 @@
},
{
"cell_type": "markdown",
"id": "23c664d7",
"id": "10a6c7e6",
"metadata": {
"cell_marker": "\"\"\""
},
"source": [
"## 🤔 ML Systems Thinking: Reflection Questions\n",
"\n",
"Now that you've built your tensor foundation, take a moment to think about the broader machine learning systems implications:\n",
"Now that you've built a working tensor system, take a moment to reflect on how this simple foundation connects to the massive ML systems powering today's AI revolution:\n",
"\n",
"### System Design Questions\n",
"1. **Memory Management**: How would you handle tensors that don't fit in memory? What strategies do production ML systems use?\n",
"### System Design - How does this fit into larger systems?\n",
"1. **The Universal Language**: You just built the fundamental data structure of modern AI. How does having one unified way to represent data (as tensors) enable frameworks like PyTorch to handle everything from image recognition to language models using the same operations?\n",
"\n",
"2. **Distributed Computing**: If you needed to split tensor operations across multiple machines, what challenges would you face?\n",
"2. **Memory and Scale**: Your tensor creates a new result for every operation. When OpenAI trains GPT models with billions of parameters, why might memory management become a critical system design challenge? What trade-offs do you think they make?\n",
"\n",
"3. **Hardware Optimization**: How might your tensor implementation differ if targeting GPUs vs CPUs vs specialized ML chips (TPUs)?\n",
"3. **Hardware Abstraction**: Your tensor works on CPU through NumPy. How does abstracting tensor operations allow the same neural network code to run on CPUs, GPUs, and specialized AI chips like TPUs without changing the model logic?\n",
"\n",
"### Performance & Scalability\n",
"4. **Batch Processing**: How does tensor design enable efficient batch processing in neural networks? Why is this crucial for training?\n",
"### Production ML - How is this used in real ML workflows?\n",
"4. **Batch Processing Power**: Real ML systems process thousands of images or sentences simultaneously in batches. How does your element-wise tensor math suddenly become a superpower when applied to batches? Why is this crucial for real-time applications?\n",
"\n",
"5. **Memory Layout**: How does the choice of row-major vs column-major memory layout affect performance in different ML operations?\n",
"5. **Data Pipeline Integration**: Your tensor wraps NumPy arrays, making it compatible with the entire scientific Python ecosystem. How does this design choice affect a data scientist's ability to move from data exploration to model deployment?\n",
"\n",
"6. **Lazy Evaluation**: Some systems delay computation until results are needed. What are the trade-offs for tensor operations?\n",
"6. **Production Reliability**: In a live recommendation system serving millions of users, what happens when tensor operations encounter unexpected data shapes or types? How might this influence framework design priorities?\n",
"\n",
"### Production Systems\n",
"7. **Error Handling**: In a production ML pipeline, how would you handle tensor shape mismatches gracefully?\n",
"### Framework Design - Why do frameworks make certain choices?\n",
"7. **API Philosophy**: You chose property-style access (`tensor.shape`) like PyTorch, rather than function calls. How does this seemingly small design decision affect the developer experience when building complex neural architectures?\n",
"\n",
"8. **Serialization**: How would you save and load tensors efficiently for model deployment?\n",
"8. **Broadcasting Magic**: PyTorch tensors can add a scalar to a matrix automatically, while your current implementation requires matching shapes. Why do you think frameworks invest heavily in broadcasting logic? What problems does it solve for researchers?\n",
"\n",
"9. **Version Compatibility**: How do tensor format changes affect model compatibility across system updates?\n",
"9. **Type System Design**: Your tensor supports different data types (int32, float32). How do these choices ripple through an entire ML pipeline, from training speed to model accuracy to deployment costs?\n",
"\n",
"### Integration & Ecosystem \n",
"10. **Interoperability**: Why is NumPy compatibility so critical for ML systems adoption?\n",
"### Performance & Scale - What happens when systems get large?\n",
"10. **Memory Explosion**: Every operation in your tensor creates new memory. Imagine a neural network with millions of operations during training. How might this connect to why modern frameworks offer both copying and in-place operations?\n",
"\n",
"11. **Framework Design**: How do your tensor design choices enable or constrain future features like automatic differentiation?\n",
"11. **Computational Graphs**: Your operations happen immediately. Large language models track millions of tensor operations to compute gradients. How does the shift from immediate computation to deferred execution change system architecture?\n",
"\n",
"12. **Developer Experience**: What API design principles make tensors intuitive for ML practitioners?\n",
"12. **Hardware Optimization**: Your simple `+` operation translates to highly optimized kernel code on GPUs. How does having a clean tensor abstraction enable frameworks to automatically optimize operations for different hardware without changing user code?\n",
"\n",
"**💡 Systems Insight**: Your tensor implementation isn't just a data structure—it's the foundation that determines the performance, scalability, and usability of the entire ML system built on top of it."
"**💡 Systems Insight**: The tensor abstraction you just built is one of computing's most elegant solutions—it provides a simple, mathematical interface that hides incredible complexity in optimization, hardware acceleration, and distributed computing. Every major AI breakthrough, from computer vision to large language models, flows through tensor operations just like the ones you implemented."
]
},
{
"cell_type": "markdown",
"id": "96cf3e7e",
"id": "a9ed01c2",
"metadata": {
"cell_marker": "\"\"\""
},
@@ -1298,23 +1298,6 @@
"metadata": {
"jupytext": {
"main_language": "python"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.3"
}
},
"nbformat": 4,

View File

@@ -11,7 +11,6 @@
# %% [markdown]
"""
""""""
# Tensor - Core Data Structure
Welcome to the Tensor module! This is where TinyTorch really begins. You'll implement the fundamental data structure that powers all ML systems.