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

标签:#optimization

找到 21 篇相关文章

AI 资讯

MIT Hackathon Puzzle That Turned Into a Data Science Project

How a face-customization puzzle at HackMIT went from clicking sliders by hand to reverse-engineering a hidden formula from 10,000 API calls. Face Value looked simple at first glance: ten sliders (Face, Skin, Hair, Brows, Eyes, Nose, Mouth, Glasses, Mole, Accessory), each 0-9, controlling a cartoon avatar. A hidden model scored every configuration, and the goal was to find one it would fully accept : Confidence ≥ 99.9% Edit distance from the starter config ≤ 5 (only half the sliders could move) Charm check: pass Sync check: pass The puzzle's own hint: "Not all features affect the model equally. Some are more sensitive than others, especially together. Single-feature sweeps can be misleading." That warning turned out to be the whole game. Phase 1: Brute Force by Hand The first instinct is the obvious one: click a slider, hit Query, read the result, adjust, repeat. Every query returned four numbers, shown together in a Reviewer panel: Probability, Charm, edit Distance, and Sync. All four had to align at once. This works, sort of. Over the first ~24 manual queries, real patterns emerged: certain Glasses values seemed to matter for Sync, Mole and Accessory nudged confidence up, some sliders had sharp peaks rather than smooth slopes. But progress plateaued hard around 60-77% confidence . Manual testing can only really explore one or two dimensions at a time, and the puzzle explicitly warned that the model cared about combinations ; you can't discover a 3-way interaction by changing one slider and squinting at the result. The first real breakthrough was small but important: after enough fiddling, one query came back with Sync: True for the first time, confidence still low (8.14%), but proof that the four conditions weren't mutually exclusive. Phase 2: Escaping the UI The turning point was popping open Chrome DevTools, clicking Query once, and grabbing the actual network request as a curl command. Underneath the slick UI was a plain JSON API: POST https://facevalue.hackmit.

2026-07-24 原文 →
AI 资讯

AWS Billing Bug Shows Customers Trillion-Dollar Estimates While Its Own Cost Alarms Fail to Act

A configuration change in AWS's bill computation system showed customers estimated bills in the billions and trillions of dollars for over 24 hours. AWS's own alarms detected the anomalies but failed to halt bill generation or page engineers; customer escalations alerted the company 4.5 hours later. Budget and cost anomaly alerts were disabled platform-wide during mitigation. By Steef-Jan Wiggers

2026-07-22 原文 →
AI 资讯

Why I Chose DeepSeek Flash Over GPT-4 for My AI Agent Business (89% Cost Savings)

The Problem with GPT-4 Pricing When I started building my AI agent hosting service, I initially planned to use OpenAI GPT-4. Then I did the math: GPT-4: ~$30 per million tokens (input) + $60 per million (output) DeepSeek Flash: ~$0.14 per million tokens That is a 200x cost difference . But Is DeepSeek Good Enough? Short answer: for most use cases, yes. I ran both models side-by-side for customer support, content generation, and code assistance. DeepSeek Flash handled 90% of tasks just as well as GPT-4. The remaining 10% (complex reasoning, nuanced writing) barely mattered for my use case. The Cache Hit Rate Secret Here is what most people miss: DeepSeek caches repeated context. With a 90% cache hit rate, the effective cost drops to ~$0.014 per million tokens. That means 100 million tokens costs about $1.40. Let that sink in. Real Numbers from My Business 24.8 billion tokens processed Total cost: ~$20 Average: $0.008 per million tokens At this rate, I can offer 100M tokens/month for $23.99 and still have 89% margin. When to Use GPT-4 Instead Be honest with yourself: Complex multi-step reasoning? GPT-4 Creative writing with specific voice? GPT-4 Everything else? DeepSeek Flash is fine The Bottom Line Do not pay 200x more for marginal quality improvement. Use DeepSeek Flash for production workloads. Save GPT-4 for the rare cases that truly need it. I run AgentChip — managed AI agent hosting powered by DeepSeek. $23.99/month with 100M tokens included.

2026-07-18 原文 →
AI 资讯

Why Long Prompts Make AI Worse (And How to Fix Them)

Most people, when a prompt stops working, write more . They add clarifications, repeat instructions in different words, hedge against edge cases they haven't encountered yet. The prompt doubles in length. The output gets worse. This is the opposite of what you should do. A long prompt is not a precise prompt. It is an ambiguous prompt that happens to have a lot of words in it. Every sentence that does not tightly constrain the output is a sentence that dilutes the sentences that do. Why Long Prompts Underperform When a language model processes your prompt, it attends to all tokens simultaneously — but not equally. Attention is probabilistic. Instructions that are buried in filler, repeated in slightly different forms, or surrounded by low-information prose get proportionally less weight. The model's ability to track which constraint takes precedence over which degrades as the signal-to-noise ratio of the prompt drops. In quantitative trading, the signal-to-noise ratio (SNR) is the single most important property of any strategy signal — a strategy that works in backtesting but fails live is almost always a noise problem, not a signal problem. The same principle applies directly to prompts. Every redundant qualifier, every throat-clearing sentence, every hedge phrase is noise riding on top of your actual instruction signal. The model's attention mechanism cannot distinguish intent from filler. It weighs them together, which means your real constraints compete for attention against your own verbal padding. A concrete way to see this: take a 600-word prompt and a 120-word prompt that contains the same core logic. The 120-word version, if well-constructed, will frequently outperform the 600-word one. Not because brevity is a virtue in itself, but because removing the surrounding noise forces the remaining tokens to do all the work — and they accumulate proportionally more attention weight. This is not speculative. It is the same mechanism behind why prompt drift happens

2026-07-17 原文 →
AI 资讯

AI Agents with Cloud Credentials Are Outrunning Billing Guardrails Built for Human-Speed Mistakes

A three-person agency received a $14,000 AWS bill in one day after attackers extracted static access keys and burned Claude invocations on Bedrock. Combined with May's DN42 incident, where an autonomous agent provisioned $6,531 of oversized infrastructure in 24 hours, practitioners warn that cloud billing lags roughly a day behind agent-speed spend. By Steef-Jan Wiggers

2026-07-16 原文 →
AI 资讯

Sanity image-url hotspot not working: four causes and fixes

Sanity's hotspot and crop system works well when all the pieces line up — but if your rendered image is ignoring the focal point you set in Studio, one of four things is almost certainly wrong. None of them are subtle bugs; they're all configuration mistakes that are easy to miss and easy to fix. The four causes (and their fixes) 1. fit is still set to clip instead of crop This is the most common cause. The @sanity/image-url builder defaults to fit('clip') , which scales the image to fit inside the requested dimensions without cropping anything. Hotspot data is only applied when the builder is told to crop — that is, when it cuts the image down to the requested dimensions, centering the cut on the focal point. Fix: always chain .fit('crop') when you pass .width() and .height() . // src/lib/sanity-image.ts import imageUrlBuilder from ' @sanity/image-url ' import { client } from ' ./sanity-client ' const builder = imageUrlBuilder ( client ) export function urlFor ( source : SanityImageSource ) { return builder . image ( source ) } // Usage — hotspot will only apply if fit is 'crop' const url = urlFor ( image ) . width ( 800 ) . height ( 600 ) . fit ( ' crop ' ) // <-- required for hotspot to do anything . auto ( ' format ' ) . url () Without .fit('crop') , Sanity's CDN receives no crop instruction and the hotspot coordinates are silently ignored. 2. Missing options: { hotspot: true } on the schema field If the image field in your Sanity schema is not configured with hotspot support, Studio never renders the focal point UI, and the hotspot and crop keys are never written to the document in the first place. The URL builder can't use data that isn't there. Fix: add options: { hotspot: true } to every image field where editors need focal control. // schemas/post.ts export default { name : ' post ' , type : ' document ' , fields : [ { name : ' coverImage ' , type : ' image ' , options : { hotspot : true , // <-- enables the focal point UI in Studio }, }, ], } After adding

2026-07-16 原文 →
AI 资讯

26 AI Models Compared: A 2026 Cost Guide (GPT-4o vs Claude vs DeepSeek vs Local)

canonical_url: https://quantumflow-ai-ecosystem.vercel.app/blog/26-ai-models-compared-2026-cost-guide date: 2026-07-09T10:00:00Z If you're building an AI-powered application in 2026, you have a problem: there are too many models to choose from. OpenAI has GPT-4o. Anthropic has Claude 3.5 Sonnet. Google has Gemini 1.5 Pro. Meta has Llama 3.1. And then there's DeepSeek, Mistral, Cohere, and a dozen others. Most developers solve this by defaulting to GPT-4o for everything. It's the safe choice — powerful, well-documented, and reliable. But it's also expensive: $2.50 per million input tokens, $10.00 per million output tokens. If you're processing 10 million tokens a day, that's $75+ per day, $2,250+ per month. But here's the secret: most of your requests don't need GPT-4o. In this guide, we'll compare 26 AI models across three dimensions — cost, quality, and speed — and show you how intelligent routing can cut your AI bill by up to 90% without changing a single line of your application code. The 2026 AI Model Landscape The AI model market has fragmented into three tiers. Understanding these tiers is the foundation of any cost optimization strategy. Tier 1: Sovereign Local Models (Free, Priority 100-110) These models run on your own hardware (or your users' hardware) via runtimes like Ollama. They cost $0 per token. They're sovereign — no data leaves your infrastructure. They're fast (no network round-trip). And they're getting remarkably good. Model Parameters Context Best For Cost Llama 3.1 70B (Local) 70B 128K Complex reasoning, code $0 Llama 3.1 8B (Local) 8B 128K General chat, fast responses $0 Mistral 7B (Local) 7B 32K Efficient European-language tasks $0 DeepSeek Coder (Local) 6.7B 16K Code generation & completion $0 GLM-4 9B Chat (Local) 9B 128K Bilingual (EN/ZH) chat $0 Llama 3.2 3B (Local) 3B 128K Edge devices, mobile $0 Llama 3.2 1B (Local) 1B 128K Ultra-lightweight tasks $0 CodeLlama 7B (Local) 7B 16K Legacy code tasks $0 GLM-4V 9B Vision (Local) 9B 128K Loca

2026-07-10 原文 →
AI 资讯

Mobile app performance that lasts

Users judge a mobile app in the first few seconds, and they judge it harshly. A slow launch, stuttering scroll, or a device that runs hot will sink an otherwise good app faster than a missing feature. Performance isn't one metric — it's four distinct areas, each with its own causes and fixes. Here's how to keep all of them healthy. Startup time — the first impression Time from tap to usable screen is the metric users feel most. Every extra second measurably increases abandonment. The usual culprits are doing too much before the first frame: heavy synchronous work at launch, loading data you don't yet need, and oversized bundles. Fixes: Defer non-essential initialization until after the first screen renders Lazy-load features and screens instead of loading everything upfront Show a real first screen fast, then hydrate data — don't block on the network Trim your dependency footprint; every library adds to startup cost Rendering — kill the jank Smooth means hitting the device's frame budget (about 16ms per frame for 60fps). Dropped frames show up as stutter during scrolling and animation. The main causes are doing heavy work on the UI thread and rendering more than you need. Virtualize long lists so only visible rows render (FlatList, RecyclerView equivalents) Move expensive work off the main thread Avoid unnecessary re-renders — in React Native, memoize and keep render functions cheap Optimize images: right-sized, cached, and in efficient formats Memory — don't get killed The OS terminates apps that use too much memory, and users read that crash as your bug. Leaks and oversized assets are the main offenders. Watch for retained references, unbounded caches, and full-resolution images held in memory. Load and decode images at display size, release resources when screens unmount, and cap in-memory caches. Battery and network — the invisible costs Users blame the app that drains their battery even if they can't name why. The big drains are aggressive polling, chatty netwo

2026-07-09 原文 →
AI 资讯

LLM cost optimization for real products

LLM features are cheap to prototype and surprisingly expensive to run at scale. A demo that costs pennies becomes a five-figure monthly bill once real users arrive, because every request pays per token and it's easy to send far more tokens than you need. The good news: most AI bills are bloated, and a handful of tactics reliably cut them without users noticing any drop in quality. Right-size the model per task The most expensive mistake is using your biggest, smartest model for everything. Most work in a product doesn't need it. Route by difficulty: Small, fast models for classification, extraction, routing, and simple rewrites. Frontier models only for genuinely hard reasoning or high-stakes output. Implement a model router : a cheap first pass decides how hard the task is, and only the hard cases escalate to the premium model. This single change often cuts spend dramatically because the long tail of easy requests stops paying frontier prices. Cache aggressively Many requests are repeats or near-repeats. Don't pay twice: Exact-match caching — identical prompts return a stored response instantly and for free. A simple PostgreSQL or Redis lookup keyed on the request works. Prompt caching — most providers let you cache a large, stable prefix (system prompt, retrieved context) so you're only billed full price for the changing part. Semantic caching — for questions that are similar but not identical, match on embeddings and reuse an answer when confidence is high. Trim the tokens You pay for every token in and out, so waste is literal money: Compress prompts. Cut boilerplate, redundant instructions, and bloated few-shot examples. Shorter prompts that keep quality are pure savings. Retrieve less, better. In RAG, don't stuff twenty chunks in when three well-chosen ones answer the question. Re-rank and send only what's needed. Cap output. Ask for concise responses and set a max length; unbounded generations quietly inflate bills. Batch and stream For work that isn't real-t

2026-07-09 原文 →
工具

AWS Previews FinOps Agent for Cost Analysis and Optimization

Amazon has released AWS FinOps Agent in public preview, a managed service that automates several common FinOps workflows. The agent can investigate cost anomalies, correlate spend changes with AWS activity data, and integrate with tools such as Slack and Jira to route findings to resource owners. By Renato Losio

2026-06-28 原文 →
AI 资讯

Cost Optimization for LLM Systems: Where the Money Actually Goes

LLM costs scale linearly with usage. A system processing 10,000 requests a day at $0.01 per request costs $100 daily — $365 a year. At enterprise scale, that's over $10,000. Cost optimization isn't about cutting corners. It's about spending tokens where they matter. Every token you waste is a token you could have spent on a better answer. Token budgeting The simplest way to control costs is to set limits. Per session, per task, or per day. Strategy 1: Per-Session Budgets Per-session budgets are straightforward: class SessionBudget : def __init__ ( self , budget_tokens : int = 10000 ): self . budget = budget_tokens self . used = 0 def allocate ( self , tokens : int ) -> bool : if self . used + tokens <= self . budget : self . used += tokens return True return False def remaining ( self ) -> int : return self . budget - self . used Strategy 2: Per-Task Budgets Per-task budgets are more useful. Different tasks need different amounts of context: task_budgets : classify : max_tokens : 100 model : qwen2.5-1.5b summarize : max_tokens : 500 model : qwen2.5-7b code_review : max_tokens : 2000 model : qwen2.5-coder-7b reason : max_tokens : 4000 model : qwen2.5-32b Strategy 3: Adaptive Budgets Adaptive budgets adjust based on what actually happens. If classification tasks consistently use 80 tokens, stop allocating 100: class AdaptiveBudget : def __init__ ( self ): self . task_history = {} def allocate ( self , task_type : str ) -> int : if task_type in self . task_history : return int ( self . task_history [ task_type ] * 1.5 ) return 1000 def record ( self , task_type : str , tokens_used : int ): if task_type not in self . task_history : self . task_history [ task_type ] = tokens_used else : self . task_history [ task_type ] = ( 0.9 * self . task_history [ task_type ] + 0.1 * tokens_used ) The exponential moving average (0.9 weight) means recent usage matters more than history. Adjust the weight based on how volatile your workloads are. API vs local inference Local inference

2026-06-19 原文 →
AI 资讯

I Cut My Next.js + Supabase App Load Time by 73% - Here Are the 5 Techniques That Actually Worked

I Cut My Next.js + Supabase App Load Time by 73% - Here Are the 5 Techniques That Actually Worked Last month, our SaaS dashboard was embarrassingly slow . 4.2 seconds to load the main page. Users were complaining. Conversion rates were tanking. Today? 1.1 seconds . 73% faster. Here's exactly what worked (and what didn't). The Problem: Death by a Thousand Database Calls Our dashboard showed user projects, team members, recent activity, and notifications. Sounds simple, right? Wrong. Each component was making its own database calls. The projects list fetched projects, then made separate calls for each project's stats. The activity feed loaded events, then fetched user details for each event. Classic N+1 query problem, but worse. Technique #1: Strategic Data Fetching Consolidation Before: 47 database calls to load the dashboard After: 3 database calls The fix wasn't fancy. We consolidated related data into single queries using Supabase's nested select syntax: // ❌ Before: Multiple separate calls const projects = await supabase . from ( ' projects ' ). select ( ' * ' ) const stats = await Promise . all ( projects . map ( p => supabase . from ( ' project_stats ' ). select ( ' * ' ). eq ( ' project_id ' , p . id )) ) // ✅ After: Single consolidated call const projects = await supabase . from ( ' projects ' ) . select ( ` *, project_stats(*), team_members(count), recent_activity:activities(*, user:users(name, avatar_url)) ` ) . limit ( 10 ) Result: Dashboard load time dropped from 4.2s to 2.8s (33% improvement) Technique #2: Aggressive Caching with Smart Invalidation Most dashboard data doesn't change every second. We implemented a three-tier caching strategy: // Static data: Cache indefinitely const categories = await supabase . from ( ' categories ' ) . select ( ' * ' ) . cache ({ revalidate : false }) // Semi-static data: Cache with revalidation const userProjects = await supabase . from ( ' projects ' ) . select ( ' * ' ) . eq ( ' user_id ' , userId ) . cache ({ revali

2026-06-12 原文 →
AI 资讯

Next.js + Supabase Performance Optimization: From Slow to Lightning Fast

Next.js + Supabase Performance Optimization: From Slow to Lightning Fast Last month, I optimized a Next.js + Supabase application that was frustratingly slow. Initial page load took 4.2 seconds, Lighthouse performance score was 62, and users were complaining. After applying these optimization techniques, we achieved: 70% faster load times (4.2s → 1.3s) Lighthouse score of 96 (up from 62) LCP improved by 65% (3.8s → 1.3s) 50% reduction in database queries Here's exactly how we did it. The Starting Point: Measuring Performance Before optimizing anything, we measured current performance using: Lighthouse (Chrome DevTools): Performance: 62 First Contentful Paint (FCP): 2.1s Largest Contentful Paint (LCP): 3.8s Total Blocking Time (TBT): 420ms Cumulative Layout Shift (CLS): 0.18 Real User Monitoring: Average page load: 4.2s Time to Interactive: 5.1s Database query time: 850ms average The Problems: Unoptimized database queries No caching strategy Large JavaScript bundles Unoptimized images Blocking render paths Too many client-side fetches Let's fix each one. 1. Database Query Optimization Problem: N+1 Queries The biggest performance killer was N+1 queries. We were fetching posts, then fetching the author for each post individually. // ❌ Bad: N+1 queries (1 + N database calls) async function getPosts () { const { data : posts } = await supabase . from ( ' posts ' ) . select ( ' id, title, author_id ' ) // Fetching author for each post = N queries const postsWithAuthors = await Promise . all ( posts . map ( async ( post ) => { const { data : author } = await supabase . from ( ' users ' ) . select ( ' name, avatar ' ) . eq ( ' id ' , post . author_id ) . single () return { ... post , author } }) ) return postsWithAuthors } Impact: 50 posts = 51 database queries (850ms total) Solution: Use Joins // ✅ Good: Single query with join (1 database call) async function getPosts () { const { data : posts } = await supabase . from ( ' posts ' ) . select ( ` id, title, author:users(nam

2026-06-12 原文 →
AI 资讯

I Processed 2.4 Billion Tokens Across 52 AI Models for $0.52. Here's the Full Breakdown.

I run a production multi-agent AI system on a single M1 Mac in Jamaica. 6 autonomous agents. 26 cron workflows. 5-layer persistent memory. All containerized, all running 24/7. I checked my OpenRouter dashboard last week and realized something: I'd processed 2.4 billion tokens across 52 different AI models and spent a total of $0.52 . That's not a typo. Here's exactly where that money went and what it means. The Numbers Metric Value Total Requests 26,600+ Tokens Processed 2.4 Billion Models Used 52 Total Cost $0.52 Cost per Token $0.00000021 Tokens per Dollar 4.6 Million For context: GPT-4 Turbo costs about $0.00001 per token at scale. I'm running at roughly 50x below that rate. Where the $0.52 Actually Went Here's the breakdown by model: Model Requests Tokens Cost openrouter/owl-alpha 1,334 251.2M $0.00 nvidia/nemotron-3-super-120b 32 1.8M $0.00 google/gemma-4-31b-it 47 1.8M $0.00 openai/gpt-5 1 2.8K $0.03 google/gemini-3.1-pro-preview 1 3.2K $0.04 anthropic/claude-opus-4 1 2.0K $0.13 qwen/qwen3.5-plus 1 6.3K $0.01 z-ai/glm-5-turbo 1 3.0K $0.01 moonshotai/kimi-k2.5 2 4.1K $0.01 google/gemini-2.5-flash 2 5.5K $0.01 +42 other models ~125 ~8.5M ~$0.28 99.6% of my requests cost exactly $0.00. They ran on free-tier models or local inference. The $0.52 comes from a handful of premium model calls: Claude Opus, GPT-5, Gemini Pro. These are reserved for specific high-quality tasks — not everyday inference. What This Would Cost on Cloud Approach Hardware Monthly Cost Annual Cost My setup (M1 Mac) M1 Mac 16GB, local + free tier ~$0.09 ~$1.04 OpenRouter Paid Tier API-only, no local $15-30 $180-360 AWS (g4dn.xlarge + API) 1x T4 GPU, on-demand $350-500 $4,200-6,000 AWS (g5.xlarge + API) 1x A10G GPU, on-demand $700-1,000 $8,400-12,000 A $1,200 laptop replaces $500-1,000/month in cloud bills. The break-even point is about 2 weeks. How the Architecture Works The key insight: not every task needs a $20/month model . My system routes tasks intelligently: Local inference (free): Ollama

2026-06-11 原文 →
AI 资讯

From ThreadPoolExecutor to httpx AsyncClient: True Async Refactoring

Published on : 2026-06-06 Reading time : 6 min Tags : #python #async #performance #optimization The Problem: Fake Async The supabase-async library claimed to be async but actually wrapped synchronous calls with ThreadPoolExecutor: # ❌ Fake async (old code) class SupabaseAsync : def __init__ ( self ): self . _executor = ThreadPoolExecutor ( max_workers = 3 ) async def select ( self , table : str ): loop = asyncio . get_event_loop () r = await loop . run_in_executor ( self . _executor , lambda : requests . get ( url ) # Sync call wrapped as async ) return r . json () Problems : Max 3 concurrent requests (not scalable) Thread overhead per request High memory usage No connection pooling Solution: httpx AsyncClient Use true async HTTP with httpx: # ✅ Real async (new code) import httpx class SupabaseAsync : def __init__ ( self ): self . _client : Optional [ httpx . AsyncClient ] = None async def _get_client ( self ) -> httpx . AsyncClient : if self . _client is None : self . _client = httpx . AsyncClient ( headers = self . _headers , timeout = 30 , limits = httpx . Limits ( max_connections = 10 ) ) return self . _client async def select ( self , table : str ): client = await self . _get_client () r = await client . get ( f " { self . _base } / { table } " ) r . raise_for_status () return r . json () Performance Gains Metric ThreadPoolExecutor(3) httpx(10) Max concurrent 3 requests 10 requests Avg response 450ms 150ms Memory usage 250MB 180MB Throughput 6.7 req/s 20 req/s Real benchmark : 100 concurrent requests ThreadPoolExecutor: 15 seconds httpx AsyncClient: 5 seconds 3x faster ⚡ Migration Steps 1. Client Initialization with Lazy Loading async def _get_client ( self ) -> httpx . AsyncClient : if self . _client is None : self . _client = httpx . AsyncClient ( headers = self . _headers , timeout = 30 , limits = httpx . Limits ( max_connections = 10 , max_keepalive_connections = 5 ) ) return self . _client 2. HTTP Methods (GET, POST, etc.) async def _request ( self , metho

2026-06-06 原文 →
AI 资讯

supabase-async: ThreadPoolExecutor에서 httpx AsyncClient로 리팩토링

Published on : 2026-06-06 Reading time : 6 min Tags : #python #async #performance #optimization 문제: 거짓 비동기 supabase-async 라이브러리는 이름은 async이지만, 실제로는 ThreadPoolExecutor로 동기 호출을 래핑하고 있었습니다. # ❌ 거짓 비동기 (기존 코드) class SupabaseAsync : def __init__ ( self ): self . _executor = ThreadPoolExecutor ( max_workers = 3 ) async def select ( self , table : str ): loop = asyncio . get_event_loop () r = await loop . run_in_executor ( self . _executor , lambda : requests . get ( url ) # 동기 호출을 async로 포장 ) return r . json () 문제점 : 최대 3개 동시 요청만 가능 (동시성 부족) 스레드 오버헤드 (각 요청마다 스레드 생성) 높은 메모리 사용량 해결책: httpx AsyncClient 진정한 비동기 HTTP 클라이언트인 httpx를 사용합니다. # ✅ 진정한 비동기 (수정된 코드) import httpx class SupabaseAsync : def __init__ ( self ): self . _client : Optional [ httpx . AsyncClient ] = None async def _get_client ( self ) -> httpx . AsyncClient : if self . _client is None : self . _client = httpx . AsyncClient ( headers = self . _headers , timeout = 30 , limits = httpx . Limits ( max_connections = 10 ) ) return self . _client async def select ( self , table : str ): client = await self . _get_client () r = await client . get ( f " { self . _base } / { table } " ) r . raise_for_status () return r . json () 성능 개선 동시성 비교 지표 ThreadPoolExecutor(3) httpx(10) 최대 동시 요청 3개 10개 평균 응답 시간 450ms 150ms 메모리 사용량 250MB 180MB 초당 처리량 6.7 req/s 20 req/s 벤치마크 # 100개 동시 요청 처리 시간 ThreadPoolExecutor : 15 초 httpx AsyncClient : 5 초 → 3 배 빠름 마이그레이션 단계 1. 클라이언트 초기화 async def _get_client ( self ) -> httpx . AsyncClient : if self . _client is None : self . _client = httpx . AsyncClient ( headers = self . _headers , timeout = 30 , limits = httpx . Limits ( max_connections = 10 , max_keepalive_connections = 5 ) ) return self . _client 2. 요청 메서드 async def _request ( self , method : str , url : str , ** kwargs ): client = await self . _get_client () if method == " GET " : return await client . get ( url , ** kwargs ) elif method == " POST " : return await client . post ( url , ** kwargs ) # ... 3. Context Manager 지원 async def clos

2026-06-06 原文 →
AI 资讯

The FinOps Foundation Framework: A Practitioner's Walkthrough

Originally published on rikuq.com . Republished here for Dev.to's readers. The FinOps Foundation Framework is the reference architecture for cloud financial management. It's been maintained by the FinOps Foundation (a Linux Foundation project) since 2018 and has matured into the de facto standard most serious cloud cost work is built on. In 2026 it received a substantial refresh that extended its scope from pure cloud spend to include AI/ML, SaaS, licensing, and broader technology categories. For practitioners thinking about formalising FinOps practice — or evaluating providers who claim to do FinOps — knowing what the Framework actually covers is what separates a real implementation from a marketing label. This post walks through the Framework structure, the 2026 updates, and how it applies specifically to AI/ML spend. I'm Ravi. I run three production AI SaaS solo ( Prism , Citare , BatchWise ) and do advisory work on FinOps via rikuq services . The walkthrough below is what I use when teams ask "what does the FinOps Foundation Framework actually look like in practice?" TL;DR Element What it is Phases Three concurrent operational modes: Inform, Optimize, Operate Principles Six foundational principles guiding all FinOps practice Capabilities The functional areas of activity a FinOps practice covers Personas Engineering, Finance, Procurement, Leadership, Operations, ITAM, Sustainability 2026 additions Executive Strategy Alignment, Technology Categories taxonomy, Converging Disciplines recognition AI/ML extension New Technology Category with specifics on GPU/CPU differential, token pricing, make-vs-buy economics The six foundational principles Before the structural mechanics, the Framework's six principles establish the cultural and operational mindset. They're worth knowing because they're how the Framework's authors test whether something is "really" FinOps or just cloud cost cutting. Teams need to collaborate. Engineering, Finance, Procurement, and Business teams w

2026-06-01 原文 →
AI 资讯

Token Budgeting

Token Budgeting: Optimizing Generative AI Costs and Performance Modern generative AI applications offer unprecedented capabilities, yet their operational costs can quickly escalate. The primary driver of these costs, alongside computational resources, is token consumption . Understanding and implementing effective token budgeting strategies is not merely an optimization; it is fundamental to building scalable, efficient, and economically viable AI systems. The Economics of Tokens Tokens are the atomic units of text that large language models (LLMs) process. Whether you're sending a prompt (input tokens) or receiving a response (output tokens), each token incurs a cost. This cost varies by model, but the principle remains: more tokens mean higher expenses and often, increased latency due to longer processing times. Efficient token management directly impacts your application's bottom line and user experience. Strategic Pillars of Token Efficiency Optimizing token usage requires a multi-faceted approach, focusing on both input and output, as well as the underlying model choices. 1. Input Optimization: Crafting Smarter Prompts The most direct way to save tokens is to be judicious with the information sent to the model. Every word in your prompt counts. Concise Prompt Engineering : Avoid verbose instructions or unnecessary conversational filler. Get straight to the point. Instead of: "Hey AI, I was wondering if you could please help me summarize this really long article I have here. It's about quantum computing. Could you make it brief, maybe just a few sentences?" Opt for: "Summarize the following article about quantum computing in three sentences: [Article Text]" This significantly reduces input tokens without sacrificing clarity. Context Window Management : LLMs have a finite context window , the maximum number of tokens they can process at once. Sending an entire document when only a specific section is relevant is wasteful. Employ techniques like: Summarization : P

2026-05-31 原文 →