code-generation mathematical-reasoning gsm8k tool-augmented-agents skill-library dag-reward compositional-dag typed-retrieval
Abstract
Tool-augmented language models can extend small language models with external executable skills, but scaling the tool library creates a coupled challenge: the library must evolve with the planner as new reusable subroutines emerge, while retrieval from the growing library must remain within a fixed context budget. Existing tool-use and skill-library methods typically treat tools as flat or text-indexed memories, causing prompt cost to grow with library size and obscuring the typed, compositional structure of executable code. We propose CoCoDA, a framework that co-evolves the planner and tool library through a single code-native structure: a compositional code DAG. Nodes are primitive or composite tools, edges encode invocation dependencies, and each node stores a typed signature, description, pre/post-condition specification, and worked examples. At inference time, Typed DAG Retrieval prunes candidates by symbolic signature unification, ranks survivors by descriptions, filters them by behavioral specifications, and disambiguates with examples, keeping expensive context materialization on progressively smaller candidate sets. At training time, successful trajectories are folded into validated composite tools, while the planner is updated with a DAG-induced reward that credits composites by their primitive expansion size. We provide theoretical results showing retrieval cost reduction, sublinear retrieval time, compositional advantage under the shaped reward, monotone co-evolution under conservative updates, and DAG well-formedness. Across mathematical reasoning, tabular analysis, and code task benchmarks, CoCoDA enables an 8B student to match or exceed a 32B teacher on GSM8K and MATH and consistently improves over strong tool-use and library-learning baselines.
한국어 요약
📋 한 줄 요약
**[LLM Agents / Tool Use]** 도구 사용 에이전트의 계획자와 도구 라이브러리를 단일 코드 네이티브 컴포지셔널 DAG로 공진화시키는 CoCoDA 프레임워크를 제안한다.
🎯 핵심 기여도
- 도구 라이브러리 확장 시 컨텍스트 비용이 선형 증가하는 문제를 DAG 구조로 해결
- 노드(타입 시그니처·설명·전/후조건·예제)와 엣지(호출 의존성)를 가진 컴포지셔널 코드 DAG 설계
- Typed DAG Retrieval: 시그니처 단일화 → 설명 랭킹 → 행동 명세 필터링 → 예제 명료화의 다단계 검색
- 8B 학생 모델이 GSM8K, MATH에서 32B 교사 모델 성능에 도달·초과함을 실증
💡 핵심 아이디어
도구를 평탄한 텍스트 메모리가 아니라 타입 있는 컴포지셔널 DAG로 표현하면, 검색 비용을 줄이면서 코드의 컴포지셔널 구조를 보존하고 계획자와 함께 공진화시킬 수 있다.
🔬 기술적 접근법
- **모델/방법론**: 노드 = 원시/합성 도구, 엣지 = 호출 의존성, 각 노드에 타입 시그니처/설명/전후조건/예제 저장
- **핵심 기법**: 타입 DAG 검색의 다단계 프루닝, 성공 궤적을 검증된 합성 도구로 폴딩, DAG 기반 보상(원시 확장 크기로 합성 도구에 크레딧 부여)으로 계획자 업데이트
📊 주요 결과
- 8B 학생 모델이 GSM8K와 MATH에서 32B 교사 모델 수준 또는 초과 달성
- 강력한 도구 사용·라이브러리 학습 베이스라인 대비 일관된 개선
- 검색 비용 감소, 서브리니어 검색 시간, 컴포지셔널 우위, 단조 공진화, DAG 정합성에 대한 이론적 보장
💭 의의 및 한계
**의의**: 도구 라이브러리의 확장성과 계획자 효율을 동시에 개선하는 통합 프레임워크로, 코드 네이티브 에이전트 설계의 새로운 표준을 제시할 수 있다. **한계**: 평가가 수학·표·코드 벤치마크에 집중되어 있고, 도구 사양의 자동 생성 품질에 의존한다.
🚀 실용적 활용
- 소형 LLM 에이전트의 도구 사용 성능 향상
- 기업용 자동화 시스템에서 도구 라이브러리 자동 진화
- 코드 생성 에이전트의 재사용 가능한 함수 라이브러리 구축