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

标签:#ai

找到 4360 篇相关文章

AI 资讯

Neural Networks with PyTorch and Lightning AI Part 3: Moving Training Logic into Lightning

In the previous series, when we optimized our neural network, we had to write quite a bit of training code ourselves. First, we created an optimizer object that used Stochastic Gradient Descent (SGD) to optimize final_bias . Then we wrote loops to calculate the derivatives required for gradient descent. We trained the model for up to 100 epochs . For each training example, we: Ran the input through the neural network to get a prediction. Calculated the loss. Calculated the derivatives of the loss function. After processing all three training points, we used: optimizer . step () to take a small step toward a better value for final_bias . Then we used: optimizer . zero_grad () to clear the accumulated gradients before starting the next epoch. All of this required a considerable amount of training code. Let's see how Lightning helps simplify this process. Organizing Training Logic with Lightning Previously, we created a class to store the weights, biases, and the forward() function. The optimization-related code was written separately outside the class. With Lightning, we can keep all of this logic in one place. We start by creating the class as usual, and then add a few new methods. Configuring the Optimizer The first method is configure_optimizers() . def configure_optimizers ( self ): return SGD ( self . parameters (), lr = self . learning_rate ) This method tells Lightning how the neural network should be optimized. The learning rate is stored in the self.learning_rate variable that we defined earlier. Defining a Training Step Next, we add a method called training_step() . def training_step ( self , batch , batch_idx ): input_i , label_i = batch output_i = self . forward ( input_i ) loss = ( output_i - label_i ) ** 2 return loss This method receives: A batch of training data from the DataLoader. The index of that batch. Inside the method, we: Extract the input and label from the batch. Run the input through the neural network. Calculate the loss using the squared r

2026-06-18 原文 →
AI 资讯

Anthropic got hit by export rules nobody understands

Anthropic has spent much of this week fighting to get its newest AI models back online after the Trump administration abruptly ordered the company to cut access for all foreign nationals, including users inside the US and its own employees, forcing Anthropic to block access to Fable 5 and Mythos 5 for everyone. "To my […]

2026-06-18 原文 →
AI 资讯

Spec-Driven Development: Let the Spec Drive the Code (With a Real Example)

By Sergio Colque Ponce — Software Engineering, Universidad Privada de Tacna. Full source code: github.com/srg-cp/spec-driven-development If you have used an AI coding agent — Copilot, Claude Code, Gemini CLI — you have probably lived this moment: you describe a feature, the agent produces code that compiles and looks right, and then it quietly does the wrong thing. The agent is not weak; the input was ambiguous. We have been treating coding agents like search engines when they behave more like very literal pair programmers. Spec-Driven Development (SDD) is the answer to that problem: instead of jumping straight to code, you write down what you want and why , refine it, and only then let the implementation follow. The specification — not the code — becomes the center of the project. What Spec-Driven Development actually is The idea is old (anyone who has written a Product Requirements Document will recognize it), but it has become practical again thanks to tools like GitHub's open-source Spec Kit . Spec Kit organizes the work into a small set of Markdown artifacts, each feeding the next: Constitution — the non-negotiable principles of the project (security rules, coding standards, architectural constraints). Spec — what you are building and why , with no implementation detail. Plan — the technical blueprint derived from the spec (stack, structure, decisions). Tasks — the plan broken into small, ordered, verifiable steps. Implement — the agent (or you) builds the tasks, with the previous artifacts as structured context. The workflow is usually summarized as Spec → Plan → Tasks → Implement , and the same process is meant to work regardless of language, framework, or which of the 30+ supported agents you use. The real shift is not "more documents." It is this: when requirements change, you update the spec, regenerate the plan, and let the implementation follow — instead of patching code and hoping the intent survives. The spec is a living artifact, not a dusty Word file

2026-06-18 原文 →
AI 资讯

42/60 Days System Design Questions

Your AI agent remembered the user's name. Then it forgot what it was doing. Here's the setup: User asks the agent: book the cheapest flight to NYC, search hotels under $150/night, then compare total trip cost. By step 3, the agent calls the LLM with 8,000 tokens of raw conversation history — and still answers as if it's turn 1. You need a memory architecture before this ships. Which one do you pick? A) In-context window only — full conversation stays in the system prompt. Simple. Breaks at ~15 turns or 8K tokens, whichever comes first. B) Vector memory store — embed past turns, retrieve the top-k by semantic similarity at query time. Works great until "NYC flight" pulls a memory about a past NYC trip instead of the current task. C) Episodic memory with summarization — compress old turns into structured event summaries, inject the relevant ones per request. More complex to build. Much harder to confuse. D) Redis session state — structured key-value store, explicit agent reads/writes. Deterministic. Requires the agent to know what to store and when. One of these collapses past 15 turns. One retrieves the wrong context at exactly the wrong moment. One is the right answer for task-oriented agents. Pick A, B, C, or D — and tell me where you've hit this in production. Full breakdown in the comments.

2026-06-18 原文 →
AI 资讯

I Run a Self-Improvement Loop on My OpenClaw Agent Every Night. Here's What I Learned.

Last month my OpenClaw agent kept making the same mistake: it would run a health check, the script would fail silently, and the agent would report "all systems operational" with total confidence. It wasn't broken. It was just doing what it was built to do — execute tasks — without any mechanism to learn from the outcome. So I built it a self-improvement loop. Every night at 2 AM, an isolated OpenClaw session wakes up, reads the previous day's execution logs, identifies patterns in what went wrong, and updates the agent's memory files. No human in the loop. No re-deployment. Just... learning. Here's what I built, what broke, and what actually works. Why Self-Improvement Is Hard for Personal Agents Enterprise AI labs solve this with massive infrastructure: reinforcement learning pipelines, full fine-tuning jobs, A/B testing frameworks that run for weeks. For a personal agent running on a cron job, that's not an option. The self-improvement loop for a personal OpenClaw setup has to be lightweight. It has to run in seconds, not hours. It has to write to plain text files that the next session will actually read. And critically, it has to avoid the feedback loop problem — an agent that rewrites its own improvement logic can spiral into nonsense if there's no anchor. The key architectural decision I made: separate the executor from the critic . Your main agent runs tasks. A separate isolated session reviews what happened and recommends changes. The main agent applies them on the next run. No single session is both judge and executioner. The Nightly Cron: What Actually Runs This is the cron I have running at 2 AM ET every morning: { "name" : "nightly-self-improvement" , "schedule" : { "kind" : "cron" , "expr" : "0 2 * * *" , "tz" : "America/New_York" }, "sessionTarget" : "isolated" , "payload" : { "kind" : "agentTurn" , "message" : "Review the last 24 hours of OpenClaw execution. Read memory/$(date +%Y-%m-%d).md and memory/yesterday.md. Identify 3 patterns where the agent u

2026-06-18 原文 →
AI 资讯

Two-thirds of Americans think AI is advancing too quickly

According to the latest Pew Research poll, 49 percent of Americans report using chatbots at least occasionally, but 63 percent think the tech is advancing too quickly. Overall, use of AI chatbots has increased dramatically since 2024, when only 33 percent reported using them. Specifically, ChatGPT's usage has doubled since 2023, with 44 percent of […]

2026-06-18 原文 →
AI 资讯

Vibe-decoding the White House-Anthropic fight over Fable

Hello and welcome to Regulator, an email for Verge subscribers about technology, politics, and what happens when science crashes headlong into self-interest. Not a subscriber? Sign up here today! Got the scoop on a petty feud that's going to somehow fundamentally reshape the entire field of frontier AI development? Send 'em over to tina.nguyen+tips@theverge.com. Back […]

2026-06-18 原文 →
AI 资讯

Can anyone look cool wearing Snap’s $2,000 glasses?

Yesterday, Snap debuted its new $2,195 Specs glasses. In an interview with CNBC, Snap CEO Evan Spiegel described the Specs as something the company had been working on for more than 12 years, an attempt to "bring computing into the world" and "make it more human." He positioned them as a device to help people […]

2026-06-18 原文 →
AI 资讯

Rate Limiting and Circuit Breakers in Distributed AI Systems

Rate Limiting and Circuit Breakers in Distributed AI Systems Distributed AI systems are inherently complex, handling massive volumes of requests, variable latency from model inference, and dependencies on external services like GPU clusters, databases, or third-party APIs. Without proper safeguards, a single misbehaving component or a sudden traffic surge can cascade into system-wide failure. Two fundamental patterns— rate limiting and circuit breakers —provide essential protection. This post explores their roles, implementation strategies, and practical Python examples tailored for AI workloads. Why Distributed AI Systems Need These Patterns Consider a typical AI pipeline: a user sends a prompt, which hits a load balancer, then an API gateway, then an inference service (e.g., a large language model), which may call a vector database or a fine-tuning API. Each component has capacity limits: GPU inference servers can handle limited concurrent requests. External APIs (e.g., OpenAI, HuggingFace) impose rate limits. Database connections are finite. Without rate limiting, a single abusive client can exhaust resources. Without circuit breakers, a failing downstream service can cause cascading timeouts and resource exhaustion across the entire system. Rate Limiting: Controlling Request Flow Rate limiting restricts how many requests a client, user, or service can make in a given time window. It prevents resource starvation and ensures fair access. Common Algorithms Algorithm Pros Cons Token Bucket Smooth burst handling, easy to implement Memory per bucket Leaky Bucket Constant outflow rate, simple Less flexible for bursts Fixed Window Simple, low overhead Boundary spikes (reset issues) Sliding Window Smoother than fixed, accurate Slightly more complex For AI systems, token bucket is often preferred because it allows short bursts (e.g., a user sending a batch of prompts) while maintaining a long-term average. Python Implementation: Token Bucket Rate Limiter import time impor

2026-06-17 原文 →
AI 资讯

I Can't Tell If You're Selling Me Something

What I actually found when I stopped reading about AI and started running my own experiments. Everywhere you turn right now, someone is telling you how AI is going to transform your workflow, your team, your organization, your life. The content is relentless, and it is almost universally positive. Glowing. Evangelical, even. I'm not here to tell you that's all a lie. I genuinely don't know. That's kind of the problem. We live in a media environment where the line between advertising and information has been blurring for years, and AI is accelerating that blur in ways I don't think we've fully reckoned with. When I read a breathless LinkedIn post about how some engineering leader 10x'd their team's output with AI coding agents, I find myself asking: is this a real person sharing a real experience? Is it a paid placement? Is it content generated by the very tools being promoted? I have no way to tell. Neither do you. And it's getting worse, not better. The most qualified people to evaluate these tools honestly, the ones with enough experience to have real judgment, are also the busiest. They don't have time to write takes. Which leaves a lot of space for everyone else: the shiny-object adopters who are genuinely excited, the vendors with obvious incentives, and an increasingly murky middle ground of content that looks like an opinion but might be something else entirely. The financial relationship between a writer and the tools they're praising is almost never disclosed. And now the tools themselves can generate content praising the tools. Think about that for a second. I'm not making accusations. I'm describing a problem that I think we have a collective responsibility to sit with rather than just nodding along. The appropriate response to an information environment you can't fully trust isn't paralysis. It's going and finding out for yourself. So that's what I did. Why I finally got off the fence I've been watching this space with skepticism for a while. Being a cyn

2026-06-17 原文 →