首页›Chip Huyen›文章

Generation configurations: temperature, top-k, top-p, and test time compute

2024年1月16日

AI 摘要 AI 生成,可能有误

This article explains why ML models generate probabilistic, non-deterministic responses and how the sampling process works, including how logits are converted to probabilities via softmax. It covers key generation configuration variables—temperature (which redistributes probabilities to balance creativity vs. consistency), top-k (sampling from a fixed number of most likely values), and top-p or nucleus sampling (dynamically selecting values based on cumulative probability)—along with stopping conditions. It also introduces test time compute, a technique of generating multiple outputs and selecting the best one to improve model performance.

ML models are probabilistic. Imagine that you want to know what’s the best cuisine in the world. If you ask someone this question twice, a minute apart, their answers both times should be the same. If you ask a model the same question twice, its answer can change. If the model thinks that Vietnamese cuisine has a 70% chance of being the best cuisine and Italian cuisine has a 30% chance, it’ll answer “Vietnamese” 70% of the time, and “Italian” 30%.

This probabilistic nature makes AI great for creative tasks. What is creativity but the ability to explore beyond the common possibilities, to think outside the box?

However, this probabilistic nature also causes inconsistency and hallucinations. It’s fatal for tasks that depend on factuality. Recently, I went over 3 months’ worth of customer support requests of an AI startup I advise and found that ⅕ of the questions are because users don’t understand or don’t know how to work with this probabilistic nature.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Chip Huyen

Common pitfalls when building generative AI applications

AI 摘要The article outlines six common pitfalls in building generative AI applications: using gen AI when simpler solutions suffice, confusing bad product design with bad AI, starting with overly complex tools, over-indexing on early demo success, forgoing human evaluation in favor of AI judges, and crowdsourcing use cases without a strategic plan. The author emphasizes that while the technology is powerful, success depends on solving real problems, prioritizing product and UX, maintaining human oversight, and adopting a big-picture strategy to maximize return on investment.

Agents

AI 摘要This article provides an overview of AI agents, defining them as systems that perceive their environment through sensors and act upon it via actuators, and explains how foundation models have finally made autonomous agents capable of tasks like research, coding, and trip planning feasible. It examines two key factors that determine an agent's capabilities—its tools (including knowledge augmentation, capability extension, and environment-acting tools) and its planning ability—while noting that agents require more powerful models than typical applications due to compounding mistakes and higher stakes. Adapted from AI Engineering (2025), the piece concludes that agents' new modes of operation introduce new failure modes that must be caught through careful evaluation.

Building A Generative AI Platform

AI 摘要The article outlines the common architecture of a generative AI platform, starting with a simple setup where a query is sent directly to a model, then progressively adding components such as context enhancement (including RAG, term-based and embedding-based retrieval, and query rewriting), guardrails, model routers and gateways, caching, and complex logic like write actions. It emphasizes that evaluation is necessary at every step, while observability and orchestration are essential platform-wide components. The piece focuses on architectural considerations for deployment rather than topics like prompt engineering, finetuning, or model evaluation.

Measuring personal growth

AI 摘要Inspired by founder friends who obsessively measure business growth, the author proposes three heuristics for measuring personal growth: rate of change (aiming to become a 'new person' every 3–6 years, analogous to finance's rule of 72), the time it takes to solve big life problems like career, family, and finance, and the number of future options gained by choosing paths that maximize possibilities. Acknowledging that some friends find quantifying life 'sociopathic,' the author argues that measuring and living aren't mutually exclusive. These heuristics reflect a personal bias toward novelty and exploration that may one day change—which would itself be growth.

What I learned from looking at 900 most popular open source AI tools

AI 摘要The author analyzed 845 of the most popular open source AI software repositories on GitHub, organizing them into a three-layer AI stack (infrastructure, model development, and application development) and documenting an explosion of new tools in 2023 following the releases of Stable Diffusion and ChatGPT, with application development and AI engineering seeing the most growth. The analysis showed that a small number of accounts—mostly organizations but also prolific individuals like lucidrains and ggerganov—host a large share of repos, that individuals can compete effectively at the application layer but rarely at lower layers, and that over 20,000 developers have contributed nearly a million commits. It also highlighted how China's open source AI ecosystem has diverged from the West's, and how many repos follow a hype curve of rapid popularity followed by swift decline.