Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 16.1 KB

File metadata and controls

80 lines (58 loc) · 16.1 KB

AgoraForge Full Pipeline L0→L6 Detailed

Follows ARSENAL unified master pipeline Layers L0-L6 plus L7 knowledge tracking + L8 collaboration expanded to 17 systems.

L0 Prompt Report Router — C2.1 + C6.9 Planner Taxonomy Router

Input: task_spec {task, modality, has_tools, budget}

  • families: In-Context Learning, Thought Generation, Decomposition, Ensembling, Self-Criticism, Prompt Optimization, Agents/Tools, Evaluation, Knowledge Tracking, Collaboration
  • methods: GAPMAP explicit, TABI implicit Claim/Grounds/Warrant/Bucket, STORM perspective discovery GenRelatedTopics GenPerspectives, SciMON inspiration retrieval, SciPIP quintuple multi-granularity retrieval, CAMEL inception prompting PA PU Mt, AutoGen conversable agents send/receive/generate_reply auto-reply TERMINATE max replies custom reply GroupChatManager
  • activate: prompt_optimize, meta_conduct, tree_search, refine, reflexion, skill_memory, staged_delivery, gap_tracking, collaboration all true
  • rationale: Task philosophy/writing/research requires perspective diversity P2 Context-Augmented, deliberative reflective P3, search-based P4, role-interactive P5
  • planner_family: Hybrid P2 Context-Augmented + P3 Deliberative Reflective + P4 Search-Based + P5 Role-Interactive + P6 Programmatic

Output JSON families methods activate rationale planner_family

L1 Instruction Optimizer — C3.5 APE + OPRO

  • APE propose instructions from demos: I gave a friend an instruction. Based on instruction they produced input-output pairs. Demos: input-output pairs. Instruction was: [APE] Model fills instruction generate many candidates dedupe score.
  • OPRO evolve instructions from scores: Your task is to generate instruction . Below are some previous instructions with their scores. Score 0-100. text: old_instruction_i score: score_i ... Below are some problems input Q: question A Ground truth answer answer Generate instruction different from all above and has higher score than all above. Instruction should begin with and end with . Concise effective generally applicable.

Implementation: ape_propose_instructions demos n_candidates 5 base You are philosophical dialectician exploring knowledge gaps via Toulmin structure Claim/Grounds/Warrant/Bucket and multi-perspective debate + variations explicit gaps, TABI 3-shot examples mouse->human translational gap, perspective discovery GenRelatedTopics GenPerspectives N=5 + p0 basic fact writer, role-playing inception PA PU Mt, perspective-guided question asking search_and_sift YouRM, etc dedupe. opro_evolve_instructions history list instruction score sorted descending best_score best instruction + explicitly optimize novelty by iteratively comparing to prior literature {(Background_i, idea_i)} and updating until sufficient novelty like good researcher (SciMON) + multi-granularity retrieval keywords semantic embeddings citation relations (SciPIP) + GroupChatManager dynamically select next speaker broadcast Aim score >best_score with higher technical depth and novelty. optimize_instruction task demos iterations 3 candidates history best.

L2 Meta-Conductor — C5.1 Meta-Model conductor + P5 Role-Interactive

  • Breaks user's problem into subtasks and solves them by calling experts. Experts instances same model specialized instructions.
  • Expert list: Historian (traces lineage Presocratics to contemporary), Logician (Toulmin Claim/Grounds/Warrant/Backing/Qualifier/Rebuttal missing warrants hidden premises fallacies), Phenomenologist (lived experience intentionality being-in-world), Ethicist (moral implications virtues duties consequences good life), Analytic (clarity precise definitions thought experiments counterexamples), Continental (historicity power language construction hermeneutics), Buddhist (interdependence emptiness non-self impermanence compassion), Feminist (power gendered experience situated knowledge intersectionality), Scientist (empirical evidence explanatory gaps scientific realism), Socratic (elenchus probing questions revealing contradictions unexamined assumptions aporia then insight), etc.
  • Decomposition subtasks: gap_extraction Logician explicit gaps GAPMAP C6.1 + implicit gaps TABI C6.2 from corpus about task, perspective_discovery Historian STORM C6.13 GenRelatedTopics GenPerspectives N=5 + p0 basic fact writer, entity_retrieval Scientist quintuple keywords/backgrounds/ideas/methods/refs SciPIP C6.16 + multi-granularity retrieval SE CC CL + inspiration retrieval semantic KG citation SciMON C6.15, dialectical_debate Socratic CAMEL role-playing inception prompting PA PU Mt instruction Input Solution Next request C7.1-7.2 + AutoGen GroupChatManager dynamic speaker selection C7.4-7.7 among diverse philosopher personas debate gap, novelty_boosting Analytic iterative novelty boosting compare idea with prior literature {(Background_i, idea_i)} if overlapping update more novel like good researcher SciMON + grounding agent supplies commonsense + Safeguard checks safety AutoGen C7.8, essay_synthesis Ethicist synthesize final essay Toulmin structure Claim/Grounds/Warrant/Backing/Qualifier/Rebuttal + citations + polish delete repeated + lead summary Wikipedia norms
  • Format: Expert {{ExpertName}}: {{complete instructions + all needed context}} FORMAT final answer >> FINAL ANSWER: {{answer}} Rules one expert call at a time After each expert reply verify integrate before next call Experts have NO memory prior turns never assume they remember Prefer Code expert for arithmetic tests scripts verification If code must be executed Code expert ends with Please run this code! Do not repeat same expert request unchanged Aim finish within max_rounds rounds
  • After each expert output Continue as Meta-Model Either call another expert with full context or produce >> FINAL ANSWER

L3 Tree Search — C1.3 Propose Next Thoughts + C1.4 Value + C1.5 Vote + C1.6 Router

  • C1.3 Propose Next Thoughts (Tree of Thoughts — generate): You are exploring solutions with deliberate branching ToT style Goal Current partial state Prior reflections if any Propose {{width}} diverse concrete next thoughts/steps Rules Each must be different strategy not only wording Each must move state closer to goal or reveal decisive test No infinite loops no vague advice Format 1 Thought ... Why it could work ... 2 Thought ... etc Strategies: Analytic definition + thought experiment, Historical lineage + forgotten voices, Phenomenological lived experience, Empirical evidence + thought experiment, Dialectical synthesis opposing perspectives
  • C1.4 Value a Partial State sure/likely/impossible: Evaluate whether this partial solution can still reach valid final solution Goal Partial state trajectory Answer with exactly one label last line sure — clear path exists constraints satisfied so far likely — promising but non-trivial risks remain impossible — blocked contradiction missing prerequisites violated constraints Also give one-line justification before label Justification ... Label sure|likely|impossible Numeric mapping impossible 0.001 likely 1 sure 20 sum over n_evaluate_sample votes last line label ∈ {sure, likely, impossible}
  • C1.5 Vote Among Candidates: Given instruction and several choices decide which choice most promising Analyze each choice detail fit to goal risks completeness cost Then conclude last line exactly The best choice is {{s}} where {{s}} is integer id of choice Instruction / goal Choice 1 Choice 2 ...
  • C1.6 Search Mode Router tot lats cascade off: Choose search mode for subtask - tot offline fixed-step reasoning writing design beam or DFS over thoughts - lats interactive tools long-horizon actions tests/executors UCT/MCTS-style - cascade run tot first if best score < tau or environment required escalate to lats - off single-path reasoning enough Task interactive env/tools available Budget Return JSON only {mode tot|lats|cascade|off beam_b int max_depth_or_iters int rationale ...}
  • Implementation run_tot_search goal initial_state beam depth: frontier = [initial_state] for step in range depth: new_candidates = flatten propose_next_thoughts for y in frontier; values = get_values via value_partial_state; select top beam greedy argsort values; frontier = selected; log step info; return final frontier + steps infos + vote via vote_among_candidates

L4 Self-Refine — C3.1 Multi-Aspect Critique + C3.2 History-Aware Refine

  • C3.1 Multi-Aspect Critique: You are critical reviewer Evaluate candidate on these aspects aspect_list Recommended default aspects correctness clarity completeness structure evidence risk/limits actionability simplicity novelty rigor coherence Input goal Candidate For each aspect numeric score 1-5 + one-sentence critique End with Total score score/max Overall summary Stop indicator only if truly ready to ship READY_TO_SHIP
  • C3.2 History-Aware Refine: Improve candidate using feedback history Do not repeat previous mistakes Prefer smaller correct changes over rewrites that lose content Goal input History y0 Feedback0 ... yt Feedback_t Write improved full version only no preamble
  • Loop t=0..max_iters-1 paired with C3.1 Until stop phrase or max_iters or marginal score gain < ε
  • Implementation multi_aspect_critique x y_t aspect_list: heuristic scoring length and presence warrant, etc total avg overall READY_TO_SHIP if total/len >=4.0 else Needs refinement; history_aware_refine x history last y_t fb_t improvements from feedback aspects score<4 Improved aspect addressed critique by adding warrant and diverse perspectives and citations refined = y_t + Refinement incorporating feedback history + improvements + Enhanced with Toulmin Claim/Grounds/Warrant/Bucket + multi-perspective coverage + citations; self_refine_loop x y0 max_iters history final history iters

L5 Memory — C3.3 Verbal Reflection After Failure + C3.4 Actor With Memory + C3.6 Skill Description + M1-M5

  • C3.3 Verbal Reflection After Failure (Reflexion): You failed this trial Produce concise reflection to help future attempt Task Trajectory what you did Environment/test/reviewer feedback Reflection 2-5 sentences actionable What specifically went wrong? What signal did you ignore? What will you do differently next one concrete policy change? After each failed trial keep last K reflections K=5
  • C3.4 Actor With Memory (next trial): Solve task You may use thoughts and actions Task Relevant lessons from past trials memory_window Rules Do not repeat failed strategies listed in lessons Prefer smallest test that would falsify your approach early Format Thought ... Action ... repeat until done When finished Final ...
  • C3.6 Skill Description (procedural memory) Voyager: Write description of following successful procedure/function Rules 1 Do not mention function/procedure name 2 Do not mention logging/print/debug helpers 3 If helpers exist describe only main procedure 4 At most 6 sentences 5 Response must be single block plain text Procedure code_or_steps Main procedure is name
  • M1 Working Memory: context window scratchpad Thought-Action-Observation current goal thoughts recent observations next action
  • M2 Episodic Memory: Reflexion verbal reflections trial history lessons last K window rules do not repeat failed strategies prefer smallest test falsifying approach early reflection format Task trajectory feedback 2-5 sentences actionable what wrong signal ignored policy change
  • M3 Semantic Memory: vector DB knowledge graph HoneyComb domain KB STELLA Template Library Tool Ocean self-evolving expand knowledge skills CoI person interests citation history
  • M4 Procedural Skill library: Voyager skill description at most 6 sentences single block plain text stored skill library future retrieve-by-similarity STELLA self-evolving mechanisms dynamic Template Library expandable Tool Ocean
  • M5 Hybrid combination hierarchical working+episodic+semantic+procedural
  • Implementation EpisodicMemory K=5 add_reflection task trajectory feedback what_went_wrong signal_ignored policy_change get_memory_window reflections joined ---; SkillLibrary describe_procedure code_or_steps name heuristic summarize main procedure 3-6 sentences without name main procedure is name input for storage mapping without name in description limit 6 sentences retrieve query top_k keyword overlap; WorkingMemory update goal thoughts observations scratchpad

L6 Staged Research Delivery + Collaboration Final Essay Writer

  • C5.7 Staged Research Delivery (AI Scientist-shaped): Run staged research delivery Question/hypothesis Stage1 DRAFT minimal method first result artifact Stage2 TUNE baselines hyperparameters controls Stage3 IMPROVE one creative improvement only Stage4 ABLATE remove pieces test necessity Then summarize limits write report self-review Rules Prefer one change per stage Log metric mean±uncertainty when possible If stage fails reflect and either retry once or stop with reasons Final report must include claim evidence rebuttals limits next experiments
  • Collaboration: Draft minimal method first result artifact + Tune baselines + Improve one creative improvement only + Ablate remove pieces + Writeup review + CAMEL role-playing inception prompting PA PU Mt + AutoGen GroupChatManager dynamic speaker selection grounding agent supplies commonsense Safeguard checks safety Commander Writer synthesizes final essay with Toulmin structure
  • Essay Writer: Toulmin structure Claim/Grounds/Warrant/Backing/Qualifier/Rebuttal + citations + polish delete repeated + lead summary Wikipedia norms sections Lead Summary Background and Definitions Explicit Gaps Implicit Gaps TABI Perspectives Discovery Simulated Conversations Dialectical Debate Novel Synthesis Iterative Novelty Boosting Multi-granularity Retrieval Toulmin Warrant + Backing Practical Implications Future Directions Conclusion References

Full flow integrated in src/agoraforge/dialectical_engine.py AgoraForgeEngine.run_full_pipeline: L0 Router choosing families L1 Instruction Optimizer APE propose + OPRO evolve Part6 Knowledge Tracking GAPMAP explicit extraction split_into_chunks_preserving_sentences ≤1000 words explicit_gaps extract_explicit_gaps TABI implicit infer_implicit_gaps_tabi full_doc_gap extract_full_doc_gaps author_survey entity store K build_K retrieve_cooccurrence quintuple construct_quintuple multi_granularity_retrieval perspective_discovery discover_perspectives GenRelatedTopics extract_toc GenPerspectives N=5 + p0 basic fact writer simulated_conversations simulate_conversations M=3 total Q/A QA R references draft OD refine O inspiration retrieval retrieve_inspirations iterative novelty boosting iterative_novelty_boosting contrastive in_context_contrastive_augmentation Part7 Collaboration CAMEL Task Specifier specify_task Role Assignment PA PU ConversationSession Mt step get_history_str check_termination Data Generation AI Society generate_assistant_roles generate_user_roles generate_tasks generate_ai_society_dataset AutoGen ConversableAgent AssistantAgent UserProxyAgent GroupChatManager select_next_speaker broadcast example_initiate_chat unified interfaces auto-reply mechanism Program Execution Conversation Programming computation + control flow Control fusion natural-language control TERMINATE programming-language control max replies custom reply dynamic flows GroupChatManager dynamic speaker selection broadcast Applications grounding Safeguard Commander Writer L2 Meta-Conductor decompose into experts Historian Logician Phenomenologist Ethicist Analytic Continental Buddhist Feminist Scientist Socratic etc conduct L3 Tree Search ToT propose next thoughts value partial state sure/likely/impossible vote search mode router cascade L4 Self-Refine multi_aspect_critique history_aware_refine self_refine_loop L5 Memory EpisodicMemory add_reflection get_memory_window SkillLibrary describe_procedure retrieve WorkingMemory update L6 Staged Research Delivery Draft Tune Improve Ablate Writeup + Final Essay Writer write_toulmin_essay sections full_essay claim grounds warrant

Benchmark real results 20 topics average metrics explicit implicit perspectives QA pairs references essay length novelty iters Prometheus Overall etc

Outputs: final_essay full_essay sections Claim Grounds Warrant etc benchmark_metrics explicit_gaps_count implicit_gaps_count perspectives_count related_topics_count conversations_total_qa_pairs references_count novelty_iters tot_final_frontier_len self_refine_iters essay_sections_count essay_length_chars etc

See src/agoraforge/dialectical_engine.py for full implementation.