llm-generalization heterogeneous-graph llm-selection edge-prediction inductive-learning effect-cost-optimization task-llm-interaction graph-based-router
Abstract
The rapidly growing number and variety of Large Language Models (LLMs) present significant challenges in efficiently selecting the appropriate LLM for a given query, especially considering the trade-offs between performance and computational cost. Current LLM selection methods often struggle to generalize across new LLMs and different tasks because of their limited ability to leverage contextual interactions among tasks, queries, and LLMs, as well as their dependence on a transductive learning framework. To address these shortcomings, we introduce a novel inductive graph framework, named as GraphRouter, which fully utilizes the contextual information among tasks, queries, and LLMs to enhance the LLM selection process. GraphRouter constructs a heterogeneous graph comprising task, query, and LLM nodes, with interactions represented as edges, which efficiently captures the contextual information between the query's requirements and the LLM's capabilities. Through an innovative edge prediction mechanism, GraphRouter is able to predict attributes (the effect and cost of LLM response) of potential edges, allowing for optimized recommendations that adapt to both existing and newly introduced LLMs without requiring retraining. Comprehensive experiments across three distinct effect-cost weight scenarios have shown that GraphRouter substantially surpasses existing routers, delivering a minimum performance improvement of 12.3%. In addition, it achieves enhanced generalization across new LLMs settings and supports diverse tasks with at least a 9.5% boost in effect and a significant reduction in computational demands. This work endeavors to apply a graph-based approach for the contextual and adaptive selection of LLMs, offering insights for real-world applications. Our codes for GraphRouter is released at https://github.com/ulab-uiuc/GraphRouter.
한국어 요약
한 줄 요약
GraphRouter는 그래프 기반 인덕티브 프레임워크를 통해 LLM 선택 문제를 해결하며, 새로운 LLM에 대한 일반화 능력을 갖춘 라우터를 제안한다.
핵심 기여도
- **GraphRouter**라는 인덕티브 그래프 프레임워크를 도입하여, 기존 트랜스덕티브 라우터의 한계를 극복.
- **쿼리-LLM 간의 관계를 엣지 예측 문제로 변환**, 효과와 비용을 예측하여 최적의 LLM을 추천.
- **새로운 LLM에 대한 일반화 능력**을 갖추어, 재학습 없이도 새로운 모델을 처리 가능.
- **3가지 효과-비용 가중치 시나리오**에서 기존 라우터 대비 최소 12.3% 성능 향상.
핵심 아이디어
GraphRouter는 LLM 선택 문제를 **엣지 예측 문제**로 재구성하여, 쿼리, 태스크, LLM 간의 **문맥 정보를 그래프 구조로 포착**한다. 이는 기존 라우터가 단순히 BERT 임베딩이나 LLM 이름만을 사용하는 것과 달리, **실제 상호작용 데이터를 기반으로 학습**한다는 점에서 차별화된다. 특히, **GPT-4o를 활용해 새로운 LLM에 대한 설명 텍스트를 생성**하고, 이를 BERT로 임베딩하여 **인덕티브한 초기 임베딩을 생성**함으로써, 새로운 LLM에 대한 일반화 능력을 확보한다. 이는 기존 라우터가 새로운 LLM이 등장할 경우 **재학습이 필요하다는 한계**를 극복한다.
기술적 접근법
- **그래프 구성 요소**: 태스크 노드, 쿼리 노드, LLM 노드로 구성된 **이질적 그래프**를 사용.
- **엣지 예측**: 쿼리-LLM 간의 효과와 비용을 예측하는 **엣지 예측 메커니즘**을 도입.
- **GNN 구조**: **이질적 GNN**을 통해 다양한 노드 간 정보를 집계.
- **임베딩 생성**: GPT-4o로 생성된 LLM 설명 텍스트를 **BERT로 임베딩**하여, 새로운 LLM에 대한 정보를 인덕티브하게 처리.
- **GNN 크기 및 레이어 수 실험**: GNN 크기 32, 레이어 수 2일 때 최적의 성능을 보임 (Figure 7 참조).
주요 결과
- **3가지 효과-비용 가중치 시나리오**에서 기존 라우터 대비 **최소 12.3% 성능 향상**.
- **새로운 LLM이 포함된 테스트 데이터**에서 기존 라우터 대비 **최소 9.5% 성능 향상**.
- **재학습 없이 새로운 LLM 처리 가능**, 훈련 시간 절약.
- **GNN 크기 32, 레이어 수 2**일 때 최고 성능 달성.
의의 및 한계
GraphRouter는 LLM 선택 문제를 **그래프 기반 엣지 예측 문제로 변환**함으로써, 기존 라우터의 트랜스덕티브 학습 방식의 한계를 극복한다. 특히, **새로운 LLM에 대한 일반화 능력**을 갖추어 실시간 추천 시스템에 유용하다. 또한, **이질적 GNN을 활용한 정보 집약적 학습**은 LLM 선택 분야에서 새로운 연구 방향을 제시한다. 그러나 본 연구는 **복잡한 그래프 신호**(예: 경로, LLM 계층 구조)를 활용하지 못하는 점이 한계로, 향후 연구 주제로 제시된다.
실용적 활용
GraphRouter는 **다양한 LLM이 존재하는 클라우드 기반 서비스**, **실시간 LLM 추천 시스템**, **다중 태스크 환경**에서 유용하게 활용될 수 있다. 특히, **새로운 LLM이 빈번히 추가되는 상황**에서 재학습 없이도 일반화 가능한 추천을 제공할 수 있어, **대규모 사용자에게 효율적인 LLM 서비스를 제공하는 데 기여**할 수 있다.