RouterDC: Query-Based Router by Dual Contrastive Learning for Assembling Large Language Models

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Chen, Shuhao, Jiang, Weisen, Lin, Baijiong, Kwok, James T., Zhang, Yu
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866912050370838528
author Chen, Shuhao
Jiang, Weisen
Lin, Baijiong
Kwok, James T.
Zhang, Yu
author_facet Chen, Shuhao
Jiang, Weisen
Lin, Baijiong
Kwok, James T.
Zhang, Yu
contents Recent works show that assembling multiple off-the-shelf large language models (LLMs) can harness their complementary abilities. To achieve this, routing is a promising method, which learns a router to select the most suitable LLM for each query. However, existing routing models are ineffective when multiple LLMs perform well for a query. To address this problem, in this paper, we propose a method called query-based Router by Dual Contrastive learning (RouterDC). The RouterDC model consists of an encoder and LLM embeddings, and we propose two contrastive learning losses to train the RouterDC model. Experimental results show that RouterDC is effective in assembling LLMs and largely outperforms individual top-performing LLMs as well as existing routing methods on both in-distribution (+2.76\%) and out-of-distribution (+1.90\%) tasks. Source code is available at https://github.com/shuhao02/RouterDC.
format Preprint
id arxiv_https___arxiv_org_abs_2409_19886
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle RouterDC: Query-Based Router by Dual Contrastive Learning for Assembling Large Language Models
Chen, Shuhao
Jiang, Weisen
Lin, Baijiong
Kwok, James T.
Zhang, Yu
Machine Learning
Artificial Intelligence
Computation and Language
Recent works show that assembling multiple off-the-shelf large language models (LLMs) can harness their complementary abilities. To achieve this, routing is a promising method, which learns a router to select the most suitable LLM for each query. However, existing routing models are ineffective when multiple LLMs perform well for a query. To address this problem, in this paper, we propose a method called query-based Router by Dual Contrastive learning (RouterDC). The RouterDC model consists of an encoder and LLM embeddings, and we propose two contrastive learning losses to train the RouterDC model. Experimental results show that RouterDC is effective in assembling LLMs and largely outperforms individual top-performing LLMs as well as existing routing methods on both in-distribution (+2.76\%) and out-of-distribution (+1.90\%) tasks. Source code is available at https://github.com/shuhao02/RouterDC.
title RouterDC: Query-Based Router by Dual Contrastive Learning for Assembling Large Language Models
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2409.19886