{"id":31814480,"url":"https://github.com/lynnlangit/llm-determinism-app","last_synced_at":"2025-10-11T08:52:20.891Z","repository":{"id":316119839,"uuid":"1062055764","full_name":"lynnlangit/LLM-determinism-app","owner":"lynnlangit","description":"Simple React app which illustrates ideas from \"Defeating Nondeterminism in LLM Inference\" by Thinking Machines","archived":false,"fork":false,"pushed_at":"2025-09-22T19:07:20.000Z","size":1804,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T05:40:40.043Z","etag":null,"topics":["determinism","llm-inference","llms"],"latest_commit_sha":null,"homepage":"https://thinkingmachines.ai/blog/defeating-nondeterminism-in-llm-inference/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lynnlangit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T18:40:46.000Z","updated_at":"2025-09-22T19:10:12.000Z","dependencies_parsed_at":"2025-09-22T20:41:32.601Z","dependency_job_id":null,"html_url":"https://github.com/lynnlangit/LLM-determinism-app","commit_stats":null,"previous_names":["lynnlangit/llm-determinism-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lynnlangit/LLM-determinism-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnlangit%2FLLM-determinism-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnlangit%2FLLM-determinism-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnlangit%2FLLM-determinism-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnlangit%2FLLM-determinism-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lynnlangit","download_url":"https://codeload.github.com/lynnlangit/LLM-determinism-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnlangit%2FLLM-determinism-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006637,"owners_count":26084150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["determinism","llm-inference","llms"],"created_at":"2025-10-11T08:52:19.389Z","updated_at":"2025-10-11T08:52:20.885Z","avatar_url":"https://github.com/lynnlangit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Determinism Explorer\n\n\u003cdiv align=\"center\"\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg src=\"images/det.png\" alt=\"Deterministic Output\" width=\"400\"/\u003e\n        \u003cbr/\u003e\n        \u003cstrong\u003eDeterministic Mode\u003c/strong\u003e\n      \u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg src=\"images/non-det.png\" alt=\"Non-Deterministic Output\" width=\"400\"/\u003e\n        \u003cbr/\u003e\n        \u003cstrong\u003eNon-Deterministic Mode\u003c/strong\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\nAn interactive React application that demonstrates and explains nondeterminism in Large Language Model (LLM) inference, based on the research [\"Defeating Nondeterminism in LLM Inference\"](https://thinkingmachines.ai/blog/defeating-nondeterminism-in-llm-inference/) by Thinking Machines Lab.\n\n## Features\n\nThis single-page application explores why LLMs such as [Google's Gemma](https://deepmind.google/models/gemma/) produce different outputs even at temperature=0, and provides practical solutions for achieving determinism.\n\n### Interactive Demonstrations\n\n- **Overview**: Qwen-235B experiment results showing 80 unique outputs from 1000 runs\n- **Float Calculator**: Interactive floating-point non-associativity demonstration\n- **Batch Simulation**: How different batch sizes trigger different kernels\n- **Atomic Operations**: Race conditions in GPU parallel operations\n- **Kernel Solutions**: Code examples for deterministic implementations\n- **Live Demo**: Gemma-2B inference simulation with copy-to-clipboard code\n- **Performance Analysis**: Throughput comparisons and trade-offs\n- **Implementation Guide**: Step-by-step setup instructions\n\n### Key Features\n\n- **Deterministic Mode Toggle**: Affects all simulations throughout the app\n- **Dark Gradient Theme**: Professional blue gradient background\n- **Interactive Elements**: Calculators, dropdowns, simulations with realistic delays\n- **Code Examples**: Copy-to-clipboard functionality for implementation\n- **Responsive Design**: Works on desktop and mobile devices\n\n## Quick Start\n\n1. **Clone or download** this repository\n2. **Start a local HTTP server** in the project directory:\n   ```bash\n   python3 -m http.server 8000\n   ```\n3. **Open your browser** and go to `http://localhost:8000`\n4. **Explore the tabs** to learn about LLM nondeterminism\n\nNote: A local server is required to avoid CORS issues when loading the JSX component file.\n\n## File Structure\n\n```\nLLM-determinism-app/\n├── index.html              # Main HTML file with React setup\n├── LLMDeterminismApp.jsx   # Complete React application\n└── README.md              # This file\n```\n\n## Browser Requirements\n\n- Modern browser with ES6+ support\n- JavaScript enabled\n- Network access for React CDN (or download for offline use)\n\n## Usage\n\n### Navigation\n- Use the **tab navigation** to explore different aspects of LLM nondeterminism\n- Toggle **Deterministic Mode** to see how it affects all simulations\n- Click **copy buttons** to get implementation code examples\n\n### Interactive Elements\n- **Float Calculator**: Adjust values to see floating-point precision issues\n- **Batch Selector**: Change batch sizes to see kernel variations\n- **Kernel Dropdown**: Explore different operation types and solutions\n- **Demo Runner**: Simulate Gemma-2B inference with different configurations\n\n## Educational Content\n\n### The Problem\n- LLMs produce different outputs even at temperature=0\n- Research shows 80 unique outputs from 1000 identical runs\n- Three root causes: floating-point ops, batch variance, concurrency\n\n### The Solutions\n- Environment configuration for deterministic algorithms\n- Model loading with appropriate data types\n- Generation parameters for consistent results\n- Performance trade-offs and when to use deterministic mode\n\n## Technical Implementation\n\n- **Single-file React component** with inline styles\n- **No external CSS dependencies**\n- **Uses React from CDN** with Babel for JSX transformation\n- **Responsive grid layouts**\n- **Color-coded status indicators**\n- **Realistic simulation delays**\n- **Clipboard integration**\n\n## Performance Notes\n\nThe app demonstrates that deterministic mode typically results in:\n- **30-40% throughput reduction**\n- **Higher memory usage** (float32 vs float16)\n- **Limited optimization** opportunities\n\n## Research Reference\n\nBased on \"Defeating Nondeterminism in LLM Inference\" research demonstrating:\n- Qwen-235B nondeterminism at temperature=0\n- Token 103 divergence patterns\n- Practical solutions for reproducible inference\n\n## Development\n\nTo modify the application:\n1. **Start the development server**: `python3 -m http.server 8000`\n2. **Edit `LLMDeterminismApp.jsx`** (uses React hooks, no ES6 imports)\n3. **Refresh your browser** at `http://localhost:8000`\n4. Changes will be reflected immediately\n\nThe component uses React hooks for state management and includes hover effects, animations, and interactive simulations.\n\n### Technical Notes\n- The JSX file has been modified to work with Babel standalone in the browser\n- React imports have been replaced with global `React.useState` calls\n- Component is exported to `window.LLMDeterminismApp` for browser compatibility\n\n## License\n\nThis educational demonstration is provided as-is for learning purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flynnlangit%2Fllm-determinism-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flynnlangit%2Fllm-determinism-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flynnlangit%2Fllm-determinism-app/lists"}