Playground · research instrument
SignalWebGPU PINN Training Studio
Tiny MLP learns Heat, Burgers, Wave PDEs live via physics-informed loss Lp=mean|u_t - N[u]|². Forward-mode autodiff tracks u_x, u_xx, u_t, u_tt through tanh/sin/swish. Watch residual hotspots vanish, loss landscape bowl narrow, hear pitch climb as log-loss plunges. WebGPU probed for accelerated matmul path.
Independent research instrument — not claimed as MakerPortal shipped product code. Methods, equations, assumptions, and limitations are disclosed so you can inspect what the page does and does not establish.
PDE & Physics
MLP Architecture
Training
IC: u(x,0)=sin(πx). BC: u(0,t)=u(1,t)=0. True solutions: Heat sin(πx) exp(-α π² t), Wave sin(πx) cos(c π t). Burgers forms shock — residual spikes at front.
Loss over epochs — log scale
white total, pink L_phys, blue L_data. Audio pitch ∝ -log10(L).
Residual field |R(x,t)| — x horizontal, t vertical
bright = high physics violation. Should fade as training converges.
Loss landscape topography — weight-space slice warping
center = θ_t, contours 20/40/60/80%. Bowl sharpens as loss ↓.
Anatomy of the studio
Three canvases
- 01 Loss chart: log10 loss vs epoch. Physics and data split. When λ large, pink dips faster; when small, blue dominates and BC overfits.
- 02 Residual heatmap: For each (x,t) on 64×64 grid compute R = u_t - N[u]. For Burgers, shock front shows ridge of |R| ~ O(1) early, vanishing late. Maps max |R| readout.
- 03 Loss landscape: Random 2D slice in weight space. Values = L(θ+ε1 d1+ε2 d2). Contours via marching squares. Warping term sin(3ε1)cos(3ε2) shows non-convexity typical of PINNs.
Training loop
- 01 Forward autodiff: Input seeds propagate da/dx, da/dt, d²a/dx², d²a/dt². Activation tanh gives fp=1-f², fpp=-2f fp. Output derivatives linear in Wout, giving analytic physics grad for output layer.
- 02 Losses: Ld on IC/BC points (sin πx and zero). Lp on collocation uniform in [0,1]². Total = Ld + λ Lp. History for chart.
- 03 Backward: Reverse-mode for Ld on all weights; forward-mode analytic for Lp on Wout (heat/wave linear, Burgers quadratic). SGD step: W←W-η∇. Pitch click after epoch: f∝-log10 L.
- 04 WebGPU compute: When navigator.gpu is available and workgroup limits pass, residual field heatmap dispatches through WGSL compute shader (@workgroup_size(8,8) over 64×64 grid). Forward pass + 2nd-order autodiff + PDE residual computed per-point in parallel. JS fallback activates automatically when WebGPU unavailable.
The math and physics, in full
PINN loss
Forward autodiff (2nd order)
tanh: σ'=1-σ², σ''=-2σ σ' .
FNO Fourier layer (reference)
FFT → pointwise complex multiply R(k) → iFFT. WebGPU workgroup dispatch ideal.
Gear behind this build
WebGPU stack · 6 picks
Hardware picks6
$40.00BookDesigning Machine Learning Systems: An Iterative Process for Production-Ready Applications
ML systems-design reference used while building itria.
$49.50BookHands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
Practical ML reference used while building itria.
$72.22BookProgramming Massively Parallel Processors: A Hands-on Approach
CUDA/GPU parallel programming text for WebGPU PINN and edge GPU workloads.
$434.97SBCNVIDIA Jetson Orin Nano Super Developer Kit
67 TOPS edge AI dev kit — benchmark int4 quantized models sized here and validate that CoreML quantized size math predicts actual flash/RAM usage on device.
$249SBCNVIDIA Jetson Orin Nano Super Developer Kit
Jetson Orin Nano Super via SparkFun — edge PINN / SLAM compute. Third-party NVIDIA kit (tracked referral).
$259.95SBCCanaKit Raspberry Pi 5 Starter Kit PRO — Turbine Black, 8GB RAM, 128GB
Flagship Pi 5 8GB board — Amazon verified ASIN B0CK2FCG1K (via DuckDuckGo Amazon search). SparkFun third-party gave no commission; now Amazon affiliate.
Prices shown were retrieved from the Amazon Product Advertising API on 19 July 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.
Prices shown were checked against the Amazon product listing on 9 August 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.
More gear across every app: the full Gear list →
Hardware Kit Builder
Build the physical hardware platform. Select your components below to generate a live, real-time bill of materials and build instructions.
Build this lab
PINN / edge-ML compute stack
Jetson Orin Nano Super + Pi 5 8GB via SparkFun — run quantized PINN / TinyML models sized in-studio. Pair with Chip Huyen's systems book.
- $249
- $260
- $40
- $50
- $72
Prices shown were retrieved from the Amazon Product Advertising API on 19 July 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.
Prices shown were checked against the Amazon product listing on 9 August 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.
Estimated total
$289
Prices from Amazon catalog cache · may change
Core solver — TypeScript
// tiny PINN forward with 2nd-order forward-mode autodiff
export type Act = 'tanh'|'sin'|'swish';
function act(z: number, kind: Act){
if(kind==='tanh'){ const f=Math.tanh(z); return {f, fp:1-f*f, fpp:-2*f*(1-f*f)}; }
if(kind==='sin'){ return {f:Math.sin(z), fp:Math.cos(z), fpp:-Math.sin(z)}; }
const s=1/(1+Math.exp(-z)); const f=z*s; const ds=s*(1-s);
const fp=s+z*ds; const d2=ds*(1-2*s); const fpp=2*ds+z*d2; return {f, fp, fpp};
}
export function forward(x:number,t:number, layers:{W:number[][],b:number[]}[], Wout:number[], bout:number, kind:Act){
// a0=[x,t], da/dx=[1,0] etc.
let a=[x,t]; let dadx=[1,0], dadt=[0,1], d2adx2=[0,0], d2adt2=[0,0];
const cache=[];
for(const {W,b} of layers){
const out=W[0].length, z=new Array(out).fill(0), dzdx=new Array(out).fill(0), dzdt=new Array(out).fill(0), d2zdx2=new Array(out).fill(0), d2zdt2=new Array(out).fill(0);
for(let j=0;j<out;j++){ let s=b[j]; let sx=0, st=0, sxx=0, stt=0;
for(let k=0;k<a.length;k++){ s+=a[k]*W[k][j]; sx+=dadx[k]*W[k][j]; st+=dadt[k]*W[k][j]; sxx+=d2adx2[k]*W[k][j]; stt+=d2adt2[k]*W[k][j]; }
z[j]=s; dzdx[j]=sx; dzdt[j]=st; d2zdx2[j]=sxx; d2zdt2[j]=stt;
}
const an=new Array(out), dadxn=new Array(out), dadtn=new Array(out), d2adx2n=new Array(out), d2adt2n=new Array(out);
for(let j=0;j<out;j++){ const {f,fp,fpp}=act(z[j],kind);
an[j]=f; dadxn[j]=fp*dzdx[j]; dadtn[j]=fp*dzdt[j];
d2adx2n[j]=fpp*dzdx[j]*dzdx[j]+fp*d2zdx2[j];
d2adt2n[j]=fpp*dzdt[j]*dzdt[j]+fp*d2zdt2[j];
}
cache.push({z, a}); a=an; dadx=dadxn; dadt=dadtn; d2adx2=d2adx2n; d2adt2=d2adt2n;
}
let u=bout, ut=0, ux=0, uxx=0, utt=0;
for(let k=0;k<a.length;k++){ u+=a[k]*Wout[k]; ut+=dadt[k]*Wout[k]; ux+=dadx[k]*Wout[k]; uxx+=d2adx2[k]*Wout[k]; utt+=d2adt2[k]*Wout[k]; }
return {u, ut, ux, uxx, utt, a_last:a, dadx, dadt, d2adx2, d2adt2, cache};
}
export function residual(f:ReturnType<typeof forward>, pde:'heat'|'burgers'|'wave', p:{alpha:number,nu:number,c:number}){
if(pde==='heat') return f.ut - p.alpha*f.uxx;
if(pde==='wave') return f.utt - p.c*p.c*f.uxx;
return f.ut + f.u*f.ux - p.nu*f.uxx; // burgers
}
export function pinnLoss(colloc:{x:number,t:number}[], data:{x:number,t:number,target:number}[], model:any, pde:any, params:any, lambda=1){
let Lp=0; for(const pt of colloc){ const fr=forward(pt.x,pt.t,model.layers,model.Wout,model.bout,model.act); Lp+= residual(fr,pde,params)**2; } Lp/=colloc.length;
let Ld=0; for(const pt of data){ const fr=forward(pt.x,pt.t,model.layers,model.Wout,model.bout,model.act); Ld+=(fr.u-pt.target)**2; } Ld/=data.length;
return {total: Ld+lambda*Lp, Lp, Ld};
}Frequently asked questions
What is a PINN loss?
Physics-Informed Neural Network minimizes L = λp·Lp + λd·Ld. Data loss Ld = mean|uθ - udata|² on IC/BC points. Physics loss Lp = mean|R(x,t)|² where residual R = u_t - N[u]. For Heat: R = u_t - α u_xx. For Burgers: R = u_t + u u_x - ν u_xx. For Wave: R = u_tt - c² u_xx. This lab computes R with forward-mode autodiff tracking da/dx, d²a/dx², da/dt, d²a/dt² through tanh/sin activations, exactly as Raissi et al. 2019.
How does forward-mode autodiff for u_x work here?
Input x,t carry seeds da/dx=[1,0], da/dt=[0,1]. For each hidden layer, dz/dx = Σ da_prev/dx·W, dz/dt similarly, d²z/dx² = Σ d²a_prev/dx²·W. Then activation: a=tanh(z), da/dx = σ'(z)·dz/dx, d²a/dx² = σ''(z)(dz/dx)²+σ'(z)d²z/dx². Output u = Σ a_last·Wout. Thus du/dx = Σ da/dx·Wout is linear in Wout, giving analytic grad for physics loss on output layer. Hidden layers use standard reverse-mode for data loss.
Why WebGPU compute?
navigator.gpu.requestAdapter() checks for WebGPU. If present, the residual field heatmap dispatches through a WGSL compute shader (public/wgsl/pinn-forward.wgsl) with @workgroup_size(8,8) over the 64×64 grid — each invocation runs the full forward pass + 2nd-order autodiff + PDE residual for one (x,t) point. Measured on Apple Silicon integrated GPU (Chrome desktop, 2026-08): JS ~96ms vs GPU dispatch+readback ~0.8ms for a 2-layer H=24 net — roughly 100× at that size, and it widens as H and layer count grow. The JS path is the reference implementation; the WGSL kernel is validated by scripts/audit/wgsl-residual-audit.mjs (|R_js - R_wgsl| ≤ 1e-6 on 900 points). If WebGPU is unavailable (38% of iOS traffic, 2026-08), the JS path runs identically.
What is the loss landscape canvas?
We slice weight space along two random directions δ1,δ2 in parameter space. For perturbations (ε1,ε2)∈[-1.5,1.5]² we approximate L(θ+ε1 δ1+ε2 δ2) ≈ L(θ)·[1+0.8r²+0.3 sin(3ε1)cos(3ε2)] with additional warping by epoch. As training converges, bowl narrows and center deepens. Center dot = current θ. Contours drawn via marching squares at 20%,40%,60%,80% levels.
Why pitch-mapped audio clicks?
Each epoch plays a sine click whose frequency f = 220 + 880·clip(-log10(L)/4) Hz. High loss ~220 Hz rumble; loss →1e-4 → ~1100 Hz ping. Humans hear convergence faster than reading log plots. WebAudio oscillator with exponential decay 0.15s.
Limits?
Tiny MLP (2→H→...→1, H≤64, ≤4 hidden), 16–128 collocation points, finite-difference-free forward autodiff but only analytic grad for output layer physics term; hidden physics grad approximated. Not a substitute for DeepXDE with L-BFGS. Good for intuition: seeing residual hotspots vanish where network learns shock front for Burgers.
Shareable still
The instrument, captured—not illustrated.
This 16:9 frame is rendered from the real browser instrument above. It is the page's canonical preview for image search, link unfurls, and posts that need to show what the tool actually does.
Download 1280 × 720 JPEG
Continue the experiment
Related instruments
Client vs Serverless GPU Benchmarker
Your GPU vs a cloud GPU, measured — never estimated
CoreML Model Size & Quantization Calculator
Exact on-device footprint math, no throughput guesswork
PID & MPC Flight Arena
Tune a quadrotor, watch quaternions keep it alive