Weird AI

A software-engineering-focused learning platform that guides students from implementing the foundations of large language models
through modern reasoning techniques, distillation, and reinforcement learning.

Open Source Active Development

  Overview

Weird AI is an open-source instructional platform designed to help computer science students understand modern artificial intelligence by building its core components rather than treating large language models as black-box services.

The project combines Jupyter notebooks, reusable Python modules, automated tests, structured programming assignments, and larger integrated projects into a progressive learning experience. Students begin with text processing and tokenization, then implement fundamental components such as attention, normalization, loss functions, training, and generation before progressing into reasoning models and reinforcement-learning techniques.

Although the subject is artificial intelligence, I intentionally approached this from a software engineering perspective. AI components are implemented as modular, testable software, which allows students to explore the underlying mathematics and algorithms while continuing to practice source control, automated testing, modular design, dependency management, and iterative development.


  Problem

Rapid adoption of generative AI has made powerful models readily accessible through APIs and conversational interfaces, but ease of use can obscure how these systems actually work. Students can build applications around large language models without understanding tokenization, attention, training, inference, or the techniques that enable modern reasoning models.

At the opposite extreme, AI instruction can become heavily theoretical, leaving students able to describe algorithms without developing the engineering skills required to implement, test, debug, and integrate them into working software.

Weird AI addresses the gap between these approaches: students need enough theory to understand why modern AI systems work, but they also need to experience those concepts as software engineers by implementing and validating them themselves.


  Solution

Weird AI uses a build-from-first-principles approach in which students progressively construct the components of modern language and reasoning models. Concepts are introduced through exploratory notebooks and then reinforced through reusable Python implementations, automated tests, and increasingly integrated assignments.

The curriculum deliberately separates conceptual exploration from production-style implementation. Notebooks provide an environment for visualization, experimentation, and explanation, while application modules require students to translate those concepts into maintainable and testable software.

This progression eventually connects foundational transformer concepts with pretrained model use, reasoning techniques, reinforcement learning, distillation, and GRPO. Rather than presenting these as unrelated AI techniques, Weird AI shows how each layer builds on the architectural foundations established earlier in the course.


  System Architecture

Every major architectural decision in Weird AI traces back to one or more of four guiding design principles:

  • Build before abstracting
  • Theory reinforced through implementation
  • Software engineering practices remain first-class
  • Complexity introduced incrementally

The architecture reflects a clear separation between theory, practice, and implementation, while also applying software engineering best practices by building and testing incrementally as new concepts are introduced.

flowchart TD EXPLORE["Concept Exploration
Notebooks • Visualization • Experiments"] IMPLEMENT["Implementation
Starter Code • Reusable Python Modules"] VALIDATE["Engineering Validation
pytest • Automated Tests • CI"] MODELS["Model Development
Tokenization • Attention • Transformers • Training"] REASON["Reasoning Systems
Reasoning • RL • Distillation • GRPO"] EXPLORE --> IMPLEMENT IMPLEMENT --> VALIDATE VALIDATE -.->|"Feedback"| IMPLEMENT IMPLEMENT --> MODELS MODELS --> REASON

  Learning Progression

Weird AI is structured as a cumulative learning experience rather than a collection of independent AI topics. Each stage builds on concepts and software developed earlier in the course, moving students from the foundations of language models through increasingly sophisticated reasoning techniques.

The diagram below shows the conceptual sequence of the curriculum rather than the software structure of the project.

flowchart LR subgraph Foundations["LLM Foundations"] direction TB TEXT["Text Exploration"] TOKEN["Tokenization"] ATT["Attention Mechanisms"] TRANS["Transformer Components"] TRAIN["Pretraining"] GEN["Text Generation"] TEXT --> TOKEN TOKEN --> ATT ATT --> TRANS TRANS --> TRAIN TRAIN --> GEN end subgraph Applied["Working with Language Models"] direction TB PRE["Pretrained Models"] REASON["Reasoning & Generation"] REFINE["Generation Refinement"] PRE --> REASON REASON --> REFINE end subgraph Advanced["Reasoning Models"] direction TB RL["Reinforcement Learning"] DISTILL["Model Distillation"] GRPO["GRPO"] IMPROVE["Improving GRPO"] RL --> DISTILL DISTILL --> GRPO GRPO --> IMPROVE end GEN --> PRE REFINE --> RL classDef foundation fill:#dbeafe,stroke:#2563eb,stroke-width:2px; classDef applied fill:#fef3c7,stroke:#d97706,stroke-width:2px; classDef advanced fill:#dcfce7,stroke:#16a34a,stroke-width:2px; class TEXT,TOKEN,ATT,TRANS,TRAIN,GEN foundation; class PRE,REASON,REFINE applied; class RL,GRPO,IMPROVE,DISTILL advanced;

Understand, Implement, Apply

This progression intentionally moves between understanding, implementation, and application. Students first explore how a technique works, implement its important components, and then use those concepts as foundations for more sophisticated systems.


  Design Tradeoffs


Every architectural decision represents a tradeoff between competing priorities.

From Scratch vs. Framework Abstractions

High-level libraries can make sophisticated AI capabilities available with very little code, but they can also conceal the mechanisms students are trying to understand. Weird AI intentionally implements important components at a lower level before introducing higher-level abstractions. This requires more instructional time but gives students a stronger mental model for understanding the frameworks and pretrained models they encounter later.

Notebooks vs. Application Code

Jupyter notebooks are exceptionally useful for explanation, visualization, and experimentation, but large notebook-based projects can encourage tightly coupled and difficult-to-test implementations. Weird AI uses notebooks as the instructional interface while moving substantial implementations into reusable Python modules that can be independently tested.

Educational Scale vs. Frontier Scale

Modern frontier models operate at a computational scale that is impractical for an undergraduate laboratory environment. Weird AI therefore prioritizes architectural fidelity over scale: students work with smaller models and datasets that preserve the important concepts while remaining feasible on accessible hardware.

Guided Implementation vs. Open-Ended Development

Implementing AI algorithms from scratch can create substantial cognitive load when students are simultaneously learning the underlying concepts. Structured starter code, notebooks, and automated tests provide scaffolding while still requiring students to implement the important behavior themselves. That scaffolding is progressively reduced as students gain experience.


  Lessons Learned

Abstraction is more meaningful after implementation

Students understand high-level AI libraries differently after implementing the mechanisms those libraries encapsulate. Building tokenizers, attention mechanisms, training components, and generation logic provides a concrete foundation for understanding what pretrained-model frameworks are doing on their behalf.

AI software still benefits from conventional engineering discipline

Experimental AI code can quickly become difficult to reason about when model behavior, data processing, training logic, and evaluation are tightly coupled. Modular implementations and automated tests proved valuable not only as assessment mechanisms, but as tools for isolating problems in inherently probabilistic systems.

Curriculum architecture matters as much as individual lessons

The most difficult design problem was not explaining any single AI technique, but constructing a progression in which each new concept could build naturally on knowledge and software developed earlier. Treating the curriculum as an integrated system rather than a collection of independent topics allowed increasingly sophisticated techniques to reuse established mental models and implementation patterns.


  Conclusion

Weird AI began with a straightforward educational goal: give students enough understanding of modern artificial intelligence to see beyond the API boundary. It evolved into a broader experiment in teaching AI as a software engineering discipline.

By combining conceptual notebooks, from-scratch implementations, reusable modules, automated testing, and progressively more sophisticated model architectures, the project allows students to move from understanding individual mechanisms to reasoning about complete AI systems.

The project also reflects a broader principle that informs my work with AI: effective adoption requires understanding both the capabilities of a technology and the abstractions beneath it. Frameworks, pretrained models, hosted APIs, and increasingly capable AI development tools provide tremendous leverage, but engineers are better positioned to make architectural decisions when they understand the systems those abstractions conceal.

Weird AI continues to evolve alongside the rapidly changing AI landscape, but its central principle remains stable: The best way to understand a complex system is to build enough of it to understand the decisions its abstractions hide.



  Technology Stack

Python PyTorch Transformers Jupyter NumPy Pandas pytest GitHub Actions Hugging Face