The Architecture of Intelligence: Decoding LLMs, MCP, and Full-Stack Agentic Systems for AI Evolution
Explore the mathematical foundations, hardware challenges, and system protocols behind LLMs and autonomous AI agents, focusing on deep architecture beyond basic prompt engineering.
The Architecture of Intelligence: Decoding LLMs, MCP, and Full-Stack Agentic Systems for AI Evolution
1.
Build with AI2026 #1
The Architecture of Intelligence:
Decoding LLMs, MCP, and Full-Stack Agentic Systems
On Campus NCUE
Presenter: Ming Chen, Lead of GDG NCUE [About me]
1
2.
On Campus NCUE
✨Today’s Goal
1. Deconstruct the "Black Box": Understand the mathematical limits and hardware
evolution of LLMs (from Self-Attention to CIM/SSMs).
2. Master the System I/O: Learn how the Model Context Protocol (MCP) standardizes AI
tool integration and breaks the M x N API dilemma.
3. Architect an Agentic OS: Grasp the core engineering behind OpenClaw, Harness, and
autonomous ReAct workflows.
Ps. This session focuses on deep systemic architecture and theoretical understanding, not just
basic prompt engineering ⭢ Hardcore material for beginners!
2
3.
On Campus NCUE
✨Event Schedule
[The Brain] LLM Core Math & The Memory Wall
[The Hardware] Breaking the Von Neumann Bottleneck
[The I/O Bus] Connecting Worlds via MCP
[The OS Kernel] Orchestrating Autonomous Agents
Disclaimer
The content presented reflects the speaker’s understanding and is for reference only. While
efforts have been made to ensure accuracy, no guarantee is provided.
3
Chapter One
Core Topicsof Chapter 1
1.1 The Origin: Formalizing Intelligence
1.2 The Engine: Mathematics of Transformer
1.3 The Wall: Physical Limits & Memory Bottlenecks
[The Brain] LLM Core Math & The Memory Wall
5
6.
Dartmouth Workshop (1956)
DartmouthWorkshop marked the birth of "Artificial Intelligence"
as an engineering discipline, transitioning the field from
abstract philosophy to applied computational science.
What is Intelligence?
Intelligence is essentially generating context-aware, targeted
responses to dynamic environmental stimuli.
1.1 The Origin: Formalizing Intelligence
6
7.
1.1 The Origin:Formalizing Intelligence
The Mathematical Translation
Intelligence is not magic!
It is simply a search for the optimal mapping function f(X) = Y.
● Input (X): High-dimensional sensory data or context.
● Output (Y): The targeted, rational action or response.
Two divergent philosophies to construct the internal architecture of f(X)…
7
8.
1.1 The Origin:Formalizing Intelligence
Symbolic AI (Top-Down) Connectionism AI (Bottom-Up)
Philosophy Hard-Coding the rules of reality Letting data shape the structure
by learnable weights & tensors
Logic Deductive Reasoning
(If A and B, then T)
Inductive Learning
(Emergence via Probabilities)
Pros 100% Deterministic, explainable, and precise Robust generalization. Solves fuzzy logic
Cons Brittleness. Fails on unprogrammed edge cases The Black Box. Prone to probabilistic hallucinations
Example Expert Systems & Compilers Deep Neural Networks (LLMs)
Two divergent philosophies to construct the internal architecture of f(X)…
8
9.
1.1 The Origin:Formalizing Intelligence
Symbolic (Classical AI): The rigidity of deterministic logic
● Architecture: Expert Systems
● Mechanics: Absolute human logic (A & B → T)
Fatal Flaw #1: Ambiguity Crashes The System
Real-world data (e.g., the stock market) lacks deterministic rules. If experts
give different rules, a hard-coded system cannot resolve the conflict.
Fatal Flaw #2: The Hard-coded Ceiling
A symbolic system does not "learn". Its intelligence is permanently capped
at the programmer's knowledge level on day one.
9
10.
example.clp
; Defining thefacts (Premises A & B)
(deffacts current-environment
(weather cloudy)
(humidity high)
)
; The Hard-coded Rule: If A & B then T
(defrule predict-rain
(weather cloudy) ; Condition A: If the weather is cloudy
(humidity high) ; Condition B: And the humidity is high
=>
; Conclusion T: Execute inference and actions
(assert (action take-umbrella)
)
(printout t "Rules matched! Prediction: It will rain."crlf)
)
OUTPUT
10
11.
Connectionism (Neural AI):Learning via Probability
● Architecture: Artificial Neural Networks (Deep Learning)
● Mechanics: Gradient Descent & Weight Optimization
Strength #1: Generalization over Ambiguity
Captures high-dimensional statistical patterns to resolve noise
and ambiguity where rigid IF-ELSE logic fails.
Strength #2: The Adaptive Curve
Scales through data; intelligence refines post-deployment,
enabling emergent LLM capabilities.
Fatal Flaw: The Black Box Dilemma
Trades transparency for performance. Trillions of parameters
create a Black Box where reasoning is untraceable. Probabilistic
guessing inherently risks logical hallucinations.
Source: Stanford University HAI, AI Index Report 2024
1.1 The Origin: Formalizing Intelligence
11
12.
1.1 The Origin:Formalizing Intelligence
Perceptron: The Atom of Connectionism
The bio-inspired logic
Processes weighted inputs through a step function to produce a binary output.
Historical Hype vs. Structural Reality
● 1958 Vision: Frank Rosenblatt predicted a machine that would soon
"walk, talk, and see".
● The Reality: An elegant Linear Classifier that treats intelligence as a
verifiable mapping problem.
● The XOR Wall (1969): Minsky proved its inability to solve Nonlinear
problems (like XOR), triggering the first AI Winter.
Perceptron
Connectionism (Neural AI): Learning via Probability
Perceptrons can’t do XOR!!!
12
13.
1.1 The Origin:Formalizing Intelligence
Perceptron: The Atom of Connectionism
Connectionism (Neural AI): Learning via Probability
13
14.
1.1 The Origin:Formalizing Intelligence
Breaking the Linear Prison: Multi-Layer Perceptron (MLP)
Hierarchical Space Warping
Hidden layers warp the feature space into high-level conceptual
abstractions, enabling the linear separation of complex, non-linear
realities of real-world patterns.
Non-Linear Activation
Without functions like ReLU / Sigmoid, stacking layers is mathematically
redundant (Linear Collapse).
Connectionism (Neural AI): Learning via Probability
Multi-Layer Perceptron, MLP
Universal Approximation Theorem: A single hidden layer with non-linearity
can theoretically approximate any continuous function, shifting AI from simple
binary classifiers to the emergent intelligence of modern LLMs.
14
15.
1.2 The Engine:Mathematics of Transformer
RNN, Recurrent Neural Network
The sequential pioneer designed to process data like a human reading a book—one
word at a time.
Attention Mechanism
A cognitive filter that allows models to prioritize specific parts of the input, regardless of
their distance in a sequence.
Transformer
The modern architectural standard that replaced recursion with pure matrix operations,
enabling the birth of LLMs.
The Synergy
Attention is the "functional engine" that calculates relationships, while the Transformer
is the "structural framework" that stacks these engines into deep, parallelizable layers.
Overview: Transitioning Intelligence
15
16.
1.2 The Engine:Mathematics of Transformer
RNN vs. Self-Attention: The Architectural Shift
Feature RNN (The Crisis) Self-Attention (The Solution)
Processing Style Sequential: Processes data step-by-step Simultaneous: Every token attends to all
other tokens at once
Path Complexity O(n) path length to connect distant
dependencies
O(1) path length for global dependencies
Hardware Efficiency Low: Impossible to fully parallelize on
GPUs
High: Optimized for massive matrix
parallelization
Gradient Stability Suffers from Vanishing Gradients in long
sequences
Maintains stable global context without
information fading
Weight Logic Static weights per layer during inference Dynamic: Weights are computed on-the-fly
based on relevance
16
17.
1.2 The Engine:Mathematics of Transformer
Transformer Architecture
Matrix Projections (Q, K, V)
● The Trinity: Input embeddings map to Query (Search), Key (Index),
and Value (Content) learnable subspaces.
● Similarity Logic: calculates a massive dot-product similarity
matrix, while ensures gradient stability.
Encoder-Decoder Synergy
● Dual-Tower System: An Encoder to vectorize context and a Decoder
to generate sequences.
● Multi-Head Attention: Runs parallel attention mechanisms to capture
diverse linguistic perspectives.
● Add & Norm: Employs Residual Connections to facilitate training in
ultra-deep architectures.
● Positional Encoding: Injects sequence order back into the all-at-once
matrix operations.
Q
K
V
17
18.
1.2 The Engine:Mathematics of Transformer
Transformer Architecture
/
Source: A. Vaswani et al., "Attention is all you need," in Advances in Neural IPS, vol. 30, 2017, pp. 5998–6008.
18
19.
1.3 The Wall:Physical Limits & Memory Bottlenecks
● The Complexity: Computing results in an attention
matrix, where L is the sequence length.
● The Scaling Trap: Doubling the input length quadruples the memory
and compute requirements , making long-context processing
exponentially expensive.
● The Memory Wall: The bottleneck is often Memory Bandwidth—the
speed at which data moves between VRAM and GPU cores—rather
than just raw TFLOPS.
The Quadratic Curse - Why LLMs Slow Down with Length?
Source: W. A. Wulf and S. A. McKee, "Hitting the memory wall: Implications of the obvious," ACM
SIGARCH Computer Architecture News, vol. 23, no. 1, pp. 20–24, 1995, doi: 10.1145/216585.216588. 19
20.
1.3 The Wall:Physical Limits & Memory Bottlenecks
Efficiency through Intelligent Memory Management
● KV-Cache: Instead of re-computing K and V for every
new token during generation, we "memoize" them.
This transforms the problem from redundant
calculation to memory storage.
● The VRAM Challenge: KV-Cache grows linearly with
sequence length, leading to OOM errors.
● PagedAttention: Inspired by Operating Systems, it
divides the KV-Cache into non-contiguous "pages",
allowing for zero memory fragmentation and efficient
batching.
Managing Context - KV-Cache & PagedAttention
Source: W. Kwon et al., "Efficient memory management for large language model
serving with pagedattention," in Proceedings of the 29th Symposium on Operating
Systems Principles, 2023, pp. 611–626, doi: 10.1145/3600006.3613165.
20
21.
1.3 The Wall:Physical Limits & Memory Bottlenecks
T. Dao, D. Fu, S. Ermon, A. Rudra, and C. Ré, "FlashAttention: Fast and memory-efficient exact attention with
io-awareness," in Advances in Neural Information Processing Systems (NeurIPS), vol. 35, 2022, pp. 16344–16359.
Scaling the Wall - Hardware & Architectural Fixes (1/2)
1. FlashAttention (IO-Aware Optimization)
● SRAM Tiling: Splits the massive attention matrix
into tiny blocks that fit perfectly inside the
ultra-fast SRAM cache.
● Fused Kernel (Eliminates IO Bottleneck):
Computes the entire attention pipeline inside
the cache, completely bypassing the slow
VRAM memory highway.
21
22.
1.3 The Wall:Physical Limits & Memory Bottlenecks
Scaling the Wall - Hardware & Architectural Fixes (2/2)
2. GQA / Grouped-Query Attention (Memory Slimming)
● Shared Resources: Forces multiple Query heads to share
a single pair of Key/Value heads.
● 8x Cache Reduction: Slashes the physical payload of the
KV-Cache while keeping model accuracy near-perfect.
3. Quantization (Size Compression)
● Bit-Width Reduction: Compresses heavy 16-bit floats
(FP16) into lean 8-bit or 4-bit integers (INT8/INT4).
● 4x Smaller Footprint: Shrinks the entire model size by 4x,
allowing massive LLMs to run smoothly on local
consumer GPUs.
Source: J. Ainslie et al., "GQA: Training generalized multi-query transformer
models from multi-head checkpoints," in Proceedings of the 2023
Conference on Empirical Methods in Natural Language Processing
(EMNLP), 2023, pp. 4895–4901, doi: 10.18653/v1/2023.emnlp-main.298.
22
23.
Chapter Two
Core Topicsof Chapter 2
2.1 Escaping the Quadratic Cage: Mamba & State Space Models (SSMs)
2.2 Silicon Determinism: The Rise of LPUs (Groq & Etched)
2.3 The Neuromorphic Frontier: CIM & Spiking Neural Networks (SNNs)
[The Hardware] Breaking the Von Neumann Bottleneck
23
24.
On Campus NCUE
2.1Escaping the Quadratic Cage: Mamba & SSMs
Foundation — What are State Space Models (SSMs)?
The Core Concept
● Origin: Borrowed from classic control theory and signal processing.
● Mechanism: Maps an input signal to an output via a
hidden state .
The Mathematical Backbone
● Linear State Equations:
Matrix A: Controls memory retention and state transition over time.
Matrix B: Controls how much the current input impacts the memory.
Skip Connection
⚠ O(L) but Time-Invariant !
24
25.
On Campus NCUE
2.1Escaping the Quadratic Cage: Mamba & SSMs
Evolution — From Static SSM to Mamba
Source: A. Gu and T. Dao, "Mamba: Linear-time sequence modeling
with selective state spaces," arXiv preprint arXiv:2312.00752, 2023.
The Flaw: Time-Invariant (Static)
● Fixed matrices (A, B, C) process text blindly, ignoring actual token
meaning.
● Fails heavily at context-rich reasoning and long-term fact retention.
Mamba's Fix: Selective Scan
● Input-Dependent: Transforms static constants into dynamic
functions: .
● Dynamic Filtering (Red Box): Intelligently decides what to
remember or forget based on relevance.
● Hardware-Aware (Gold Box): Operations are fused directly inside
ultra-fast GPU SRAM cache.
Input-Dependent Variables
25
26.
On Campus NCUE
2.1Escaping the Quadratic Cage: Mamba & SSMs
The Holy Grail — SSM Duality & Efficiency
Constant Memory - O(1) Inference
● Fixed Hidden State: Internal state maintains a constant size,
completely eliminating the bloated KV-Cache.
● Zero OOM Risk: Memory footprint remains perfectly flat, even at a
million-token context scale.
The Ultimate Duality
● Training (CNN Mode): Unrolls the SSM via Parallel Associative Scan
for massive GPU parallelization.
● Inference (RNN Mode): Flattens into a linear recurrent step for
ultra-fast, constant-time token generation.
26
27.
On Campus NCUE
2.2Silicon Determinism: The Rise of LPUs (Groq & Etched)
Beyond the GPU — Hyper-Specialization & "Hard-Coded" Math
The Swiss Army Knife Problem
● GPUs are general-purpose beasts (gaming, crypto, AI).
● Carries massive physical overhead: complex hardware schedulers and
branch predictors.
● Only achieves ~30% FLOPs utilization for LLMs.
Burning Math into Silicon: Etched Sohu
● A hyper-specialized ASIC with hard-coded Transformer gates.
● The Catch: If it’s not a Transformer, it literally will not run.
● The Reward: Over 90% FLOPs utilization, pushing 500,000
tokens/sec on Llama 70B (nearly 10x faster than next-gen GPUs).
27
28.
On Campus NCUE
2.2Silicon Determinism: The Rise of LPUs (Groq & Etched)
Silicon Determinism — The Groq Philosophy
Zero Latency Jitter
● Groq’s LPU (Language Processing Unit) strips away dynamic
"guesswork" (no dynamic caches, no speculative scheduling).
● Eliminates runtime hardware contention entirely.
The Compiler is the Boss
● Data movement is pre-scheduled down to the exact
nanosecond at compile time.
● Turns bare metal hardware into a perfectly synchronized,
Software-Defined Stream.
● Per-chip SRAM hits a staggering 150 TB/s memory
bandwidth—bypassing the slow VRAM bottleneck.
28
29.
On Campus NCUE
2.2Silicon Determinism: The Rise of LPUs (Groq & Etched)
2026 "Pure-Iron" Inference — Instruction-Less Era
Instruction-Less Computing
● Removes traditional instruction decoding layers.
● Tokens flow directly through specialized silicon gates like liquid
electricity.
The Death of Context-Switching
● Compute and communication are perfectly interleaved at the
hardware level.
● Zero memory waiting time.
29
30.
On Campus NCUE
2.2Silicon Determinism: The Rise of LPUs (Groq & Etched)
2026 "Pure-Iron" Inference — Instruction-Less Era
Live Experience: Mind-Melting Speeds
● Real-time generation at 1600+ tokens/sec per user on
dense 120B models.
● URL: Cerebras.com (The Speed of Thought)
● Prompt:
3 doors, 1 car. You pick Door 1. Host always opens
Door 2 if car is at 1. Host opens Door 2 (goat). Switch
to Door 3 win probability? Explain.
30
31.
On Campus NCUE
2.3The Neuromorphic Frontier: CIM & Spiking Neural Networks (SNNs)
Solving Math with Physics
The Ohm’s Law Advantage
● Swaps ALU logic gates for fundamental physics: V = IR.
● Weights are stored as conductance (1/R) in a crossbar
array.
● Matrix multiplication is solved instantly via Kirchhoff’s
Current Law at the speed of light.
Zero Data Movement
● Computes inside the memory cells themselves.
● Smashes the "Memory Wall" to reduce energy
consumption by 100x.
31
32.
On Campus NCUE
2.3The Neuromorphic Frontier: CIM & Spiking Neural Networks (SNNs)
The Event-Driven Brain
Temporal Sparse Coding
● Replaces continuous FP16/FP4 floating-point crunches
with discrete binary "spikes" over time.
● Neurons only fire when an activation threshold is
crossed.
Event-Driven Efficiency
● Near-Zero Idle Power: Silicon gates remain completely
asleep until a spike arrives.
● Enables complex edge-AI deployment within a milliwatt
power budget.
32
The Complexity Trap
●M Models × N Data Sources = O(M × N) integration mess.
● Adding one new tool requires rewriting custom glue code
across all existing models.
Brittle Hand-Coded Bridges
● Traditional Function Calling relies on fragile, model-specific
JSON schemas.
● Breaks instantly whenever an API updates or a model version
shifts.
The Universal Need
● Just as hardware moved from proprietary ports to USB-C, AI
software requires a standardized "I/O Bus" to decouple
intelligence from data.
The M × N Integration Crisis
34
35.
Three-Tier Decoupled Architecture
●Host: The AI Application (e.g., Claude Desktop, Cursor IDE)
controlling the session.
● Client: The protocol engine that translates the model’s
intent.
● Server: The specialized "Driver" for specific data sources
(e.g., GitHub, Local DB, Gmail).
The Security of UNIX Standard I/O (IPC)
● Local-First via stdio: Communication runs via JSON-RPC
over standard I/O, avoiding exposed network ports.
● Subprocess Isolation: Servers run as isolated local
sub-processes with strict permission control.
MCP — The Universal Bus for AI
35
36.
Resources (Read-Only State)
●Data exposed via standardized URIs (file://, postgres://).
Models read the world like a unified filesystem.
Tools (Functional Side-Effects)
● Executable actions with strict JSON schema
enforcement (e.g., writing to DB, triggering a CLI).
Prompts (Reusable Logic)
● Turns prompt engineering from "magic spells" into
version-controlled, dynamic software assets.
Standardizing Intent — The Three Primitives
36
37.
Demo Code
import shutil
frommcp.server.fastmcp import FastMCP
# 1. Initialize the Universal Bus
mcp = FastMCP("CS-Lab-Server")
# 2. Define a "Tool" Primitive
@mcp.tool()
def get_disk_space(path: str = "/") -> str:
"""Get free disk space of the laboratory server."""
# 3. Pure local logic, completely isolated
total, used, free = shutil.disk_usage(path)
# 4. Return structured safe data to LLM
return f"Free Space: {free // (2**30)} GB (Total: {total // (2**30)} GB)"
if __name__ == "__main__":
# 5. Run via UNIX Standard I/O (stdio)
mcp.run()
37
38.
Zero Glue Code
●Swap your LLM or swap your enterprise data source
without rewriting a single line of integration logic.
Unified Ecosystem
● Any MCP Server can immediately talk to any
MCP-compliant Host.
The 2026 Shift
● Moving from fragmented "AI Wrappers" to a robust,
standardized Internet of AI-Data Protocols.
The Pluggable Future — Total Decoupling
38
The Interleaved StateMachine
● Replaces one-shot text with a strict execution loop:
Thought → Action → Observation.
● Forces hidden reasoning (CoT) before API calls to
eliminate premature invocation.
Closed-Loop Self-Correction
● Action: Automatically executes system scripts (e.g.,
docker stats).
● Observation: Captures live runtime errors or stdout
metrics directly.
● Correction: Catches logs, spins up recovery scripts,
and loops until resolved.
Production Planning — The ReAct Control Loop
40
41.
The Heartbeat Daemon
●A background system process running persistent cron
loops without user prompts.
● Synchronizes databases, telemetry, and system events
into the active context window.
Production Scheduling
● 09:00 Trigger: Scans GitHub boards to map daily task
dependencies.
● 30-Min Interval: Runs health checks and auto-restarts
hanging subprocesses.
● 18:00 EOD Dump: Commits clean progress state and
flushes active session storage.
OpenClaw Framework — Daemon & Cron Orchestration
41
42.
The AI HarnessLayer
● A deterministic software wrapper handling input/output
validation and runtime failover.
Isolation & Guardrails
● Schema Enforcement: Intercepts LLM outputs using
strict Regex/JSON verification.
● Docker Sandboxing: Executes all autonomous code
in isolated, ephemeral containers.
Context Garbage Collection
● Periodically purges trailing log noise to optimize
context token efficiency.
Agent Harness — Production Sandboxing & Safety
42
43.
On Campus NCUE
✨Share what you have achieved with the help of a Coding Agent,
or any experience with AI improving your efficiency.
43
44.
On Campus NCUE
✨Learning Resources
Beginner
● Build a Gemini-Powered YouTube Summarizer
● Agentverse - The Shadowblade's Codex - Vibecoding with Gemini CLI
● Vibe Code with Gemini in Google AI Studio
● Getting Started with MCP, ADK and A2A
Intermediate
● Getting Started with Google Antigravity
● Building with Google Antigravity
● Building Personalized Agents with ADK, MCP, and Memory Bank
● Build AI Agents with the Agent Development Kit (ADK) for Java
● Build a Location Intelligence ADK Agent with MCP servers for BigQuery and Google Maps
● Code Review and Security Analysis with Gemini CLI with Extensions
● Evaluating Agents with ADK
● Analyze ADK Agent execution with the BigQuery Agent Analytics Plugin
44
45.
On Campus NCUE
✨Learning Resources
Advanced
● Agentverse - The Scholar's Grimoire - Building Knowledge Engines with RAG
● Agentverse - The Summoner's Concord - Architecting Multi-Agent Systems
● Agentverse - The Guardian's Bastion - Secure scalable Inference for AgentOps
● Google's Agent Stack in Action:ADK, A2A, MCP on Google Cloud
● AlloyDB Omni and Local AI Model on Kubernetes
● Get started with Agent Development Kit (ADK)
● Build multi-agent systems with ADK
● Empower ADK agents with tools
● Deploy ADK agents to Agent Engine
45