YouZum

Uncategorized

AI, Committee, ニュース, Uncategorized

NDT: Non-Differential Transformer and Its Application to Sentiment Analysis

arXiv:2603.20704v1 Announce Type: cross Abstract: From customer feedback to social media, understanding human sentiment in text is central to how machines can interact meaningfully with people. However, despite notable progress, accurately capturing sentiment remains a challenging task, which continues to motivate further research in this area. To this end, we introduce Non-Differential Transformer (NDT). It is inspired by (but in contrast to) the state-of-the-art Differential Transformer (DT) model. While standard Transformers can struggle with irrelevant context, the sota DT model uses attention map subtraction, potentially for noise cancellation. We explore an alternative motivation, hypothesizing that benefits may arise from enabling different attention components to specialize on distinct concepts within the text, similar to multiplexing information channels or mixture models, rather than primarily canceling noise via subtraction. Guided by this concept-multiplexing (ConPlex) view, the specific architecture presented in this paper employs a purely additive strategy. It uses only positive weights, learned during training, to ensure constructive combination of these specialized attention perspectives. This design choice explores positive only integration, though our broader framework also shows promise with less constrained linear combinations involving both positive and negative weights. Our model computes attention via this positively weighted sum of multiple distinct attention maps. This allows the model to constructively integrate diverse signals and potentially capture more complex contextual relationships. Competitive performance is achieved by the proposed model for Sentiment Analysis while tested on multiple datasets. We conclude by presenting our results, challenges and future research agenda in this important area of research.

NDT: Non-Differential Transformer and Its Application to Sentiment Analysis 投稿を読む »

AI, Committee, ニュース, Uncategorized

Yann LeCun’s New LeWorldModel (LeWM) Research Targets JEPA Collapse in Pixel-Based Predictive World Modeling

World Models (WMs) are a central framework for developing agents that reason and plan in a compact latent space. However, training these models directly from pixel data often leads to ‘representation collapse,’ where the model produces redundant embeddings to trivially satisfy prediction objectives. Current approaches attempt to prevent this by relying on complex heuristics: they utilize stop-gradient updates, exponential moving averages (EMA), and frozen pre-trained encoders. A team of researchers including Yann LeCun and many others (Mila & Université de Montréal, New York University, Samsung SAIL and Brown University) introduced LeWorldModel (LeWM), the first JEPA (Joint-Embedding Predictive Architecture) that trains stably end-to-end from raw pixels using only two loss terms: a next-embedding prediction loss and a regularizer enforcing Gaussian-distributed latent embeddings Technical Architecture and Objective LeWM consists of two primary components learned jointly: an Encoder and a Predictor. Encoder ((zt=encθ (ot)): Maps a raw pixel observation into a compact, low-dimensional latent representation. The implementation uses a ViT-Tiny architecture (~5M parameters). Predictor (Žt+1=predθ(zt, at)): A transformer (~10M parameters) that models environment dynamics by predicting future latent states conditioned on actions. The model is optimized using a streamlined objective function consisting of only two loss terms: $$mathcal{L}_{LeWM} triangleq mathcal{L}_{pred} + lambda SIGReg(Z)$$ The prediction loss (Lpred) computes the mean-squared error (MSE) between the predicted and actual consecutive embeddings. The SIGReg (Sketched-Isotropic-Gaussian Regularizer) is the anti-collapse term that enforces feature diversity. As per the research paper, applying a dropout rate of 0.1 in the predictor and a specific projection step (1-layer MLP with Batch Normalization) after the encoder are critical for stability and downstream performance. Efficiency via SIGReg and Sparse Tokenization Assessing normality in high-dimensional latent spaces is a major scaling challenge. LeWM addresses this using SIGReg, which leverages the Cramér-Wold theorem: a multivariate distribution matches a target (isotropic Gaussian) if all its one-dimensional projections match that target. SIGReg projects latent embeddings onto M random directions and applies the Epps-Pulley test statistic to each resulting one-dimensional projection. Because the regularization weight λ is the only effective hyperparameter to tune, researchers can optimize it using a bisection search with O(log n) complexity, a significant improvement over the polynomial-time search (O(n6)) required by previous models like PLDM. Speed Benchmarks In the reported setup, LeWM demonstrates high computational efficiency: Token Efficiency: LeWM encodes observations using ~200× fewer tokens than DINO-WM. Planning Speed: LeWM achieves planning up to 48× faster than DINO-WM (0.98s vs 47s per planning cycle). Latent Space Properties and Physical Understanding LeWM’s latent space supports probing of physical quantities and detection of physically implausible events. Violation-of-Expectation (VoE) Using a VoE framework, the model was evaluated on its ability to detect ‘surprise’. It assigned higher surprise to physical perturbations such as teleportation; visual perturbations produced weaker effects, and cube color changes in OGBench-Cube were not significant. Emergent Path Straightening LeWM exhibits Temporal Latent Path Straightening, where latent trajectories naturally become smoother and more linear over the course of training. Notably, LeWM achieves higher temporal straightness than PLDM despite having no explicit regularizer encouraging this behavior. Feature LeWorldModel (LeWM) PLDM DINO-WM Dreamer / TD-MPC Training Paradigm Stable End-to-End End-to-End Frozen Foundation Encoder Task-Specific Input Type Raw Pixels Raw Pixels Pixels (DINOv2 features) Rewards / Privileged State Loss Terms 2 (Prediction + SIGReg) 7 (VICReg-based) 1 (MSE on latents) Multiple (Task-specific) Tunable Hyperparams 1 (Effective weight λ) 6 N/A (Fixed by pre-training) Many (Task-dependent) Planning Speed Up to 48x Faster Fast (Compact latents) Slow (~50x slower than LeWM) Varies (often slow generation) Anti-Collapse Provable (Gaussian prior) Under-specified / Unstable Bounded by pre-training Heuristic (e.g., reconstruction) Requirement Task-Agnostic / Reward-Free Task-Agnostic / Reward-Free Frozen Pre-trained Encoder Task Signals / Rewards Key Takeaways Stable End-to-End Learning: LeWM is the first Joint-Embedding Predictive Architecture (JEPA) that trains stably end-to-end from raw pixels without needing ‘hand-holding’ heuristics like stop-gradients, exponential moving averages (EMA), or frozen pre-trained encoders. A Radical Two-Term Objective: The training process is simplified into just two loss terms—a next-embedding prediction loss and the SIGReg regularizer—reducing the number of tunable hyperparameters from six to one compared to existing end-to-end alternatives. Built for Real-Time Speed: By representing observations with approximately 200× fewer tokens than foundation-model-based counterparts, LeWM plans up to 48× faster, completing full trajectory optimizations in under one second. Provable Anti-Collapse: To prevent the model from learning ‘garbage’ redundant representations, it uses the SIGReg regularizer; this utilizes the Cramér-Wold theorem to ensure high-dimensional latent embeddings stay diverse and Gaussian-distributed. Intrinsic Physical Logic: The model doesn’t just predict data; it captures meaningful physical structure in its latent space, allowing it to accurately probe physical quantities and detect ‘impossible’ events like object teleportation through a violation-of-expectation framework. Check out the Paper, Website and Repo. Also, feel free to follow us on Twitter and don’t forget to join our 120k+ ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well. The post Yann LeCun’s New LeWorldModel (LeWM) Research Targets JEPA Collapse in Pixel-Based Predictive World Modeling appeared first on MarkTechPost.

Yann LeCun’s New LeWorldModel (LeWM) Research Targets JEPA Collapse in Pixel-Based Predictive World Modeling 投稿を読む »

AI, Committee, ニュース, Uncategorized

The Download: tracing AI-fueled delusions, and OpenAI admits Microsoft risks

This is today’s edition of The Download, our weekday newsletter that provides a daily dose of what’s going on in the world of technology. The hardest question to answer about AI-fueled delusions  What actually happens when people spiral into delusion with AI? To find out, Stanford researchers analyzed transcripts from chatbot users who experienced these spirals.  Their findings suggest that chatbots have a unique ability to turn a benign, delusion-like thought into a dangerous obsession. But the research struggles to answer a vital question: does AI cause delusions or merely amplify them? Read the full story to understand the answer’s enormous implications.  —James O’Donnell  This story is from The Algorithm, our weekly newsletter giving you the inside track on all things AI. Sign up to receive it in your inbox every Monday.  The next era of space exploration  Our footprint in the solar system is rapidly expanding. Programs to build permanent Moon bases and find life on Mars have transitioned from science fiction to active space agency missions. The scientists behind them will not only shed new light on the cosmos, but also reveal where humanity is headed.  To examine what the future holds in store, MIT Technology Review features editor Amanda Silverman will sit down on Wednesday with award-winning science journalist and author Robin George Andrews for an exclusive subscriber-only Roundtable conversation about “The Next Era of Space Exploration.” Register here to join the session at 16:00 GMT / 12:00 PM ET / 9:00 AM PT.  The must-reads  I’ve combed the internet to find you today’s most fun/important/scary/fascinating stories about technology.  1 OpenAI has admitted its close ties with Microsoft are a business risk It highlighted the dangers in a pre-IPO document. (CNBC) + OpenAI is wooing private equity firms with a sweeter deal than Anthropic’s. (Reuters $) + It’s also building a fully automated researcher. (MIT Technology Review) + And wants to muscle in on Google’s search dominance. (Telegraph $)  2 The US just banned all new foreign-made consumer routers Citing national security concerns. (BBC) + The EU has been urged to tighten rules for big tech-built smart TVs. (Guardian)  3 Elon Musk’s “Terafab” chip factory faces a harsh reality check In the form of chip production shortages. (Bloomberg) + Future AI chips could be built on glass. (MIT Technology Review)  4 Mark Zuckerberg is building an AI CEO to help him run Meta He wants everyone to have their own personal AI agent. (WSJ $) + But don’t let the hype about agents get ahead of reality. (MIT Technology Review)  5 Palantir has become a “poisonous” flashpoint on the campaign trail  Candidates are facing scrutiny over their ties to the company. (FT $) + Palantir’s access to sensitive UK data is also causing concern. (Guardian)  6 Mistral’s CEO has called for AI companies to pay a content levy in Europe It would apply to all commercial models on the continent. (FT $) + Siemens’ CEO says Europe risks “disaster” from prioritizing AI independence. (FT $)  7 Hong Kong police can now demand device passwords under a new law Refusing to comply could lead to a year in jail. (Guardian)   8  Russia’s aspiring SpaceX rival has put its first internet satellites into orbit  It plans to create a low-Earth orbit network. (Bloomberg $)  9 A biotech startup wants to replace animal testing with nonsentient “organ sacks” The genetically engineered system is backed by billionaire Tim Draper (Wired $)  + Several new technologies are promising alternatives to lab animals. (MIT Technology Review)  10 AI agents in a video game spontaneously created their own religion They reinterpreted a mission in the MMORPG. (Gizmodo) + They’re not the first agents to get religious. (MIT Technology Review)  Quote of the day  “I think we’ve achieved AGI.”  —Nvidia CEO Jensen Huang tells the Lex Fridman Podcast that artificial general intelligence is already here (at least by one generous definition).  One More Thing  MICHAEL BYERS Beyond gene-edited babies: the possible paths for tinkering with human evolution  In 2018, a Chinese scientist created the world’s first gene-edited babies, a milestone that fell between a medical breakthrough and the start of a slippery slope toward human enhancement.  He achieved the feat with CRISPR, which was sweeping across biology labs because it was so easy to use. For his actions, He was sentenced to three years in prison, and his work was roundly excoriated. Yet even his biggest critics saw the basic idea as inevitable.  In the years since, CRISPR has continued getting easier and easier to administer. What does that mean for the future of our species? Read the full story to find out why.  —Antonio Regalado  We can still have nice things  A place for comfort, fun and distraction to brighten up your day. (Got any ideas? Drop me a line.)  + This candle-powered Game Boy is a romantic approach to gaming during a blackout. + Apparently, Monopoly would be more fun if we actually followed the rules. + Watching rubber bands explode these everyday objects is strangely hypnotic. +This spellbinding site simulates what Earth looked like hundreds of millions of years ago. 

The Download: tracing AI-fueled delusions, and OpenAI admits Microsoft risks 投稿を読む »

AI, Committee, ニュース, Uncategorized

A Multi-Perspective Benchmark and Moderation Model for Evaluating Safety and Adversarial Robustness

arXiv:2601.03273v2 Announce Type: replace Abstract: As large language models (LLMs) become deeply embedded in daily life, the urgent need for safer moderation systems that distinguish between naive and harmful requests while upholding appropriate censorship boundaries has never been greater. While existing LLMs can detect dangerous or unsafe content, they often struggle with nuanced cases such as implicit offensiveness, subtle gender and racial biases, and jailbreak prompts, due to the subjective and context-dependent nature of these issues. Furthermore, their heavy reliance on training data can reinforce societal biases, resulting in inconsistent and ethically problematic outputs. To address these challenges, we introduce GuardEval, a unified multi-perspective benchmark dataset designed for both training and evaluation, containing 106 fine-grained categories spanning human emotions, offensive and hateful language, gender and racial bias, and broader safety concerns. We also present GemmaGuard (GGuard), a Quantized Low-Rank Adaptation (QLoRA), fine-tuned version of Gemma3-12B trained on GuardEval, to assess content moderation with fine-grained labels. Our evaluation shows that GGuard achieves a macro F1 score of 0.832, substantially outperforming leading moderation models, including OpenAI Moderator (0.64) and Llama Guard (0.61). We show that multi-perspective, human-centered safety benchmarks are critical for mitigating inconsistent moderation decisions. GuardEval and GGuard together demonstrate that diverse, representative data materially improve safety, and adversarial robustness on complex, borderline cases.

A Multi-Perspective Benchmark and Moderation Model for Evaluating Safety and Adversarial Robustness 投稿を読む »

AI, Committee, ニュース, Uncategorized

The Bay Area’s animal welfare movement wants to recruit AI

In early February, animal welfare advocates and AI researchers gathered in stocking feet at Mox, a scrappy, shoes-free coworking space in San Francisco. Yellow and red canopies billowed overhead, Persian rugs blanketed the floor, and mosaic lamps glowed beside potted plants.  In the common area, a wildlife advocate spoke passionately to a crowd lounging in beanbags about a form of rodent birth control that could manage rat populations without poison. In the “Crustacean Room,” a dozen people sat in a circle, debating whether the sentience of insects could tell us anything about the inner lives of chatbots. In front of the “Bovine Room” stood a bookshelf stacked with copies of Eliezer Yudkowsky’s If Anyone Builds It, Everyone Dies, a manifesto arguing that AI could wipe out humanity.  The event was hosted by Sentient Futures, an organization that believes the future of animal welfare will depend on AI. Like many Bay Area denizens, the attendees were decidedly “AGI-pilled”—they believe that artificial general intelligence, powerful AI that can compete with humans on most cognitive tasks, is on the horizon. If that’s true, they reason, then AI will likely prove key to solving society’s thorniest problems—including animal suffering. To be clear, experts still fiercely debate whether today’s AI systems will ever achieve human- or superhuman-level intelligence, and it’s not clear what will happen if they do. But some conference attendees envision a possible future in which it is AI systems, and not humans, who call the shots. Eventually, they think, the welfare of animals could hinge on whether we’ve trained AI systems to value animal lives.  “AI is going to be very transformative, and it’s going to pretty much flip the game board,” said Constance Li, founder of Sentient Futures. “If you think that AI will make the majority of decisions, then it matters how they value animals and other sentient beings”—those that can feel and, therefore, suffer. Like Li, many summit attendees have been committed to animal welfare since long before AI came into the picture. But they’re not the types to donate a hundred bucks to an animal shelter. Instead of focusing on local actions, they prioritize larger-scale solutions, such as reducing factory farming by promoting cultivated meat, which is grown in a lab from animal cells.  The Bay Area animal welfare movement is closely linked to effective altruism, a philanthropic movement committed to maximizing the amount of good one does in the world—indeed, many conference attendees work for organizations funded by effective altruists. That philosophy might sound great on paper, but “maximizing good” is a tricky puzzle that might not admit a clear solution. The movement has been widely criticized for some of its conclusions, such as promoting working in exploitative industries to maximize charitable donations and ignoring present-day harms in favor of  issues that could cause suffering for a large number of people who haven’t been born yet. Critics also argue that effective altruists neglect the importance of systemic issues such as racism and economic exploitation and overlook the insights that marginalized communities might have into the best ways to improve their own lives. When it comes to animal welfare, this exactingly utilitarian approach can lead to some strange conclusions. For example, some effective altruists say it makes sense to commit significant resources to improving the welfare of insects and shrimp because they exist in such staggering numbers, even though they may not have much individual capacity for suffering.  Now the movement is sorting out how AI fits in. At the summit, Jasmine Brazilek, cofounder of a nonprofit called Compassion in Machine Learning, opened her sticker-stamped laptop to pull up a benchmark she devised to measure how LLMs reason about animal welfare. A cloud security engineer turned animal advocate, she’d flown in from La Paz, Mexico, where she runs her nonprofit with a handful of volunteers and a shoestring budget.  Brazilek urged the AI researchers in the room to train their models with synthetic documents that reflect concern for animal welfare. “Hopefully, future superintelligent systems consider nonhuman interest, and there is a world where AI amplifies the best of human values and not the worst,” she said.  The power of the purse  The technologically inclined side of the animal welfare movement has faced some major setbacks in recent years. Dreams of transitioning people away from a diet dependent on factory farming have been dampened by developments such as the decimation of the plant-based-meat company Beyond Meat’s stock price and the passage of laws banning cultivated meat in several US states. AI has injected a shot of optimism. Like much of Silicon Valley, many attendees at the summit subscribe to the idea that AI might dramatically increase their productivity—though their goal is not to maximize their seed round but, rather, to prevent as much animal suffering as possible. Some brainstormed how to use Claude Code and custom agents to handle the coding and administrative tasks in their advocacy work. Others pitched the idea of developing new, cheaper methods for cultivating meat using scientific AI tools such as AlphaFold, which aids in molecular biology research by predicting the three-dimensional structures of proteins. But the real talk of the event was a flood of funding that advocates expect will soon be committed to animal welfare charities—not by individual megadonors, but by AI lab employees.  Much of the funding for the farm animal welfare movement, which includes nonprofits advocating for improved conditions on farms, promoting veganism, and endorsing cultivated meat, comes from people in the tech industry, says Lewis Bollard, the managing director of the farm animal welfare fund at Coefficient Giving, a philanthropic funder that used to be called Open Philanthropy. Coefficient Giving is backed by Facebook cofounder Dustin Moskovitz and his wife, Cari Tuna, who are among a handful of Silicon Valley billionaires who embrace effective altruism “This has just been an area that was completely neglected by traditional philanthropies,” such as the Gates Foundation and the Ford Foundation, Bollard says. “It’s primarily been people in tech who have been

The Bay Area’s animal welfare movement wants to recruit AI 投稿を読む »

AI, Committee, ニュース, Uncategorized

Evaluating Evidence Grounding Under User Pressure in Instruction-Tuned Language Models

arXiv:2603.20162v1 Announce Type: new Abstract: In contested domains, instruction-tuned language models must balance user-alignment pressures against faithfulness to the in-context evidence. To evaluate this tension, we introduce a controlled epistemic-conflict framework grounded in the U.S. National Climate Assessment. We conduct fine-grained ablations over evidence composition and uncertainty cues across 19 instruction-tuned models spanning 0.27B to 32B parameters. Across neutral prompts, richer evidence generally improves evidence-consistent accuracy and ordinal scoring performance. Under user pressure, however, evidence does not reliably prevent user-aligned reversals in this controlled fixed-evidence setting. We report three primary failure modes. First, we identify a negative partial-evidence interaction, where adding epistemic nuance, specifically research gaps, is associated with increased susceptibility to sycophancy in families like Llama-3 and Gemma-3. Second, robustness scales non-monotonically: within some families, certain low-to-mid scale models are especially sensitive to adversarial user pressure. Third, models differ in distributional concentration under conflict: some instruction-tuned models maintain sharply peaked ordinal distributions under pressure, while others are substantially more dispersed; in scale-matched Qwen comparisons, reasoning-distilled variants (DeepSeek-R1-Qwen) exhibit consistently higher dispersion than their instruction-tuned counterparts. These findings suggest that, in a controlled fixed-evidence setting, providing richer in-context evidence alone offers no guarantee against user pressure without explicit training for epistemic integrity.

Evaluating Evidence Grounding Under User Pressure in Instruction-Tuned Language Models 投稿を読む »

AI, Committee, ニュース, Uncategorized

The Download: animal welfare gets AGI-pilled, and the White House unveils its AI policy

This is today’s edition of The Download, our weekday newsletter that provides a daily dose of what’s going on in the world of technology. The Bay Area’s animal welfare movement wants to recruit AI  In early February, animal welfare advocates and AI researchers arrived in stocking feet at Mox, a scrappy, shoes-free coworking space in San Francisco. They gathered to discuss a provocative idea: if artificial general intelligence is on the horizon, could it prevent animal suffering?  Some brainstormed using custom agents in advocacy work, while others pitched cultivating meat with AI tools. But the real talk of the event was a flood of funding they expect will soon flow to animal welfare charities, not from individual megadonors, but from AI lab employees.    Some attendees also probed an even more controversial idea: AI may develop the capacity to suffer—and this could constitute a moral catastrophe. Read the full story to find out why their ideas are gaining momentum and sparking controversy.  —Michelle Kim & Grace Huckins  The must-reads  I’ve combed the internet to find you today’s most fun/important/scary/fascinating stories about technology.  1 The White House has unveiled its AI policy blueprint Trump wants Congress to codify the light-touch framework into law. (Politico) + He also wants to block state limits on AI. (WP $)  + A backlash against the tech has formed within MAGA. (FT $) + A war over AI regulation is brewing in the US. (MIT Technology Review)  2 Elon Musk has been found liable for misleading Twitter investors A jury ruled that he defrauded shareholders ahead of the $44 billion acquisition. (CNBC) + But it absolved him of some fraud allegations. (NPR)  3 The Pentagon is adopting Palantir AI as the core US military system The move locks in long-term use of Palantir’s weapons-targeting tech. (Reuters) + The DoD wants it to link up sensors and shooters for combat. (Bloomberg) + Palantir is also getting access to sensitive UK financial regulation data. (Guardian) + AI is turning the Iran conflict into theater. (MIT Technology Review)  4 Musk plans to build the largest-ever chip factory in Austin Tesla and SpaceX will jointly run the project. (The Verge) + Future AI chips could be built on glass. (MIT Technology Review)  5 OpenAI will show ads to all US users of the free version of ChatGPT  It’s seeking new revenue streams amid skyrocketing computing costs. (Reuters) + The company is also building a fully automated researcher. (MIT Technology Review) + It plans to double its workforce soon. (FT $)  6 New crypto rules are set to do the Trumps a “big favor” Particularly the narrow securities definitions. (Guardian)  7 Tencent has added a version of the OpenClaw agent to WeChat Users of the super app will now be able to use the tool to control their PCs. (SCMP)   8 Reddit is mulling identity verification to vanquish bots It’s considering “something like” Face ID or Touch ID. (Engadget)  9 People are using AI to find their lost pets Databases for pet reunifications supported their searches. (WP $)  10 Scientists have narrowed down the hunt for aliens to 45 planets The closest is just four light-years from Earth. (404 Media)  Quote of the day  “It doesn’t matter how many people you throw at the problem; we are never going to solve the challenges of war without technology like AI.”  —Alex Miller, the US Army’s CTO, tells Wired why he wants AI in every weapon.  One More Thing  STEPHANIE ARNETT/MITTR | GETTY A brain implant changed her life. Then it was removed against her will.  Sticking an electrode inside a person’s brain can do more than treat a disease. Take the case of Rita Leggett, an Australian woman whose experimental brain implant changed her sense of agency and self. She told researchers that she “became one” with her device.  She was devastated when, two years later, she was told she had to remove the implant because the company that made it had gone bust.   Her case highlights the need for a new category of legal protection: neuro rights. Find out how they could be protected.  —Jessica Hamzelou  We can still have nice things  A place for comfort, fun and distraction to brighten up your day. (Got any ideas? Drop me a line.)  + Looking for a good view? Earth’s longest line of sight has been empirically proven. + A biblical endorsement of sin is a welcome reminder that we all make typos. + Richard Nadler’s illustrations of vertical societies are exquisitely detailed. + This 1978 BBC film evocatively exposes our tendency to stress over tech-dependency. 

The Download: animal welfare gets AGI-pilled, and the White House unveils its AI policy 投稿を読む »

AI, Committee, ニュース, Uncategorized

A Coding Implementation to Build an Uncertainty-Aware LLM System with Confidence Estimation, Self-Evaluation, and Automatic Web Research

In this tutorial, we build an uncertainty-aware large language model system that not only generates answers but also estimates the confidence in those answers. We implement a three-stage reasoning pipeline in which the model first produces an answer along with a self-reported confidence score and a justification. We then introduce a self-evaluation step that allows the model to critique and refine its own response, simulating a meta-cognitive check. If the model determines that its confidence is low, we automatically trigger a web research phase that retrieves relevant information from live sources and synthesizes a more reliable answer. By combining confidence estimation, self-reflection, and automated research, we create a practical framework for building more trustworthy and transparent AI systems that can recognize uncertainty and actively seek better information. Copy CodeCopiedUse a different Browser import os, json, re, textwrap, getpass, sys, warnings from dataclasses import dataclass, field from typing import Optional from openai import OpenAI from ddgs import DDGS from rich.console import Console from rich.table import Table from rich.panel import Panel from rich import box warnings.filterwarnings(“ignore”, category=DeprecationWarning) def _get_api_key() -> str: key = os.environ.get(“OPENAI_API_KEY”, “”).strip() if key: return key try: from google.colab import userdata key = userdata.get(“OPENAI_API_KEY”) or “” if key.strip(): return key.strip() except Exception: pass console = Console() console.print( “n[bold cyan]OpenAI API Key required[/bold cyan]n” “[dim]Your key will not be echoed and is never stored to disk.n” “To skip this prompt in future runs, set the environment variable:n” ” export OPENAI_API_KEY=sk-…[/dim]n” ) key = getpass.getpass(” Enter your OpenAI API key: “).strip() if not key: Console().print(“[bold red]No API key provided — exiting.[/bold red]”) sys.exit(1) return key OPENAI_API_KEY = _get_api_key() MODEL = “gpt-4o-mini” CONFIDENCE_LOW = 0.55 CONFIDENCE_MED = 0.80 client = OpenAI(api_key=OPENAI_API_KEY) console = Console() @dataclass class LLMResponse: question: str answer: str confidence: float reasoning: str sources: list[str] = field(default_factory=list) researched: bool = False raw_json: dict = field(default_factory=dict) We import all required libraries and configure the runtime environment for the uncertainty-aware LLM pipeline. We securely retrieve the OpenAI API key using environment variables, Colab secrets, or a hidden terminal prompt. We also define the LLMResponse data structure that stores the question, answer, confidence score, reasoning, and research metadata used throughout the system. Copy CodeCopiedUse a different Browser SYSTEM_UNCERTAINTY = “”” You are an expert AI assistant that is HONEST about what it knows and doesn’t know. For every question you MUST respond with valid JSON only (no markdown, no prose outside JSON): { “answer”: “<your best answer — thorough, factual>”, “confidence”: <float 0.0-1.0>, “reasoning”: “<explain WHY you are or aren’t confident; mention specific knowledge gaps>” } Confidence scale: 0.90-1.00 → very high: well-established fact, you are certain 0.75-0.89 → high: strong knowledge, minor uncertainty 0.55-0.74 → medium: plausible but you may be wrong, could be outdated 0.30-0.54 → low: significant uncertainty, answer is a best guess 0.00-0.29 → very low: mostly guessing, minimal reliable knowledge Be CALIBRATED — do not always give high confidence. Genuinely reflect uncertainty about recent events (after your knowledge cutoff), niche topics, numerical claims, and anything that changes over time. “””.strip() SYSTEM_SYNTHESIS = “”” You are a research synthesizer. Given a question, a preliminary answer, and web-search snippets, produce an improved final answer grounded in the evidence. Respond in JSON only: { “answer”: “<improved, evidence-grounded answer>”, “confidence”: <float 0.0-1.0>, “reasoning”: “<explain how the search evidence changed or confirmed the answer>” } “””.strip() def query_llm_with_confidence(question: str) -> LLMResponse: completion = client.chat.completions.create( model=MODEL, temperature=0.2, response_format={“type”: “json_object”}, messages=[ {“role”: “system”, “content”: SYSTEM_UNCERTAINTY}, {“role”: “user”, “content”: question}, ], ) raw = json.loads(completion.choices[0].message.content) return LLMResponse( question=question, answer=raw.get(“answer”, “”), confidence=float(raw.get(“confidence”, 0.5)), reasoning=raw.get(“reasoning”, “”), raw_json=raw, ) We define the system prompts that instruct the model to report answers along with calibrated confidence and reasoning. We then implement the query_llm_with_confidence function that performs the first stage of the pipeline. This stage generates the model’s answer while forcing the output to be structured JSON containing the answer, confidence score, and explanation. Copy CodeCopiedUse a different Browser def self_evaluate(response: LLMResponse) -> LLMResponse: critique_prompt = f””” Review this answer and its stated confidence. Check for: 1. Logical consistency 2. Whether the confidence matches the actual quality of the answer 3. Any factual errors you can spot Question: {response.question} Proposed answer: {response.answer} Stated confidence: {response.confidence} Stated reasoning: {response.reasoning} Respond in JSON: {{ “revised_confidence”: <float — adjust if the self-check changes your view>, “critique”: “<brief critique of the answer quality>”, “revised_answer”: “<improved answer, or repeat original if fine>” }} “””.strip() completion = client.chat.completions.create( model=MODEL, temperature=0.1, response_format={“type”: “json_object”}, messages=[ {“role”: “system”, “content”: “You are a rigorous self-critic. Respond in JSON only.”}, {“role”: “user”, “content”: critique_prompt}, ], ) ev = json.loads(completion.choices[0].message.content) response.confidence = float(ev.get(“revised_confidence”, response.confidence)) response.answer = ev.get(“revised_answer”, response.answer) response.reasoning += f”nn[Self-Eval Critique]: {ev.get(‘critique’, ”)}” return response def web_search(query: str, max_results: int = 5) -> list[dict]: results = DDGS().text(query, max_results=max_results) return list(results) if results else [] def research_and_synthesize(response: LLMResponse) -> LLMResponse: console.print(f” [yellow] Confidence {response.confidence:.0%} is low — triggering auto-research…[/yellow]”) snippets = web_search(response.question) if not snippets: console.print(” [red]No search results found.[/red]”) return response formatted = “nn”.join( f”[{i+1}] {s.get(‘title’,”)}n{s.get(‘body’,”)}nURL: {s.get(‘href’,”)}” for i, s in enumerate(snippets) ) synthesis_prompt = f””” Question: {response.question} Preliminary answer (low confidence): {response.answer} Web search snippets: {formatted} Synthesize an improved answer using the evidence above. “””.strip() completion = client.chat.completions.create( model=MODEL, temperature=0.2, response_format={“type”: “json_object”}, messages=[ {“role”: “system”, “content”: SYSTEM_SYNTHESIS}, {“role”: “user”, “content”: synthesis_prompt}, ], ) syn = json.loads(completion.choices[0].message.content) response.answer = syn.get(“answer”, response.answer) response.confidence = float(syn.get(“confidence”, response.confidence)) response.reasoning += f”nn[Post-Research]: {syn.get(‘reasoning’, ”)}” response.sources = [s.get(“href”, “”) for s in snippets if s.get(“href”)] response.researched = True return response We implement a self-evaluation stage in which the model critiques its own answer and revises its confidence as needed. We also introduce the web search capability that retrieves live information using DuckDuckGo. If the model’s confidence is low, we synthesize the search results with the preliminary answer to produce an improved response grounded in external evidence. Copy CodeCopiedUse a different Browser def self_evaluate(response: LLMResponse) -> LLMResponse: critique_prompt = f””” Review this answer and its stated confidence. Check for: 1. Logical consistency 2. Whether the confidence matches the actual quality of the answer 3. Any factual errors

A Coding Implementation to Build an Uncertainty-Aware LLM System with Confidence Estimation, Self-Evaluation, and Automatic Web Research 投稿を読む »

We use cookies to improve your experience and performance on our website. You can learn more at プライバシーポリシー and manage your privacy settings by clicking Settings.

Privacy Preferences

You can choose your cookie settings by turning on/off each type of cookie as you wish, except for essential cookies.

Allow All
Manage Consent Preferences
  • Always Active

Save
ja