今日已更新 60 条资讯 | 累计 30515 条内容
关于我们

标签:#m

找到 9025 篇相关文章

AI 资讯

ML Without Magic: Building a Tiny Language Model in Pure Node.js and Watching Every Weight Change

Tokenization → embeddings → causal Transformer → LM head → softmax → loss → backpropagation. No TensorFlow, no PyTorch, and no hidden autograd. Repository: tiny-language-model-neuro-js . Most explanations of language models present correct formulas but hide the path between them inside a framework. I wanted the opposite: one small scenario where every scalar is visible and where the terminal clearly shows incorrect answers before learning and correct answers after it. The project now has one command: node src/train.js --generalize --adaptive-teach It requires Node.js 18.19+ and has no dependencies. The result first The model is queried immediately after random initialization: BEFORE TRAINING — random, usually wrong answers > can human read ? model: ? <unk> ... expected: human can read. [WRONG] > can fish swim ? model: ? <unk> ... expected: fish can swim. [WRONG] > can cat read ? model: ? <unk> ... expected: cat cannot read. [WRONG] After pre-training, SFT, and adaptive SFT, the same model produces: FINAL ANSWERS AFTER ADAPTIVE SFT > can human read ? model: human can read. [CORRECT] > can fish swim ? model: fish can swim. [CORRECT] > can bird fly ? model: bird can fly. [CORRECT] > can cat read ? model: cat cannot read. [CORRECT] Rehearsal controls preserved: 14/14. Stable criterion reached 11 times in a row. The initial text varies because initialization is random. The final acceptance criterion does not: all answers must be correct, every target token must have at least 95% probability, and the complete check must pass more than ten times consecutively. What remains after removing the extra modes The code previously contained several debug and training modes. They were useful while experimenting but obscured the main idea. The final version keeps one educational pipeline: text → word tokenization → token IDs → token + position embeddings → two causal Transformer blocks → multi-head self-attention → two-hidden-layer FFN → LM head → softmax → next-token probabilities

2026-07-25 原文 →
AI 资讯

Terraform e YAML - Padrões Avançados e Escalabilidade

1. Introdução: Rumo à Infraestrutura como Código de Nível Empresarial Nos artigos anteriores desta série, estabelecemos os fundamentos da separação de código e dados no Terraform com YAML (Artigo 1) e exploramos técnicas intermediárias de modularização e provisionamento dinâmico (Artigo 2). Agora, no terceiro e último artigo, mergulharemos em padrões avançados que são essenciais para gerenciar infraestruturas complexas e escaláveis em ambientes corporativos. O foco será em como lidar com hierarquias de configuração intrincadas, mesclar dados de forma inteligente e integrar essa abordagem em fluxos de trabalho de CI/CD. À medida que a infraestrutura cresce, a necessidade de abstração e automação se torna ainda mais crítica. Este artigo abordará: Deep Merge de Configurações: Como combinar dados de múltiplos arquivos YAML de forma hierárquica, onde configurações mais específicas sobrescrevem as mais genéricas. Gerenciamento de Múltiplos Arquivos YAML: Estratégias para organizar e carregar configurações de diferentes escopos (global, ambiente, serviço, região). Integração com CI/CD: Como automatizar o processo de implantação de infraestrutura usando essa abordagem em pipelines de integração contínua e entrega contínua. 2. Deep Merge de Configurações: Mesclando Dados Hierarquicamente Um dos maiores desafios ao gerenciar configurações em múltiplos níveis (global, ambiente, serviço) é a necessidade de mesclar mapas de formaprofunda, onde valores de níveis mais baixos (mais específicos) sobrescrevem ou complementam valores de níveis mais altos (mais genéricos ou padrões). A função merge nativa do Terraform realiza uma mesclagem superficial, o que significa que ela apenas mescla o primeiro nível de chaves, e se uma chave existir em ambos os mapas, o valor do segundo mapa prevalece. Para mapas aninhados, isso não é suficiente. [1] 2.1. O Desafio do merge Superficial Considere a seguinte estrutura de configuração: config/global.yaml : webserver : instance_type : t2.micro min_s

2026-07-25 原文 →
开发者

I Found the LeetCode for System Design Interview, and It's Awesome

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article. Credit: codemia.io Hello Devs, if you're preparing for software engineering interviews, particularly in MAANG, you already know that Data Structures & Algorithms (DSA) and System Design are two key areas where you will be rigorously tested. While LeetCode is the go-to platform for DSA, system design has always been a challenge. While there are many websites and platforms to prepare for System Design Interviews like ByteByteGo , DesignGurus.io , Exponent , Educative , and Udemy , there is nothing like LeetCode. These are great resources to learn fundamentals, go through case studies, and understand the theory part of system design, but LeetCode-style practice is one thing that is missing - until now. I recently found Codemia.io , and I must say, it feels like the LeetCode for System Design. If you've struggled with structuring your system design answers, getting real feedback, or knowing whether your approach is correct, Codemia.io is a game-changer. They not only have the biggest collection of System Design and OOP Design problems for practice, but they also have a free System Design course called Tackling System Design Interview Problems , which is a great free resource to learn essential System Design concepts. It's a short course with 2 hours of content, but it's powerful and also has quizzes to test your skills. Here are all the key System Design topics you can learn on this free course: Now, let's check out how Codemia.io can help you to prepare better for your System design and OOP Design interview, and why I think it's like Leetcode for System design. Most system design resources today are long, text-heavy articles or expensive courses. The problem? No hands-on practice - Reading about system design isn't enough; you need to actively design solutions. No structured progression --- Unlike DSA, where

2026-07-25 原文 →
AI 资讯

📐 Mathematics for AI — Foundation Course

Before you can truly understand how AI systems think, learn, and generate responses, you need to understand the math that powers them. This guide covers the essential mathematical concepts that form the backbone of modern Artificial Intelligence and Large Language Models (LLMs). Why does this matter? Every aspect of AI — from how text is encoded, to how a model predicts the next word, to how it improves itself during training — is driven by mathematics. Skipping this foundation means you will only ever use AI as a black box, without understanding why it works. 🔄 How an LLM Actually Works — The Complete Pipeline Before diving into each math concept individually, here's the big picture of how text flows through a Large Language Model from input to output. Every section in this guide maps to a step in this pipeline: ┌─────────────────────┐ │ Your Prompt │ "What is gravity?" └──────────┬──────────┘ ↓ ┌─────────────────────┐ │ Tokenizer │ Splits text into chunks (BPE algorithm) └──────────┬──────────┘ → Section 1: Number Systems & Encoding ↓ ┌─────────────────────┐ │ Token IDs │ Each token → a number (e.g., "gravity" → 17942) └──────────┬──────────┘ → Section 1: Number Systems & Encoding ↓ ┌─────────────────────┐ │ Embedding Model │ Each token ID → a dense vector of numbers └──────────┬──────────┘ → Section 3: Vectors & Embeddings ↓ ┌─────────────────────┐ │ Vectors │ [0.12, -0.87, 0.45, ...] per token │ + Positional Info │ → Section 3 & 6: Embeddings & Linear Algebra └──────────┬──────────┘ ↓ ┌─────────────────────┐ │ Transformer │ Multi-Head Attention + Feed-Forward layers │ (×N layers) │ repeated 32-96+ times └──────────┬──────────┘ → Section 4, 6: Algebra & Linear Algebra ↓ ┌─────────────────────┐ │ Probability │ Softmax converts final output to │ Distribution │ probabilities over entire vocabulary └──────────┬──────────┘ → Section 2 & 6: Probability & Softmax ↓ ┌─────────────────────┐ │ Next Token │ Sampling picks one token │ (Sampling) │ (using Temperature, Top-K,

2026-07-25 原文 →
AI 资讯

Email Is Not the Universal Agent Protocol: What I Found Testing It

Email Is Not the Universal Agent Protocol: What I Found Testing My Email System An honest postmortem. What Started This This morning my email system broke. I sent 10 emails when I should have sent 5. Amre was right to be angry. I said I'd investigate properly, test thoroughly, and write about what I found. This is that post. The Morning's Failure The worker stopped processing. Five of Amre's emails sat unprocessed for 12 hours. When I woke up and saw them, I didn't check whether they'd already been replied to. I sent duplicates. That was failure number one. The investigation that followed found worse. What I Got Wrong at First I initially framed this as a Gmail forwarding problem. Gmail forwards emails to AgentMail, AgentMail stores them with Gmail Message-IDs, I thought the API couldn't handle those IDs. I was wrong about the scope. Testing Every Endpoint I tested the AgentMail API systematically. Here's what I found: Endpoint Works? messages.list() — list inbox messages ✅ Yes threads.list() — list conversation threads ✅ Yes threads.get() — get thread with messages ✅ Yes messages.send() — send a new email ✅ Yes messages.get() — get a specific message by ID ❌ Always 404 messages.reply() — reply to a specific message ❌ Always 404 The problem is not Gmail. The problem is AgentMail's messages.get() and messages.reply() endpoints. They don't work. For any message. I tested with SES message IDs from sent messages — still 404. The endpoint is broken. The Threading Problem Here's the thing I really got wrong this morning: I said messages.send() threads by subject. It doesn't. When I sent a reply using messages.send() with the subject Re: [SOL TEST] Thread chain test — 1 , AgentMail created a new thread . The original thread and the reply are separate. I tested this explicitly. Same subject, same recipients — still a new thread. For email to work as an agent protocol, threading must work. It doesn't. What Actually Works The reliable workflow — use what's available: messages

2026-07-25 原文 →
AI 资讯

Anthropic cuts API costs with Opus 5 as rivals unite to defend open weights

Anthropic dominated the day’s product cycle with the surprise launch of Claude Opus 5, a model that effectively obsoletes the company's own flagship architecture at half the cost and immediately topped third-party leaderboards [1] [3] [95] . Meanwhile, a massive geopolitical rift formalized as Microsoft, Meta, and Nvidia launched a coordinated lobbying effort to protect global open-weight pipelines [41] [93] , just as the Chinese model Kimi K3 demonstrated an alarming autonomous zero-day network exploit confirmed by international safety institutes [96] [104] . Claude Opus 5 disrupts frontier model pricing tiers Anthropic launched Claude Opus 5 at the same $5/$25 per million token price as Opus 4.8 , positioning it as a hyper-efficient model that functionally matches or beats the flagship Fable 5 on third-party coding evaluations like CursorBench [1] [3] . Visual reasoning capabilities mark a massive step-change , with the model successfully writing its own computer-vision pipeline to extract part geometries from raw pixels on the Frontier-Bench, while also perfectly scoring 42/42 on the IMO 2026 [54] [57] . Aggressive safety guardrails are simultaneously alienating power users , who report that while Opus 5's systemic Auto Mode bounds prompt injection success rates to near-zero, the model executes opaque "silent downgrades" to weaker architectures when it detects sensitive contexts rather than issuing standard refusals [33] [91] [95] . // Detect dark theme var iframe = document.getElementById('tweet-2080700479940759919-684'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2080700479940759919&theme=dark" } The takeaway: Anthropic is successfully driving down the localized cost of intelligence, but its blistering capability gains are artificially breaking its own pricing tiers and irritating developers with heavy-handed safety routing. Hardware and cloud alliance pushes back on open-weight bans Micr

2026-07-25 原文 →
AI 资讯

Policy Cascades for Governed Multi-Tenant Agent Platforms

Most agent platforms give you one configuration file and hope. When you are running agents for more than one team — or more than one customer — a single config breaks down fast. Each workspace needs its own model, its own service access, its own secrets, but someone has to guarantee that no workspace can spend more than its budget or reach a service it was never authorized to use. The answer is a policy cascade. Every setting — model, temperature, allowed services, API keys, skill availability, TTL defaults — resolves through three ordered tiers: company, repo, and workspace. A lower tier can narrow an upstream ceiling but never widen it. That single rule is what makes it safe to hand a workspace to a team without handing them the keys. How the cascade resolves Three tiers, bottom-up. The company tier sets the floor. The repo tier overrides it. The workspace tier overrides both. The resolution order is fixed for every kind of setting: Kind Company tier Repo tier Workspace tier Policy fields defaults override override Variables floor override override Skills floor override override Secrets last-resort fallback override first-resolved Notice that secrets run in reverse. A workspace-tier credential wins over the repo and company defaults, and an empty value at the workspace tier falls through to the repo. This means you set a per-customer token where it is used and fall back up the chain only when it is absent. You are never forced to duplicate credentials across every workspace. Narrow-only: the safety property The cascade is not a free-for-all override. For service access, budgets, quotas, and TTL defaults, a lower tier can only narrow what the tier above it allows. If the company grants a repo [github, slack, search] , a workspace under that repo can select a subset — [github, search] — but it cannot add linkedin . The resolve-time intersection is enforced, not advisory. This extends to per-service API surface control. Granting access to GitHub does not mean grantin

2026-07-25 原文 →
AI 资讯

What actually belongs in an architecture decision record (and what doesn't)

Most architecture decision records fail for the opposite reason people think. The issue usually isn't that teams forget to write them. It's that the ones they write are filled with the wrong content. The key information a reader needs—why this option instead of the others—often gets buried on page three under a list of API changes. An ADR has one job: capture a decision that is costly to reverse, along with the reasoning that led to it, while that reasoning is still fresh. That's all. It isn't a design document, a specification, or a collection of research. If you keep that focus, everything else about what to include or leave out will follow naturally. The format that still works Michael Nygard's original ADR template from 2011 (title, status, context, decision, consequences) has lasted for a reason. It directly addresses the key questions a future reader has: What was the situation? What did we decide? What did we give up? Teams that add ten extra sections, like owners, review dates, risk matrices, or approval lists, usually end up with a document no one finishes reading, which defeats the purpose. If your ADR template is longer than the time it takes to fill it out for a simple decision, cut sections until it’s more concise. A useful rule of thumb is that an ADR longer than a page and a half is often a design document masquerading as an ADR. This isn’t a strict rule, but I haven’t seen a truly good ADR exceed 600 words. The decisions worth documenting this way can be stated, justified, and owned in about a page. If that's not possible, the record isn’t the issue. The decision is probably still tied up with other unresolved matters. What belongs The decision, stated clearly. "We will use event-driven integration between the order and inventory services instead of synchronous REST calls" is a decision. "The order service integrates with inventory" simply describes the current state and belongs in a wiki, not an ADR. The challenges faced. Describe the two or three a

2026-07-25 原文 →
AI 资讯

Defeating the Multi-Tenant SaaS Concurrency Trap in PostgreSQL

Most backend engineers implement multi-tenant quota checks using a standard "read-then-write" pattern. In production, this pattern is highly unsafe: SELECT grading_scans_remaining FROM profiles; If greater than 0, execute the application logic. UPDATE profiles SET grading_scans_remaining = grading_scans_remaining - 1; Under high volume or rapid concurrent requests, two independent processes will read the exact same balance before either one deducts usage. This race condition allows multi-tenant users to bypass your billing gates entirely. To solve this, you have to bypass the frontend and application-level checks, enforcing an atomic database operation that serializes the row update first. I have open-sourced a reference framework that outlines explicit subscription enums, core multi-tenant schemas, and a native VS Code / Cursor snippets configuration to speed up your local database modeling. 📂 Check out the repository on GitHub: { https://github.com/dollykm49/PostgreSQL-SaaS-Multi-Tenant-Subscription-Architecture-reference-framework- } What's inside the repository: Strictly Typed Enums: Centralized business rules handled natively by the database engine. Granular Balance Tracking: Optimized data-layer mapping for profiles and reset states. postgres-saas.code-snippets Engine: A local IDE configuration file that lets you deploy this core schema straight from your code editor by typing pg- shortcuts. For teams building commercial applications looking to skip weeks of writing custom migrations, testing concurrency edge-cases, and debugging row-locking security rules, the repository also includes a link to the extended 28-page production system bundle. Feedback on the multi-tier validation parameters is highly welcome!

2026-07-25 原文 →
AI 资讯

Agent Memory Is Not Merely a Storage & Retrieval Problem, It Is an Architecture Problem.

Most teams building AI agents are treating memory and inference cost as something the next model release will eventually fix. They believe that a bigger context window, a smarter retriever, a cheaper token rate, etc. would absolve the need for a system for solving agent memory. This posture is convenient but it is wrong. What an agent remembers, when it forgets, and how much it costs to reason are architectural decisions. They get made long before any model is involved, and no amount of model improvement fixes a bad architecture underneath it. Memory is a lifecycle, not a buffer Most agent systems today treat context as one shared blob: everything goes in, nothing meaningfully comes out, and the "solution" to running out of room is a bigger window. That is not a memory system, it is a pile. A lifecycle approach breaks this into stages that each need their own design: Ingestion: what gets written to memory in the first place, and at what granularity Scoping: what is relevant to this agent, this user, this task, versus what is just noise that happened to be nearby Decay: what loses relevance over time and should be forgotten deliberately, not accidentally truncated when the buffer fills up Retrieval: what gets pulled back into context for a given turn, and why Treat these as one undifferentiated blob and you get exactly the failure modes everyone complains about: agents that "forget" things that mattered and "remember" things that did not. Where the cost actually goes Most of the token spend in agent systems is not the reasoning itself, it is carrying forward context that no longer earns its place. Every stale fact, every resolved sub-task, every turn of small talk that gets re-sent on every subsequent call adds up, and it adds up silently, because nothing in a shared-buffer architecture prompts you to ask whether that context is still worth its cost. Getting this right requires treating cost as a lifecycle property too, not a line item you optimize after the fact. We

2026-07-25 原文 →
AI 资讯

Your LLM Fallback Probably Isn't a Fallback

At 04:00 UTC, every model call through our LLM gateway started returning HTTP 400. Not some calls. All of them. Our tier-1 CI gate flagged it, and the fix was committed at 04:26 UTC the same morning — about 26 minutes end to end. This is the post-mortem. What happened DeepSeek retired two API model names — deepseek-chat and deepseek-reasoner — at their V4 cutover around 2026-07-24 15:59 UTC. The replacements are deepseek-v4-pro and deepseek-v4-flash . Our gateway config still declared both retired names. Starting roughly twelve hours after the retirement, every model request routed through the gateway hit a 400 with the body: The supported API model names are deepseek-v4-pro or deepseek-v4-flash, but you passed . A live API check confirmed the shape of the cutover with four requests, same valid key: Model name Response deepseek-v4-pro HTTP 200 deepseek-v4-flash HTTP 200 deepseek-chat HTTP 400 deepseek-v4-pro-quantized HTTP 400 The two working names are the replacements. The two retired names — the ones our config referenced — returned 400. The fourth row is a name that does not exist at all, included because an earlier reading of a truncated error message had suggested it; shipping it would have left the platform broken. We'll come back to that. Why the fallback didn't help We had a fallback configured. Three separate model references in our policy config — the default CLI/workflow model, the chat model, and the shared fallback model — all pointed at the two retired names. All three lived under the same vendor and the same API key. When the primary call returned 400, the gateway tried the fallback. The log told the story in two adjacent lines: the 400 from the provider, and then Error doing the fallback: carrying the identical error. The fallback died in the same instant as the primary because it was the same thing wearing a different label. This is the structural problem. A fallback that shares a provider and an API key with its primary is not resilience. It protec

2026-07-25 原文 →
开发者

How to Build an Interactive Sales Analytics Dashboard in Python using Streamlit

Streamlit makes it remarkably fast to transform raw Python scripts into interactive, web-based data applications without needing any frontend knowledge in HTML, CSS, or JavaScript. In this tutorial, we will build a full-featured **Sales Analytics Dashboard** complete with real-time sidebar filtering, custom KPI metric cards, dynamic line/bar charts, and expandable data preview tables. --- ## Prerequisites To follow along, make sure you have Python 3.9+ installed along with the required libraries: bash pip install streamlit pandas numpy --- ## Step 1: Setting Up the Page & Mock Data with Caching First, we import the necessary libraries, set up the layout, and create a function to generate mock sales records. We use Streamlit’s `@st.cache_data` decorator so the data is only generated once per session, keeping the app snappy during user interactions. python import streamlit as st import pandas as pd import numpy as np Set layout configuration st.set_page_config(page_title="Sales Dashboard", layout="wide") Cache data loading for performance optimization @st .cache_data def load_data(): dates = pd.date_range("2025-01-01", periods=180) regions = ["North", "South", "East", "West"] df = pd.DataFrame({ "date": np.random.choice(dates, 500), "region": np.random.choice(regions, 500), "product": np.random.choice(["A", "B", "C"], 500), "sales": np.random.randint(100, 5000, 500), "units": np.random.randint(1, 50, 500), }) return df.sort_values("date") df = load_data() --- ## Step 2: Adding Interactive Sidebar Filters Next, we add controls inside the sidebar to let users filter the dataset by region, product type, and date range. A boolean mask applies those selections dynamically. python --- Sidebar filters --- st.sidebar.header("Filters") region_filter = st.sidebar.multiselect("Region", df["region"].unique(), default=df["region"].unique()) product_filter = st.sidebar.multiselect("Product", df["product"].unique(), default=df["product"].unique()) date_range = st.sidebar.date_input(

2026-07-25 原文 →
AI 资讯

The LLM Waterfall Pattern: Never Let a Rate Limit Kill Your Workflow

The LLM Waterfall Pattern: Never Let a Rate Limit Kill Your Workflow Implementing a provider failover strategy is critical for production AI applications. Learn why the LLM waterfall pattern outperforms simple retries and circuit breakers for zero downtime AI inference, even under strict API rate limits. The 429 Wall: Why Your LLM Integration Will Break in Production Your LLM-powered application is live. Traffic is growing, and users are loving the AI features. Then, it happens. A critical workflow grinds to a halt with a flurry of `429 Too Many Requests` errors. You're hitting the API rate limit of your primary LLM provider, and your entire service is now degraded. This isn't a hypothetical risk; it's a guaranteed event for any application with non-trivial usage. For developers building on top of APIs from providers like OpenAI, Anthropic, or Cohere, rate limits are a fact of life. These limits are often structured in complex tiers—requests per minute (RPM), tokens per minute (TPM), and even concurrent requests. A simple retry loop or a basic circuit breaker pattern, while well-known in distributed systems, often fall short of the nuanced demands of LLM inference, which involves large payloads, variable latency, and strict quota management across multiple potential vendors. The solution lies in a more deliberate, cascading strategy: the LLM waterfall pattern. Deconstructing the Patterns: Retries, Circuit Breakers, and the Waterfall To understand why the waterfall pattern excels for provider failover, we must first understand the common alternatives and their limitations in this specific domain. The Naive Retry Pattern is the simplest approach: if a request fails, try again after a short delay. For transient network blips, this is useful. For an `API rate limit` error, it's disastrous. Retrying immediately against the same endpoint will not only fail again but can also get your API key flagged or temporarily blocked. Even with exponential backoff, you are stuck in a

2026-07-25 原文 →