CoolFace
Apppublic

s1nn3rx69/recall

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes
App README

๐Ÿง  RECALL โ€” Memory-Constrained Long-Horizon Memory

RECALL is an OpenEnv reinforcement learning environment where the agent learns to manage its own memory under budget constraints. Given a stream of facts (experiment logs, papers, decisions, debug notes), the agent must decide what to store, craft retrieval anchors, and answer future queries from memory.

Key insight: RECALL trains the write-side of memory management โ€” complementary to read-side approaches like RLM.

What This Is

A PhD student runs transformer experiments over 3 weeks. Facts arrive as a batch: experiment results, paper insights, design decisions, debugging notes, and irrelevant distractions. The agent must:

  1. 1.Decide which facts to store (skip distractors, prioritize queryable items)
  2. 2.Author anchors โ€” short phrases the agent writes to enable future retrieval
  3. 3.Retrieve from memory using authored anchors
  4. 4.Answer queries about stored information โ€” or say "UNKNOWN" if the fact was skipped

Quick Start

python
from envs.recall_env import RecallEnv, RecallAction
from envs.recall_env.models import FactDecision

async with RecallEnv.from_env("openenv/recall-env") as env:
    obs = await env.reset(difficulty=1, seed=42)

    # Phase 1: Ingestion โ€” all facts at once
    if obs.phase == "ingest":
        decisions = [
            FactDecision(fact_id=f["fact_id"], decision="store", anchor=f["text"][:30])
            for f in obs.all_facts
        ]
        result = await env.step(RecallAction(mode="ingest", decisions=decisions))
        obs = result.observation

    # Phase 2: Query loop
    while obs.phase == "query":
        # Retrieve
        result = await env.step(RecallAction(mode="retrieve", query=obs.current_query))
        obs = result.observation

        # Answer
        answer = obs.retrieval_results[0]["content"] if obs.retrieval_results else "UNKNOWN"
        result = await env.step(RecallAction(mode="answer", answer_text=answer))
        obs = result.observation

Action Space

FieldTypeDescription
mode`"ingest" \"retrieve" \"answer"`Action type
decisionsList[FactDecision]Storage decisions (ingest mode only)
querystrSearch query (retrieve mode only)
answer_textstrAnswer or "UNKNOWN" (answer mode only)

Observation Space

FieldTypeDescription
phase`"ingest" \"query" \"done"`Current episode phase
all_factsList[Dict]Full fact list (ingest phase only)
current_querystrActive query (query phase only)
retrieval_resultsList[Dict]Top-k memory matches
memory_anchorsList[str]Current stored anchors
memory_used / memory_budgetintBudget status
queries_remainingintQueries left in episode
last_rewardfloatReward from previous step

Reward Design

Two-phase system for GRPO stability:

  • โ€”Phase 1 (Bootstrap): Dense shaping at L1/L2 โ€” correctness + storage/retrieval bonuses + malformed penalties
  • โ€”Phase 2 (Binary): Agent accuracy vs FIFO baseline accuracy
  • โ€”Agent > baseline + 5pp โ†’ reward = +1.0
  • โ€”Agent > baseline โ†’ reward = +0.3
  • โ€”Agent โ‰ค baseline โ†’ reward = 0.0

Curriculum

LevelFactsBudgetChallengeBootstrap
L1108Action grammar, [IMPORTANT] tags100 steps
L22520Distractor filtering (30%)200 steps
L35025Anchor authoring, lexical mismatchNone
L48030Contradictions, correctionsNone
L512040Adversarial tags, deceptive distractorsNone

Data Domain

Facts are generated from Haiku-created vocabularies covering:

  • โ€”Architectures (80 items): transformers, MoE, diffusion, SSM, hybrid, vision, RNN
  • โ€”Hyperparameters (40 items): LR, WD, dropout, batch size, etc.
  • โ€”Metrics (30 items): accuracy, loss, perplexity, throughput, etc.
  • โ€”Papers (60 items): research insights across architecture, training, efficiency
  • โ€”Decisions (30 items): architecture and training design choices
  • โ€”Debug Findings (50 items): training bugs with symptoms/causes/fixes
  • โ€”Distractors (40 items): lab life, scheduling, personal, admin

References

  • โ€”OpenEnv Framework
  • โ€”RLM (Recursive Language Models) โ€” read-side memory management
  • โ€”MemGPT, GraphRAG, Generative Agents โ€” related memory systems