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

推荐订阅源

The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
T
Threatpost
WordPress大学
WordPress大学
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
PCI Perspectives
PCI Perspectives
T
The Exploit Database - CXSecurity.com
Y
Y Combinator Blog
雷峰网
雷峰网
爱范儿
爱范儿
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
S
Securelist
宝玉的分享
宝玉的分享
L
LangChain Blog
O
OpenAI News
AI
AI
P
Privacy International News Feed
L
LINUX DO - 最新话题
D
DataBreaches.Net
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs
罗磊的独立博客
M
MIT News - Artificial intelligence
Security Archives - TechRepublic
Security Archives - TechRepublic
月光博客
月光博客
博客园 - 【当耐特】
T
Tailwind CSS Blog
C
Cybersecurity and Infrastructure Security Agency CISA
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
Jina AI
Jina AI
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
Webroot Blog
Webroot Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店 GitHub - EdoardoBambini/Agent-Armor-Iaga: AI agents are getting tool access — shell, file system, databases, APIs, secrets. But **nobody is governing what they actually do with it**. Frameworks like LangChain, CrewAI, AutoGen, and Claude Code give agents the power to execute. Agent Armor gives you the power to control, audit, and approve every single action before it happens. HN Vibes — Week 15, Apr 7–13 2026 GitHub - chojs23/ec: Easy terminal-native 3-way git mergetool vim-like workflow GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - JakOb-dotcom/cloud-sandbox-security-analysis: Technical analysis and Proof of Concept (PoC) regarding environment variable exfiltration in containerized cloud sandboxes via side-channel data leaks. Springboards - Flint Alpha Show HN: A simpler coding agent harness GitHub - audiodude/sudomake-friends GitHub - 256thFission/mini-mythos: OSS clone of Anthropic’s Mythos harness to locate C/C++ memory vulnerabilities Show HN: OpenParallax: OS-level privilege separation for AI agent execution Hacker News Sorted - Chrome 应用商店 Show HN: How to Install Docker on Ubuntu 24.04 LTS: Complete 2026 Guide GitHub - himanshudongre/smriti GitHub - sverrirsig/claude-control: macOS desktop dashboard for monitoring and managing multiple Claude Code sessions GitHub - ory/dockertest: Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work. Chiral - Chrome 应用商店 Show HN: Two Claudes collaborating through shared memory on a $100 mini-PC GitHub - pmichaillat/latex-cv: Minimalist LaTeX template for academic CVs GitHub - oguzbilgic/posse: A web UI for Anthropic Managed Agents. GitHub - sshiraz/depsly: Dependency risk analysis tool for npm packages ABI Add safari/agent-harness — Safari browser automation via safari-mcp by achiya-automation · Pull Request #212 · HKUDS/CLI-Anything GitHub - Halfblood-Prince/trustcheck: Verify PyPI package attestations and improve Python supply-chain security GitHub - oguzbilgic/kern-ai: Agents that do the work and show it. GitHub - bruits/satteri: High-performance Markdown and MDX processing for the JavaScript ecosystem GitHub - tylergibbs1/feedstock: High-performance web crawler and scraper for TypeScript, powered by Bun and Playwright GitHub - Grimm67123/grimmbot: The self-improving sandboxed and open-source AI agent. With persistent memory and scheduling. GitHub - whitevanillaskies/whitebloom: Local whiteboard that blooms. GitHub - hwdsl2/docker-whisper: Docker image for a self-hosted Whisper speech-to-text server with speaker diarization and OpenAI-compatible transcription and translation APIs. Powered by faster-whisper. Supports all Whisper models, NVIDIA GPU (CUDA) acceleration, JSON/SRT/VTT output, SSE streaming, offline mode, and multi-arch (amd64, arm64). GitHub - yisding/reviewwiggum GitHub - MarwanAlsoltany/serrors: Structured errors for Go: sentinel hierarchies, typed data, custom formatting, and slog integration. GitHub - soatok/age-php GitHub - Luthiraa/markitme GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits GitHub - tombedor/excalicharts GitHub - wh1le/excalidraw-edit: Open and edit .excalidraw files from the terminal. Offline, auto-saves to disk. MalExt Sentry - Malicious Extension Scanner - Chrome 应用商店 GitHub - syi0808/asciianimesvg: Generate animated ASCII art SVGs from text. CLI, Rust library, WASM, and web editor. GitHub - zaina-ml/ml_forge: A visual-based graph node editor for training computer vision models. GitHub - anakin87/llm-rl-environments-lil-course: 🌱 A little course on Reinforcement Learning Environments for evaluating and training Language Models GitHub - takaakit/superpowers-uml: Superpowers-UML modifies Superpowers to ensure a software development workflow in which AI agents design through UML modeling. AdriByte Studio - Sviluppo Web e Soluzioni Digitali GitHub - chouligi/angel-copilot: Your personalized Angel Investment Advisor Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 GitHub - agenteractai/lodmem: Level Of Detail Context Management for Agents GitHub - ostefani/subnetlens: A fast, concurrent network scanner with a TUI and plain-text CLI, built in Go. It discovers live hosts on your network, scans their open ports, resolves hostnames, and fingerprints operating systems—delivered. Cyber Pulse: Agentic Intel - Apps on Google Play Whisper API: Self-Hostable Speech to Text Transcription The Agent-Web Protocol Stack: A Research Thesis GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Show HN: Provepy – A Python decorator that proves your code using Lean and LLMs Show HN: Pardonned.com – A searchable database of US Pardons GitHub - patrickdappollonio/dux: Dux is a terminal UI that lets you run multiple AI coding agents side by side, each in its own git worktree, with full companion terminals, macros, commit generation, and a command palette that knows more tricks than you do. kMC Crystal Simulator Show HN: HyperFlow – A self-improving agent framework built on LangGraph GitHub - stef41/vibescore: 🎵 Grade your vibe-coded project. One command, instant letter grade across security, quality, dependencies, and testing. GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. imgur.com GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. GitHub - nowork-studio/toprank: Open-source Claude Code skills for SEO, SEM, Google Ads GitHub - tacomanator/sash: Lightweight macOS menu bar app for reliably cycling through windows of the current application. Appents | Social Media Management for Product-First Teams GitHub - pnhoang/youtube-spam-blocker: Automatically detects and hides spam messages in YouTube Live chat. Set rate limits, keyword filters, and block repeat offenders. GitHub - decisionnode/DecisionNode: CLI + Local MCP - A shared structured memory store across Claude Code, Cursor, Windsurf, Antigravity, and every MCP client. Semantically queryable. GitHub - AvaCodeSolutions/django-email-learning: An open source Django app for creating email-based learning platforms with IMAP integration and React frontend components. The $100K Gap in Kubernetes Security Tooling Function Calling Harness: From 6.75% to 100%
GitHub - TSltd/phase_router_rs: Deterministic, capacity-aware routing for modern systems.
TSltd · 2026-05-01 · via Hacker News: Show HN

Phase Router

A deterministic, capacity-aware routing kernel that reduces dropped work in load-balanced systems.

Trades microseconds of routing for milliseconds of saved compute.

Hashing assumes all targets are equal.

Real systems are not equal.

Phase Router aligns load with capacity → fewer drops.

Phase Router: 92.5% survival
Hash:         76.4% survival

Phase Router reduces dropped tokens by 10–19% in realistic MoE settings.

This crate provides a Rust implementation of a phase-based routing algorithm that distributes uneven workloads across fixed-capacity targets without global coordination.


Why this matters

Hash routing is fast, but blind to capacity.

In capacity-constrained systems (e.g. Mixture-of-Experts):

  • Overloaded targets drop work
  • Dropped work wastes compute and degrades quality

Phase Router trades microseconds of routing for fewer dropped tokens - avoiding drops is often cheaper than routing faster.


What this does

Given two inputs:

  • Sources with varying weights (rows)
  • Targets with varying capacities (columns)

The Phase Router computes a sparse assignment:

O ∈ {0,1}^{N×N}

such that:

  • Each row has at most k outputs (bounded fan-out)
  • Column loads are balanced in expectation
  • Routing is deterministic given a seed

Intuition

The algorithm:

  1. Left-aligns row mass (preserving row degrees)
  2. Embeds mass into a cyclic phase space
  3. Applies independent permutations
  4. Evaluates interval intersections in phase space
  5. Extracts up to k connections per row

Routing reduces to intersection of intervals on a circle (O(1) per candidate), instead of scanning or materializing matrices.

This produces a low-skew, degree-weighted routing without solving a global optimization problem.

Key properties

Core guarantees:

  • Deterministic Same input + seed → identical output

  • Bounded fan-out

    ∑_j O[i,j] ≤ k
    
  • Load-balanced (statistically)

    E[L_j] ∝ t_j
    

Systems properties:

  • No coordination required Fully local, batch computation

  • Zero intermediate matrices Fused pipeline — no bit-packed matrix materialization

  • Work proportional to active mass — iterates only over nonzero row degrees (skips zeros entirely)

  • Order-independent behavior — input ordering does not create geometric hotspots


Pipeline

The implementation uses a fully fused pipeline that eliminates all intermediate matrices:

1. Precompute O(n) arrays:
   - row offsets (cumulative popcount prefix sums)
   - row ones counts (popcount per row)
   - inverse source permutation

2. For each row j (parallel):
   - Iterate only positions where S'[j,*] = 1 (cyclic interval)
   - Map positions through inverse permutation
   - Evaluate T'[j,col] via arithmetic interval test (no matrix lookup)
   - Reservoir sample up to k matches (O(k) memory)

Design principles

  • No materialized S′ / T′ matrices — all phase transforms are evaluated analytically at query time
  • O(1) per candidate — intersection reduced to arithmetic interval checks (no bitwise scans)
  • Memory: O(n) — only 5 small arrays, no n×n matrices
  • Highly parallel — each row is fully independent
  • Cache-friendly — sequential access to small precomputed arrays

Crate structure

src/
├── lib.rs        # public API + tests
├── core.rs       # pipeline stages (offsets, row_ones, inverse perm, cyclic range)
├── router.rs     # fused phase router (sole implementation)
└── python.rs     # PyO3 bindings (thin wrapper, no logic duplication)

benches/
└── bench.rs      # Criterion benchmarks (Phase Router vs hash, k sweep)

examples/
├── bench.rs      # Quick CLI benchmark (Phase Router vs hash timing)
└── moe_bench.rs  # MoE capacity-constrained benchmark (4 experiments)

python/
└── phase_router.py  # High-level Python API (bit-packing, analysis)

scripts/
├── demo.py       # Interactive demo with plots
└── plot_moe.py   # MoE benchmark plot generation

Usage

use phase_router_rs::router::phase_router;

let routes = phase_router(
    &s_bits,
    &t_bits,
    n,
    nb_words,
    k,
    &col_perm_s,
    &col_perm_t,
    seed,
);

Inputs

  • s_bits, t_bits: bit-packed matrices (Vec<u64>)
  • n: matrix size
  • nb_words: (n + 63) / 64
  • k: max outputs per row
  • col_perm_*: column permutations
  • seed: deterministic seed

Output

  • Vec<i32> of size n * k
  • Each row contains up to k column indices (-1 if empty)

Benchmarks

Run the quick CLI benchmark (Phase Router vs hash routing):

cargo run --release --example bench

Run Criterion benchmarks with statistical analysis:

cargo bench

The benchmarks compare Phase Router vs uniform hash routing across sizes (N=64–4096) and fan-out values (k=1–16).

Hash routing is faster, but Phase Router uses additional compute to align load with capacity.

At small batch sizes the overhead is modest (~1–3×), while at large scale it grows — but this cost is typically outweighed by reduced dropped work in capacity-constrained systems.

See the MoE comparison for quality results.

Run the full MoE capacity-constrained benchmark:

cargo run --release --example moe_bench

🧪 Current status

  • ✅ Correctness validated (basic tests)
  • ✅ Deterministic routing
  • ✅ Parallel execution via Rayon
  • ✅ Fully fused pipeline (no intermediate matrices)
  • ✅ Benchmark suite vs hash routing (CLI + Criterion)
  • ✅ Python bindings (PyO3 + maturin)
  • ✅ MoE capacity-constrained benchmarks

Optimizations applied

Structural optimizations

  • Fully fused pipeline — eliminates all n×n matrices
  • Analytical phase evaluation (no S′ / T′ materialization)
  • Reservoir sampling — O(k) memory, no candidate buffer
  • Python bindings via pyo3 + maturin

Micro-optimizations

  • Modulo-free cyclic iteration
  • Branchless cyclic range check
  • Precomputed T lookups
  • Thread-local buffer reuse

Remaining opportunities

  • SIMD acceleration (std::arch) for hot loops
  • Optional unsafe fast paths (bounds check elimination)
  • Benchmark suite vs C++ implementation

Target use cases

This implementation is best suited for:

  • ML inference routing (micro-batch load balancing)
  • Distributed data partitioning
  • Cache / shard rebalancing
  • Bioinformatics (k-mer distribution)
  • Graph partitioning

Mixture-of-Experts (MoE) Routing

The problem

Naive routing wastes capacity.

The consequence

Dropped tokens = wasted compute.

The fix

Phase Router aligns load with capacity by construction.

Hash:          E[load_j] = k           (uniform, ignores capacity)
Phase Router:  E[load_j] ∝ capacity_j  (capacity-aware by construction)

This emerges because both source mass and target capacity are embedded into the same cyclic phase space, and routing corresponds to interval intersection in that space.

Benchmark results

We benchmark against uniform hash routing on N=1024 experts with heterogeneous capacities (10% at 8×, 20% at 2×, rest at 1×). Metric: token survival rate (fraction of routed tokens not dropped).

Scenario Phase Router Hash Advantage
Tight capacity (1.0× headroom) 87.9% 79.2% +8.7%
Practical capacity (1.2× headroom) 89.8% 79.2% +10.5%
High fan-out (k=16) 96.6% 77.6% +19.0%
Large scale (N=4096) 91.1% 79.0% +12.1%

Key findings:

  • 10–19% higher token survival across all tested configurations
  • Advantage grows with fan-out k — at k=16, Phase Router delivers 96.6% vs 77.6% (+19pp)
  • ~40% less overprovisioning needed — Phase Router hits 90% survival at 1.2× headroom; hash needs ~2×
  • Consistent across scale — 10–14% advantage from N=256 to N=4096
  • Advantage emerges with heterogeneity — near-identical at uniform capacity, +10.5% at strong heterogeneity

When it matters most

The advantage is largest when:

  • Expert capacities are heterogeneous (mixed GPU types, variable batch budgets)
  • Token drops are expensive (require recomputation or degrade model quality)
  • Overprovisioning budget is limited (can't afford 2× headroom)
  • Fan-out k is moderate to large (k ≥ 4, as in Switch Transformer / GShard)

For the full benchmark methodology and results, see docs/comparison.md.


When to use this

Use Phase Router when:

  • You have skewed workloads
  • You can process in batches
  • You need fast recomputation
  • You want deterministic behavior

Avoid when:

  • You need real-time per-item decisions
  • You have multi-dimensional constraints (CPU + RAM + etc.)
  • You require strict optimality guarantees

Conceptual comparison

Method Speed Balance Deterministic Global State
Hashing ⭐⭐⭐⭐⭐ ⭐⭐
Greedy ⭐⭐ ⭐⭐⭐⭐
Phase Router ⭐⭐⭐⭐ ⭐⭐⭐⭐

Python Bindings

The Rust kernel is exposed to Python via PyO3 + maturin. The bindings are a thin wrapper — zero logic duplication, GIL released during compute.

Install

pip install maturin
maturin develop --release

Quick start (high-level API)

import numpy as np
import phase_router_rs

# Bit-packed source/target matrices (flat u64 arrays)
n = 1024
nb_words = (n + 63) // 64
s_bits = np.ones(n * nb_words, dtype=np.uint64) * 0xFFFFFFFFFFFFFFFF
t_bits = np.ones(n * nb_words, dtype=np.uint64) * 0xFFFFFFFFFFFFFFFF

# phase_router_auto generates permutations from seed internally
routes = phase_router_rs.phase_router_auto(s_bits, t_bits, n, k=4, seed=42)
# routes: np.ndarray shape (n, k), dtype int32
# routes[i] → up to k target indices for source i (-1 = empty)

Low-level API (bring your own permutations)

col_perm_s = np.random.permutation(n).astype(np.uint64)
col_perm_t = np.random.permutation(n).astype(np.uint64)

routes = phase_router_rs.phase_router(
    s_bits, t_bits, n, nb_words, k=4,
    col_perm_s, col_perm_t, seed=42,
)

Performance notes

  • GIL is released during Rust compute — Rayon parallelism works fully
  • Returns 2D array (n, k) — no reshape needed
  • Use contiguous arrays: np.ascontiguousarray(arr, dtype=np.uint64) to avoid silent copies
  • Routing cost is amortized by avoiding dropped-token recomputation

Demo: Phase Router vs Hash Routing

A full interactive demo compares Phase Router against uniform hash routing on 512 experts with heterogeneous capacities:

python scripts/demo.py

The demo produces:

  1. Load distribution stats — mean, std, CV, max/mean for both methods
  2. Load–capacity correlation — Phase Router targets ≈ 1.0, hash ≈ 0.0
  3. Per-expert load tables — top/bottom experts by capacity with load alignment
  4. Token survival after capacity enforcement — Phase Router drops fewer tokens
  5. Capacity vs Load plot (plots/capacity_vs_load.png) — Phase Router load rises diagonally with capacity; hash stays flat
  6. Load/Capacity ratio plot (plots/load_capacity_ratio.png) — Phase Router holds a flat ratio (balanced); hash slopes downward (overloads small experts, wastes large ones)

The high-level Python API (python/phase_router.py) handles bit-packing and permutation generation so users never touch u64 arrays:

from phase_router import route, hash_route, compute_loads

routes = route(target_capacities=[1,1,1,8,8,2,2,1], n=8, k=4, seed=42)
loads = compute_loads(routes, n=8)

The demo shows that the Phase Router aligns load with capacity, while hashing ignores it.

Phase Router approximates E[load_j] ∝ capacity_j under a hard fan-out constraint (k), which slightly compresses extreme values.


License

MIT


Contributing

Contributions are welcome, especially around:

  • SIMD optimization
  • real-world benchmarking
  • integration examples

Summary

Phase Router is:

A fast, deterministic, low-skew routing primitive built on cyclic phase arithmetic which aligns load with capacity — without coordination or optimization..

This Rust implementation delivers:

  • Optimized fully fused pipeline with zero matrix materialization
  • O(n) memory instead of O(n²)
  • Highly parallel row-independent computation
  • Deterministic, reproducible routing from any seed

This enables fast, repeatable routing decisions in systems where traditional hashing causes load imbalance and greedy methods are too expensive.