import React, { useState } from "react"; import { Sliders } from "lucide-react"; export const MatrixViz: React.FC = () => { const [rank, setRank] = useState(4); // Constants for visualization scaling const d = 16; // Hidden dimension simulation const k = 16; // Output dimension simulation // Calculate imaginary parameters based on user slider // Assuming a real model like Llama-7B, d_model might be 4096. // We scale the display numbers to look realistic. const realD = 4096; const realK = 4096; const paramsFull = realD * realK; const paramsLoRA = realD * rank + rank * realK; const reduction = ((1 - paramsLoRA / paramsFull) * 100).toFixed(2); // Helper to generate random opacity blue blocks const renderGrid = ( rows: number, cols: number, colorBase: string, label: string, ) => { return (
Adjust the Rank (r) to see how LoRA decomposes the weight update matrix into two smaller dense matrices.