KnowSelf: Agentic Knowledgeable Self-awareness

Authors: Shuofei Qiao et al. (2024)

Goal

Build an LLM-based agent that can recognize what kind of thinking is needed, reason better with self-awareness, and use memory, reflection, and learning from mistakes.

1. Agent Design: Modular Thinking System

ModeDefinitionImplementation
Fast Thinking (FT)Intuitive, immediate responseDirect LLM generation
Slow Thinking (ST)Deliberative, multi-step reasoningChain-of-Thought, self-consistency
Knowledgeable Thinking (KT)Reasoning supported by memoryRetrieve + Reason

2. Meta-Cognition Module

A learned controller πmeta decides which cognitive strategy to use given a current situation ht.

πmeta(ht) → {FT, ST, KT}

3. Two-Stage Training Process

Stage 1: Supervised Fine-Tuning (SFT)

LSFT = -E(ht, y) ~ Dself log πθ(y | ht)

Stage 2: Learning Self-Awareness via Offline DPO

Step 1: Build Dpair from self-exploration

Step 2: DPO Loss

LDPO = -E(ht, y, yp) ~ Dpair 
[ log ( πθ(y | ht) / πθ(yp | ht) ) *
  ( β log πref(y | ht) - β log πref(yp | ht) ) ]

Step 3: Add Normalized NLL

LNLL = -E(ht, y) ~ Dpair (1 / |y|) log πθ(y | ht)

Final Loss

LRPO = LDPO + α LNLL

4. Memory and Reflection Integration

KT mode uses vector search over episodic memory and integrates retrieved content into prompt.

5. Empirical Evaluation

Environments

Key Results

ModelALFWorld SuccessScienceWorld AccuracyReflection
Base LLM54.1%63.4%No
CoT + Reflection58.9%67.0%Moderate
KnowSelf64.6%71.9%Strong
Ablation (no KT)-10%-8%Weak

Contributions