今日精选
HOT最新资讯
共 27243 篇Persistent State Machines: LLM Attention with INT4 In-Memory Cells
Article URL: https://zenodo.org/records/21753002 Comments URL: https://news.ycombinator.com/item?id=49140080 Points: 8 # Comments: 2
How Is ""2" > "10"" "true" in JavaScript?
What is output of ""2">"10"" true or false At first glance, this looks completely wrong. We all know that: 2 > 10 is obviously: false Because 2 is smaller than 10. But what happens when we add quotation marks? "2" > "10" The result is: true 😱 Wait… how can 2 be greater than 10? The answer is simple: ""2"" and ""10"" are not numbers. They are strings. 🔢 Numbers vs. Strings In JavaScript, these two values are different: 2 This is a number. While: "2" This is a string. The quotation marks tell JavaScript that the value should be treated as text. So: 2 > 10 compares two numbers: 2 > 10 → false But: "2" > "10" compares two strings. And that's where things get interesting! 🔤 How Does JavaScript Compare Strings? When JavaScript compares two strings, it uses lexicographical comparison. You can think of this as comparing text in a dictionary-like order, based on the character values. Let's compare: "2" "10" JavaScript looks at the first character of each string: "2" → first character is 2 "10" → first character is 1 Since the character ""2"" comes after ""1"" in the ordering used for the comparison, JavaScript determines: "2" > "10" as: true So: console.log("2" > "10"); outputs: true 🧪 Let's Compare Both Cases Case 1: Numbers console.log(2 > 10); Output: false Because JavaScript compares the actual numerical values: 2 is less than 10 Case 2: Strings console.log("2" > "10"); Output: true Because JavaScript performs a string comparison. The important thing is: 2 → Number "2" → String The quotation marks can completely change how JavaScript interprets the value. ⚠️ What About Mixed Types? Now look at this: console.log("2" > 10); Here, one value is a string and the other is a number. JavaScript handles this differently. In this case, it converts the string ""2"" into a number for the comparison. So the comparison effectively becomes: 2 > 10 The result is: false This is why understanding data types is extremely important when programming. 💡 The Big Lesson These three comparisons
Gotcha: chasing a bug that was never in my code
This is a submission for DEV's Summer Bug Smash: Smash Stories powered by Sentry . The build was done. Themis Lex worked on my machine, and not in the "works if you squint" way. A court clerk enters their role, describes their workflow, picks a data sensitivity level, and gets back a PDF with two sections: where AI can safely support the work, and where it must never touch it. Claude via Bedrock generates the assessment. Server-side PDF render. No accounts, no storage, session ends when the download does. Three weeks solo, for the Women in AI Accelerator Spring 2026 Build Challenge. Initial commit went in at 7:06pm on May 9. I pushed to AWS Amplify . Build went green. I opened the live site, filled out the form, hit submit. Nothing. Twenty eight seconds later, "Request timed out." I told myself the bug was not in my code. Everything ran locally. This had to be a platform problem. That belief carried me all night. It mostly held up. The exception was the first thing I should have checked. Here is the commit log, because it tells the story better than I can: 19:06 Initial commit: Themis Lex MVP 20:31 refactor: migrate Bedrock auth to IAM compute role 22:29 diag: log credential env vars at runtime (booleans only, remove after fix) 22:40 fix: forward BEDROCK_MODEL_ID to SSR runtime via next.config.js env 22:50 fix: switch to InvokeModelWithResponseStreamCommand to beat 28s Lambda timeout ... 06:28 fix: remove unused type export that broke isolatedModules build 06:37 fix: end-to-end response streaming to beat Amplify 28s gateway timeout 06:48 fix: reduce max_tokens to 3000 to fit Amplify 30s timeout 06:52 fix: reduce max_tokens to 2000, 3000 still exceeded 30s timeout 07:00 fix: switch to Claude Haiku 4.5 to fit Amplify 30s timeout Ten and a half hours from first deploy to the fix that shipped it. That gap between 22:50 and 06:28 is me sleeping on it, which turned out to be the second most productive thing I did. The error message was the absence of an error message My f
I benchmarked which of 18 AI models writes the least like "AI slop"
If you write with AI you already know the tells: the throat-clearing opener, the tidy rule of three, "it's not just X, it's Y." But I was curious to see statistically what models actually produced the most slop, so I made my own opensource benchmark: theslopindex.com Here's how I came up with the benchmark. 1) The Baseline: Slop can only be measured compared to stuff that already existed. So I got corpus of data for various areas of writing (email, social, chat, and essays) so that each has a human baseline. 2) Tasks I then hand-wrote 112 written scenarios for the models to egenerate outputs to across email, Slack, social media posts, and essays (a cold email, a schedule change, a launch tweet, an argumentative essay, etc). Every model gets the identical scenarios at default settings, several samples each: and you can see all the exact outputs in my Github repo. 3) Axes Now for how to decide to measure slop we settled with 5 dimensions. - Conciseness (one of the most annoying parts of AI writing is how it takes 6 paragraphs to say 2 sentences) - Templating (AI often reuses the same sentences/styles across unrelated scenarios) - Rhythm (Variance in sentence/paragaphs, humans often switch this up while models stay p similar) - Tells (Over used vocab and construction for stuff like "delve", "it's not just X, it's Y") - Human Preference (I think this is most important as everything else are just heuristics for this) Note how we DELIBERATIVELY don't have any LLM judging, I think it'd be pretty stupid to have LLMs judge LLMs Now for the results What really surprised me is how human preference influenced the rankings heavily. When looking at only the "mechanical" part. Fable is actually #2 on the benchmark, but when I included human preference it drops to last . And I think this is indicative that as the models more recently have become more benchmark optimized, they've actually produced more slop than less. Which is where good prompting, harness, and more matter. But eith
Stop Leaking PII! Local Data Masking with Transformers.js and WASM
In an era where data privacy is no longer a "nice-to-have" but a legal mandate (looking at you, GDPR and HIPAA), sending raw user data to the cloud is like playing with fire. If you are building health-tech or fintech apps, the risk of exposing Personally Identifiable Information (PII) is a constant headache. But what if the data never leaves the user's browser in its raw form? Enter Edge AI and Privacy-preserving AI . By leveraging Transformers.js and WebAssembly (WASM) , we can perform complex Named Entity Recognition (NER) to de-identify sensitive information directly on the client side. In this tutorial, we’ll build a "Privacy Shield" that detects and masks names, locations, and health identifiers before they ever hit your API. The Architecture: Privacy First 🏗️ The traditional approach involves sending raw text to a server-side LLM or NLP service. Our approach intercepts the data at the "Edge" (the browser). graph TD A[User Inputs Sensitive Health Data] --> B{Browser-side Privacy Shield} B --> C[Transformers.js / WASM] C --> D[NER Model Analysis] D --> E[Data Masking / Redaction] E --> F[Clean Data] F --> G[Cloud Storage / Analytics] G -.-> H[Compliance & Security ✅] style B fill:#f9f,stroke:#333,stroke-width:2px style C fill:#bbf,stroke:#333,stroke-width:2px By using WebAssembly , we get near-native performance for running BERT-based models in the browser, ensuring the UI remains snappy while keeping the data 100% local. Prerequisites 🛠️ To follow along, you'll need: Tech Stack : TypeScript, Vite, and Transformers.js . Basic understanding of NER (Named Entity Recognition) . A passion for not getting sued for data leaks. 🥑 Step 1: Setting up the Privacy Pipeline First, let's install the library: npm install @xenova/transformers Now, let's create our PrivacyShield service. We will use a lightweight NER model (like Xenova/bert-base-NER ) that has been optimized for the web. // src/services/privacyShield.ts import { pipeline , env } from ' @xenova/transformers ' ;
The Open-Weight Inflection Point: Kimi K3, Claude Opus 5, and Microsoft MAI Signal a Market Shift
The Open-Weight Inflection Point: Kimi K3, Claude Opus 5, and Microsoft MAI Signal a Market Shift Subtitle: Three major releases in one day point to the same conclusion — the AI industry is shifting from "who can build the strongest model" to "who can build the most cost-effective one." July 28, 2026, might be remembered as the day the AI industry's center of gravity shifted. Three announcements — from Moonshot AI, Anthropic, and Microsoft — each independently signaled the same underlying trend: open and cost-efficient models are becoming the new competitive baseline. Here's what happened and why it matters. 1. Kimi K3 Goes Open-Weight: First 3T-Class Open Model Moonshot AI publicly released Kimi K3's full model weights on HuggingFace — a 2.8-trillion-parameter Mixture-of-Experts model with 104B activated parameters. This is the first 3T-class model ever made openly available to the public. Key technical highlights: Architecture: Kimi Delta Attention (KDA) + Attention Residuals (AttnRes), 896 experts with 16 activated per token Native Multimodality: Text, images, and video understanding via MoonViT-V2 vision encoder Context Window: 1,048,576 tokens (~1M tokens) Benchmarks: Terminal-Bench 2.1: 88.3, BrowseComp: 91.2, MCPMark-Verified: 94.5 — competitive with Claude Fable 5 and GPT-5.6 Sol Why it matters: Kimi K3 raises the "open-source model ceiling" to an unprecedented level. For the first time, a model that competes with top-tier closed-source models is available with fully public weights — giving startups, researchers, and enterprises a genuine alternative to API-dependent workflows. For developers, this is the practical part: you can now self-host a model that holds its own against frontier closed models. That changes cost models, data-privacy decisions, and vendor lock-in math overnight. 2. Claude Opus 5: Anthropic's "Daily Driver" Strategy Anthropic launched Claude Opus 5 — a mid-premium model positioned as the "daily driver" for 90% of knowledge work. The key
136 raw removals, 17 real ones: what a spec diff over-reports
Originally published at mendapi.com . Between two published snapshots of the Cloudflare OpenAPI schema — 7abe88500e55 (2026-03-31) → c92b9b0fde23 (2026-07-27) — a raw structural diff produced 6,354 change records. 136 of them were endpoint path removals, the scariest kind a diff can report: the route your code calls is simply gone from the spec. Except 119 of those 136 were not gone at all. This is the accounting of how we know, per record, with machine evidence. The trap in a raw diff A path removal in a spec diff means one thing: the string key disappeared from the paths object. It does not mean the runtime URL stopped working. Specs get refactored — concrete routes collapse into templated ones, path parameters get renamed, methods get merged — and every one of those refactors shows up as a "removal" if you only look at one side of the diff. An alerting tool that pages you 136 times for this corridor is training you to ignore it. The whole job of the curation layer is to keep that from happening without silently dropping a real break. The ledger: 17 + 119 = 136 Every one of the 136 raw removals has an adjudicated destination. 17 were kept as genuinely client-breaking: the runtime URL or method really disappeared, with no surviving successor. The other 119 were excluded, each with machine evidence from the two spec snapshots that the surface actually survives: Template consolidation — 107 records. Concrete Workers AI model routes like /ai/run/@cf/baai/bge-m3 collapsed into the pre-existing generic /ai/run/{model_name} route. The runtime URL a client sends never changed; the spec just stopped enumerating each model. The evidence rule requires the templated route to exist in both snapshots and to swallow the removed path with a literal-anchored match, so a template that is merely a shape prefix of a genuinely removed endpoint does not count. Parameter rename, runtime-identical — 11 records. Path parameters renamed ( {postfix_id} to {investigate_id} and friends). Afte
Why I Fell in Love with Rust’s Memory Model (Even Though It’s Hard)
I’ve worked with languages like JavaScript and Go , and I enjoyed both for different reasons. JavaScript gave me speed and flexibility. Go gave me simplicity and practical concurrency. Then I met Rust and at first, it felt difficult. But once I understood how Rust handles memory without a garbage collector , I fell in love with it. Memory Safety Without a Garbage Collector Most modern languages solve memory management with a garbage collector (GC) . A GC periodically finds memory that is no longer used and frees it automatically. Rust takes a different path: No runtime garbage collector No manual free() like in C Memory safety guaranteed at compile time (in most cases) Rust uses three core ideas: Ownership Borrowing Lifetimes These rules are checked by the compiler before your program runs. 1) Ownership: One Owner at a Time In Rust, every value has a single owner. When the owner goes out of scope, Rust automatically drops the value and frees memory. { let s = String :: from ( "hello" ); // s owns the string memory here } // s goes out of scope, memory is freed automatically This avoids memory leaks and double-frees in normal code paths, without needing a GC pause. 2) Borrowing: Use Data Without Taking Ownership Instead of copying or transferring ownership all the time, Rust lets you borrow references: Immutable borrow: &T Mutable borrow: &mut T But Rust enforces strict aliasing rules: Many immutable references OR One mutable reference Not both at the same time This rule prevents data races at compile time. 3) Lifetimes: References Must Always Be Valid Lifetimes describe how long references are valid. Often, Rust infers lifetimes automatically. When needed, you can annotate them. This helps prevent dangling references references to memory that no longer exists. How Rust “Behaves” in Practice When writing Rust, you feel the compiler acting like a strict mentor: “Who owns this value?” “How long does this reference live?” “Are you mutating while also sharing?” “Could th
nestjs-docfy: mock servers, contract testing, and a much sharper MCP server
A few weeks ago I shared nestjs-docfy here — a library that moves Swagger decorators out of NestJS controllers into companion *.controller.docs.ts files, docfy-ui as an AI-first reference UI, and docfy-mcp exposing your API catalog to coding agents via list_endpoints / get_endpoint . Since then the CLI grew a full local dev workflow around the spec itself, and docfy-mcp went from "read the docs" to "verify the API is telling the truth." docfy mock : a server without the server \ shell npx nestjs-docfy mock --spec openapi.json --port 4010 \ \ Spins up a throwaway HTTP server straight from your OpenAPI document — every path returns a schema-shaped response. Useful for frontend work against an API that isn't built yet, or for pointing an agent at something real instead of a static spec file. docfy test : contract testing off the spec \ shell npx nestjs-docfy test --spec openapi.json --base-url http://localhost:3000 \ \ Fires a real request at every documented endpoint and validates the live response against its declared schema. Catches the exact failure mode API docs are famous for: the code moved on, the docs didn't. CI-friendly, non-zero exit on drift. docfy init : zero to configured \ shell npx nestjs-docfy init \ \ One command, scaffolds the docfy-export.ts entry file and wires DocfyModule.forRoot() for you. No more copy-pasting from the README. --link-controller : less boilerplate \ shell npx nestjs-docfy generate --link-controller \ \ Auto-inserts @WithDocs() into the controller so newly generated .controller.docs.ts files are actually wired in — one less manual step per endpoint. Breaking changes, surfaced in the PR itself docfy-pr-check-reusable.yml now runs a spec diff and posts breaking vs. informational field changes as a PR comment. You see the blast radius of an API change before merge, not after a consumer files a bug. docfy-mcp: from lookup to verification The MCP server picked up three tools that turn it from a reference into an actual QA loop for agent
I built 38 free browser-only tools that never upload your files
Every time I needed to "compress an image online" or "merge a PDF", I ended up on some site that makes you upload your file to their server. For a random meme, fine. For a contract, an ID scan, or anything private? No thanks. So I built QuickKit — a growing kit of 38 free tools that run 100% in your browser. Your files and text never leave your device. No signup, no watermarks, no tracking of what you process. How it works (the fun part) The whole thing is a static site — no backend, no database, no server cost. Everything happens client-side with browser APIs: Image compressor / resizer → the Canvas API ( canvas.toBlob(type, quality) ) Image → PDF / Merge PDF → jsPDF and pdf-lib, entirely in-page Password / UUID generators → the Web Crypto API ( crypto.getRandomValues ) for real cryptographic randomness QR codes → generated locally, no redirect or tracking baked in Hash generator (SHA-256/1/512) → the SubtleCrypto API Countdown timer & "days since" counters → shareable via the URL itself (state encoded in query params), so there's still no backend Because nothing is uploaded, the tools are faster and more private than upload-based services — and they even work offline once loaded (it's an installable PWA). A few of the tools Files & docs: image compressor, image resizer, image→PDF, merge PDF. Dev utilities: JSON formatter, Base64, hash generator, UUID, timestamp converter, case converter. Everyday: QR generator, word counter, unit/percentage/age calculators, world clock, "your life in weeks". The privacy architecture, in one line If the browser can do it, there's no reason to send the user's data to a server. That principle killed all the usual costs (no servers, no storage, no compliance headaches) and made privacy the default instead of a feature. Would love feedback — especially on tools you wish existed. What "online X converter" do you use that you wish ran locally? 👉 quickkit.space
Fly.io vs Railway: Deployment, Pricing, and Features Compared
Two usage-based cloud platforms with different defaults — a CLI-and-primitives approach versus a repo-first, visual-canvas workflow. Here is how they line up as of 2026-07-29. Fly.io and Railway both let you deploy apps and services and pay for what you use, but they start from different defaults. Railway centers on connecting a Git repository and letting the platform read your code and configure the deploy, all viewed on a visual canvas. Fly.io centers on the flyctl command line and a documented catalog of infrastructure primitives, from machines to managed databases and GPUs. This comparison walks through how each platform handles deployment, pricing, databases, networking, and scaling, using each vendor page as of 2026-07-29. Plan details and prices change often, so treat the figures here as a snapshot and confirm the current terms on each site before you commit. At a glance In short Both are usage-based platforms for shipping apps. Pick Railway to connect a repo and let the platform configure, preview, and roll back deployments from a visual canvas. Pick Fly.io for CLI-driven control plus a documented catalog of Managed Postgres, GPUs, Kubernetes, and HIPAA-ready hosting. Pricing and features noted here are as of 2026-07-29. Head to head Key differences side by side. Feature Fly.io Railway Billing model Usage-based, pay-as-you-go for micro VMs and storage; pricing calculator (as of 2026-07-29) Usage-based, billed per second (as of 2026-07-29) Plan tiers No named consumer tiers; usage plus paid add-ons (as of 2026-07-29) Free $0, Hobby $5/mo min, Pro $20/mo min, Enterprise custom (as of 2026-07-29) Deploy & configuration flyctl CLI and fly launch; config in fly.toml (as of 2026-07-29) Connect repo, auto-config from your code, visual canvas, YAML optional (as of 2026-07-29) Global footprint 18+ regions, sub-second machine boot, 99.9% uptime SLA (as of 2026-07-29) Global deployment, run closer to users; homepage listed no region count (as of 2026-07-29) Managed dat
Where to Publish a Web Game in 2026
A finished browser game is a bundle of static files. Whether you built it in Phaser, Three.js, Babylon.js, Godot, or plain canvas code, the output uploads anywhere, which is exactly why the publishing decision trips people up. Every channel accepts the same build, so the choice is never technical. It is about who owns the audience, who owns the money, and who owns the URL. Here is how the three channels actually compare once you have shipped to all of them. The Three Channels Game portals aggregate thousands of titles, monetize with ads, and share revenue. Indie platforms like itch.io act as storefronts you control, with community feedback attached. Self-hosting on your own domain gives you everything except an audience. Most developers who do this well use more than one at the same time. The marginal cost of adding a channel is usually just reading the submission guidelines and wiring up an SDK, so treating them as either/or leaves reach on the table for no reason. What Portals Actually Require CrazyGames reaches over 20 million monthly players and runs a two stage process. Basic Launch takes your game with minimal integration and tests it with a limited audience for around two weeks. Hit their engagement benchmarks and you are invited to Full Launch, which needs the full SDK for ads, auth, cloud saves, and analytics. Their technical bar for Basic Launch is an initial download under 50 MB, fewer than 1,500 files, and PEGI 12 content. Poki is curated and editorially reviewed, leans mobile-responsive, and pulls strong search traffic with a younger audience. GameDistribution syndicates across hundreds of publisher sites through an embed widget, so you get reach but little brand visibility. Newgrounds still rewards experimental work with a community that engages rather than an SDK that monetizes. The trade in all four cases is the same: the portal brings the players, and in return it owns the player relationship and can change terms whenever it wants. Self-Hosting With
Optimizing Large-Scale MongoDB Aggregation Pipelines for Performance
Originally published on tamiz.pro . MongoDB aggregation pipelines are powerful tools for processing and transforming data directly within the database. However, when dealing with large datasets, poorly optimized pipelines can become a significant performance bottleneck. This deep-dive explores advanced strategies and best practices to ensure your large-scale MongoDB aggregation pipelines run efficiently and effectively, transforming raw data into actionable insights without grinding your system to a halt. Table of Contents Understanding the Aggregation Pipeline Lifecycle The Critical Role of Indexing Indexes for $match and $sort Stages Compound Indexes and Covered Queries Partial Indexes for Specific Workloads Strategic Stage Ordering Pushing $match and $project Early Leveraging $sort and $limit Together Memory Management and Disk Spills allowDiskUse and its Implications Strategies to Minimize Disk Spills Leveraging the Query Optimizer and Explain Plan db.collection.explain() Interpreting Explain Plan Output Sharding Considerations for Aggregations Shard Key Design for Aggregation Workloads Targeted vs. Broadcast Aggregations Advanced Optimization Techniques Using $lookup for Joins and its Performance Impact Optimizing $group Stages Batching and Incremental Aggregations Production Best Practices Frequently Asked Questions Understanding the Aggregation Pipeline Lifecycle Before diving into optimizations, it's crucial to understand how MongoDB processes aggregation pipelines. An aggregation pipeline is a sequence of stages that process documents from a collection. Each stage performs an operation on the input documents and outputs a stream of documents to the next stage. This stream-based processing is key to its efficiency, but it also means that the output of one stage directly impacts the performance of subsequent stages. The MongoDB query optimizer attempts to reorder certain stages for efficiency, but it's not omniscient. Your strategic design choices profoundly
🐍 Fixing a `google-genai` Version Mismatch and Verifying the Behavior with pytest [1/3]
Introduction Hello from Japan! 🇯🇵 I am tosane932 , a professional truck driver working in logistics while teaching myself Python. In my previous article, I tested a Docker multi-stage build and measured the actual change in image size. At the end of that article, I said that I would write next about pytest and CI/CD. This article was supposed to be the practical follow-up. However, while preparing for that work, I encountered an unexpected side issue. I only intended to introduce Flask-Migrate. Instead, the pip installation logs revealed that the version of a library in my local development environment had been changed without me noticing. The library was: google-genai From there, I went through the following process: Identify the version mismatch Restore the version that had already been tested locally Update requirements.txt Manually verify the Gemini API functionality Run pytest to check for regressions This article records that process without hiding the inconvenient parts. https://github.com/tosane932/sales_data_app Overview While installing Flask-Migrate, I noticed a mismatch between: The version of google-genai installed in my local development environment The version declared in requirements.txt The local environment had been using: google-genai 2.10.0 However, requirements.txt still specified: google-genai==2.4.0 When I ran: pip install -r requirements.txt pip followed the configuration file and replaced the newer local version with the older declared version. This article explains how I discovered the issue, synchronized the environments, and verified the application behavior with automated tests. 1. The Problem and Its Background I was preparing to introduce Flask-Migrate. During that work, I ran: pip install -r requirements.txt The installation log contained the following lines: Attempting uninstall: google-genai Found existing installation: google-genai 2.10.0 Uninstalling google-genai-2.10.0: That message caught my attention. After checking the environ