惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
博客园 - 【当耐特】
量子位
有赞技术团队
有赞技术团队
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Check Point Blog
B
Blog RSS Feed
M
MIT News - Artificial intelligence
H
Help Net Security
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
腾讯CDC

Hacker News - Newest: "LLM"

GitHub - lechmazur/position_bias: A benchmark for testing whether LLM judges keep the same preference when two lightly edited versions of the same story are shown in opposite orders. Flex routing (EU and EFTA) Dark Factories: Retooling for LLM Velocity Ask HN: What would be the impact of a LLM output injection attack? GitHub - AronDaron/dataset-generator: No-code desktop app for generating high-quality synthetic datasets to fine-tune LLMs — plan-then-execute pipeline, LLM-as-judge, HuggingFace upload. GitHub - Oaklight/llm-rosetta: Production-ready LLM API translation layer for Python — bidirectional conversion between OpenAI, Anthropic & Google formats via hub-and-spoke IR. Optional API gateway. Streaming & non-streaming. Zero core deps. Contributions welcome! GitHub - browser-use/browser-harness: Self-healing browser harness that enables LLMs to complete any task. GitHub - moeen-mahmud/remen: Remen turns thoughts into something you can return to Analyzing 156 LLM Launch Posts on Hacker News ChatGPT vs Gemini vs Claude: The Best LLM Subscription You Should Buy GitHub - salaamalykum/quran-semantic-search: High-density RAG Semantic Search Engine & Quran Corpus (GEO/SEO Architecture) GitHub - NVIDIA/TensorRT-LLM: TensorRT LLM provides users with an easy-to-use Python API to define Large Language Models (LLMs) and supports state-of-the-art optimizations to perform inference efficiently on NVIDIA GPUs. TensorRT LLM also contains components to create Python and C++ runtimes that orchestrate the inference execution in a performant way. The State of LLM Bug Bounties in 2026 Operational Readiness Criteria for Tool-Using LLM Agents Meshcore: Architecture for a Decentralized P2P LLM Inference Network How an LLM becomes more coherent as we train it GitHub - seetrex-ai/laimark GitHub - Jossifresben/BibCrit: AI-assited biblical textual criticism GitHub - wastedcode/memex: File system based wiki, maintained by Claude 99helpers.com GitHub - cliver-project/AITrigram GitHub - unbody-io/adapt: A self-evolving memory layer for AI agents. GitHub - hb20007/awesome-gen-ai-fails: A list of incidents where reliance on generative AI and LLMs resulted in harm to companies, individuals, or society GitHub - nevenkordic/localmind: Run any local LLM with persistent memory and context. CLI agent over Ollama with SQLite-backed hybrid recall. No cloud. Ask HN: What are the machine requirements for a LLM like Llama-3.1-8B? Faster LLM Inference via Sequential Monte Carlo grpo explained: group relative policy optimization for llm finetuning - cgft Stop comparing price per million tokens: the hidden LLM API costs · TensorZero Andrej Karpathy's LLM Wiki Is a Bad Idea GitHub - GG-QandV/mnemostroma: Offline RAM-first cognitive leer/coprocessor for AI agents and robotics. Solves "Context Abandonment" with 20-80ms latency using a dual-thread biomimetic memory architecture (ONNX + SQLite WAL).
GitHub - Beledarian/wgpu-llm: A from-scratch LLM inferenc...
2026-04-11 · via Hacker News - Newest: "LLM"

A minimalist Llama inference engine written in Rust and WGSL.
Runs locally on any GPU — no CUDA required.


wgpu-llm generating 24 tokens/sec natively on Snapdragon Adreno

What Is This?

A from-scratch LLM inference engine that uses wgpu v29 to dispatch WGSL compute shaders for the full Transformer forward pass. No CUDA. No Python. No framework dependencies. Just Rust, raw shaders, and your GPU.

Target architecture: Llama (TinyLlama, Llama 2/3, and compatible fine-tunes).
Tested with: TinyLlama-1.1B-Chat-v1.0

Benchmarks (TinyLlama 1.1B, 256 tokens, default sampling)

GPU Mode VRAM (weights) tok/s
RTX 3090 (Vulkan) f16-weights ~2.05 GiB 66+
Adreno X1-85 (Vulkan) INT8-b64 1.27 GiB 32.8
Adreno X1-85 (Vulkan) f16-weights 2.05 GiB 25.5

Why?

  • The Copilot+ Hardware Gap — I recently got a Snapdragon X Elite Copilot+ laptop and quickly realized my GPU was effectively a paperweight for local AI. Standard tools like LM Studio and the massive PyTorch ecosystem didn't support the integrated Adreno GPU, forcing everything onto the CPU. I didn't want to wait for the ecosystem to catch up, so I bypassed it entirely.
  • Portability — runs on Windows, macOS, Linux, and anything with a Vulkan/Metal/DX12 driver.
  • Educational — every layer of the Transformer is visible as a standalone WGSL shader. No framework magic.
  • Hackable — small codebase, clear data flow, easy to experiment with.

How It Was Built

wgpu-llm is an experiment in highly leveraged, AI-accelerated engineering. Starting from a detailed, human-designed architectural blueprint, the engine was scaffolded into working code in under 16 hours using a custom LLM orchestration pipeline with a human-in-the-loop approach.

To ensure the AI could write complex, low-level code without hallucinating or losing track of the architecture, the orchestrator was augmented with my own open-source tools:

  • MCP_WGSL_Docs: Fed the LLM the exact, up-to-date WGSL specification so it could accurately implement features like tiled GEMM and compile-time f32/f16 switching across 12 standalone compute shaders.
  • mcp-local-memory: Maintained persistent, strict architectural context across the entire 16-hour development sprint, ensuring the Rust host code and WGSL shaders stayed perfectly aligned.

Installation

Prerequisites: Rust and Cargo + a GPU with Vulkan, Metal, or DX12 support.

Install from crates.io

cargo install wgpu-llm

Build from source

git clone https://github.com/Beledarian/wgpu-llm.git
cd wgpu-llm
cargo build --release

Quick Start

Download a compatible model (e.g., TinyLlama-1.1B-Chat) — the model directory needs config.json, tokenizer.json, and *.safetensors.

# If installed via cargo install:
wgpu-llm --model-dir /path/to/model --prompt "The overarching philosophy of stoicism teaches us" --max-tokens 256 --f16-weights

# If built from source:
cargo run --release --bin wgpu-llm -- --model-dir /path/to/model --prompt "The overarching philosophy of stoicism teaches us" --max-tokens 256 --f16-weights

The engine auto-detects your GPU capabilities, loads weights, and streams generated text to stdout. After generation it prints a telemetry summary (VRAM breakdown, tok/s, timing).

INT8 mode (~2× VRAM reduction):

# 1. Quantize your model (one-time step, requires Python + safetensors)
python scripts/quantize_int8.py /path/to/model /path/to/model-int8 --block-size 64

# 2. Run with quantized weights
wgpu-llm --model-dir /path/to/model-int8 --prompt "..." --max-tokens 256 --gemm-int8-block-size 64

For the full list of CLI flags (sampling, INT8 GEMM, KV spill, memory budget, dry-run), see the CLI Reference.

Current Limitations

  • Alpha quality — functional but not production-hardened
  • Decode-only — prompt tokens are processed sequentially (no batched prefill yet)
  • Single-sequence — no batching or concurrent requests
  • INT8 lightly tested — verified with TinyLlama 1.1B; quality may vary with larger models
  • CPU-side sampling — logits read back to CPU for top-k/top-p/temperature; fast enough for single-sequence but not optimal
  • No chat template — raw text completion only; no multi-turn conversation support yet
  • Timing is wall-clock — reported tok/s includes CPU overhead, not isolated GPU kernel time

Architecture at a Glance

Text → Tokenizer → Embedding → [N × Transformer Layers] → Logits → Sampler → Token
                                       │
                                  ┌────┴────┐
                                  │  Attn   │ ← KV Cache (paged)
                                  │  FFN    │
                                  └─────────┘

Each box is one or more WGSL compute shader dispatches orchestrated by Rust.
See docs/architecture.md for the full system design.

Key Design Decisions

Decision Detail
12 WGSL compute shaders Every Transformer op is a standalone shader (GEMM, MATVEC, RMSNorm, RoPE, SiLU, softmax, etc.)
f32/f16 compile-time switching WGSL string injection — no runtime branching
Paged KV Cache Lazy GPU page allocation with per-page sequence-offset writes
Single CommandEncoder All dispatches per token in one GPU submission — no mid-pipeline sync
CPU-side sampling Temperature → top-k → top-p → softmax → weighted sample; GPU argmax at temp=0
Row-sharding Large embedding/LM-head tensors auto-split to fit max_storage_buffer_binding_size
GQA support Grouped-Query Attention for Llama 3 models

Future Roadmap

  • Batched prompt prefill — process all prompt tokens in one dispatch
  • GPU timestamp queries — accurate kernel-level timing
  • 7B+ model support — optimize for Llama 3.1 8B and larger
  • INT8 GEMM activation ✅ — ~2× VRAM reduction via scripts/quantize_int8.py + --gemm-int8-block-size
  • Streaming output ✅ — tokens are emitted as generated
  • Multi-turn chat — KV cache reuse with chat template wrapper

See docs/plan.html for the full interactive roadmap.

Documentation

Document Purpose
Architecture System design, data flow, buffer layouts
CLI Reference All flags, sampling config, advanced modes
Roadmap Interactive implementation plan
Doc Maintenance Documentation rules for contributors
Guides wgpu & WGSL pitfalls and best practices
Contributing How to contribute

License

Dual-licensed under MIT or Apache-2.0 at your option.