Modern React application for visualizing Large Language Model text processing pipelines. Built with composable frontend architecture using React, Vite, and shadcn/ui components for real-time interactive demonstrations of LLM internals.
llm-learn-demo.mp4
flowchart TB
subgraph internet["Internet"]
client(("Client Browser"))
end
subgraph app["React Application"]
subgraph ui["UI Layer"]
input["Text Input Component React + shadcn/ui"]
viz["Visualization Component WebGL + Framer Motion"]
controls["Control Panel shadcn/ui"]
end
subgraph core["Core Processing"]
subgraph state["State Management"]
store["Zustand Store"]
end
subgraph pipeline["LLM Processing Pipeline"]
token["Tokenization Processor"]
embed["Embedding Processor"]
attn["Attention Visualizer"]
ffn["Feed Forward Network"]
gen["Output Generator"]
end
end
subgraph services["Service Layer"]
compute["Computation Service"]
animate["Animation Service"]
layout["Layout Engine"]
end
end
client --> input
input --> store
store --> pipeline
pipeline --> viz
controls --> store
services --> viz
viz --> client
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
classDef internet fill:#e9e9e9,stroke:#666
classDef ui fill:#FFE4B5,stroke:#d49d4f
classDef core fill:#B0E0E6,stroke:#4682B4
classDef services fill:#98FB98,stroke:#3CB371
class internet internet
class input,viz,controls ui
class store,pipeline core
class services services
- User Interface Layer: React components using shadcn/ui
- State Management: Zustand store with middleware
- Processing Pipeline: Modular visualization processors
- Service Layer: Animation and computation services
- Frontend Framework: React 18 with Vite
- UI Components: shadcn/ui with Tailwind CSS
- State Management: Zustand
- Animation: Framer Motion
- Icons: Lucide React
- Testing: Vitest and Testing Library
- Performance: React Suspense and lazy loading
- Node.js 18.0+
- npm 8.0+
- Modern browser with WebGL support
- Clone Repository
git clone https://github.com/organization/llm-visualizer
cd llm-visualizer
- Install Dependencies
# Install project dependencies
npm install
# Install required shadcn/ui components
npm run shadcn:add button card input slider toast alert dialog
# Setup development environment
cp .env.example .env.local
- Configure Environment
VITE_APP_VERSION=1.0.0
VITE_ENABLE_DEBUG=false
VITE_ANIMATION_SPEED=1
VITE_MAX_INPUT_LENGTH=1000
- Start Development Server
npm run dev
├── src/
│ ├── components/
│ │ ├── ui/ # shadcn/ui components
│ │ ├── visualization/ # LLM visualization components
│ │ └── layout/ # Layout components
│ ├── hooks/
│ │ ├── useProcessor.ts
│ │ └── useAnimation.ts
│ ├── services/
│ │ ├── tokenizer.ts
│ │ ├── embedding.ts
│ │ └── attention.ts
│ ├── store/
│ │ └── index.ts
│ └── utils/
│ ├── constants.ts
│ └── helpers.ts
├── tests/
│ ├── unit/
│ └── integration/
└── public/
# Run unit tests
npm run test:unit
# Run integration tests
npm run test:integration
# Run all tests with coverage
npm run test:coverage
- Dynamic imports for visualization modules
- Memoization of expensive computations
- WebGL acceleration for matrix operations
- Debounced user input handling
- Virtual scrolling for large datasets
- Chrome/Edge 90+
- Firefox 90+
- Safari 14+
The application implements comprehensive error boundaries and fallbacks:
- Input validation errors
- Processing pipeline failures
- Animation engine errors
- Resource loading issues
- Performance metrics collection
- User interaction tracking
- Error reporting
- Usage analytics
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Submit pull request
- Follow conventional commits
- Add tests for new features
- Update documentation
- Maintain type safety
- Follow ESLint configuration
# Production build
npm run build
# Preview production build
npm run preview
# Type check
npm run type-check
# Lint
npm run lint
- Input sanitization
- XSS prevention
- CSP configuration
- Regular dependency audits
MIT License
For questions and support, please open an issue in the repository.