Home About Spatial Lab Disciplines Agentic Tools
Learn • AI Academy & Labs
Infrastructure Blog Connect
Pillar 3 • Software Mechanics Simulator

How AI Works: Interactive Mechanics Lab

An interactive software engineering laboratory demystifying the core mathematical operations inside modern artificial intelligence: autoregressive logits & softmax sampling, high-dimensional vector embeddings, and JSON-RPC tool-calling handshakes.

Autoregressive Softmax Sampling Simulator

When a Transformer outputs raw logits $z_i$, they must be converted into normalized probability distributions via Softmax: $P(w_i) = \frac{\exp(z_i / T)}{\sum_j \exp(z_j / T)}$. Manipulate Temperature $T$, Top-P (nucleus), and Top-K to observe how sampling parameters alter determinism vs. creativity.

Candidate Token Probabilities (Prompt context: "The future of autonomous...")
Sampled Candidate: Click Sample Button

High-Dimensional Vector Space & Semantic Arithmetic

Embedding models project discrete words and sentences into continuous vector spaces $\mathbb{R}^d$. Concepts sharing semantic relationships cluster together. Semantic distance is measured via Cosine Similarity: $\cos(\theta) = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{u}\| \|\mathbf{v}\|}$.

Computed Cosine Similarity:
0.892
Classic Semantic Vector Analogy: $\mathbf{v}(\text{King}) - \mathbf{v}(\text{Man}) + \mathbf{v}(\text{Woman}) \approx \mathbf{v}(\text{Queen})$

Tool Calling & JSON-RPC Handshake Protocol

Large Language Models cannot directly access external APIs or databases. They interact with tools through a formal four-step structured JSON-RPC protocol handshake. Step through the execution lifecycle below.

1. User Query & Schema
2. Model Tool Intent
3. Client Execution
4. Final Synthesis
Step 1 of 4
Companion Applied Mechanics Deep-Dives