Saved in:
Bibliographic Details
Main Authors: Wang, Xi, Isazawa, Taketomo, Mikaelyan, Liana, Hensman, James
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2410.10450
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909484784287744
author Wang, Xi
Isazawa, Taketomo
Mikaelyan, Liana
Hensman, James
author_facet Wang, Xi
Isazawa, Taketomo
Mikaelyan, Liana
Hensman, James
contents In this paper, we propose Knowledge Base augmented Language Model (KBLaM), a new method for augmenting Large Language Models (LLMs) with external knowledge. KBLaM works with a knowledge base (KB) constructed from a corpus of documents, transforming each piece of knowledge in the KB into continuous key-value vector pairs via pre-trained sentence encoders with linear adapters and integrating them into pre-trained LLMs via a specialized rectangular attention mechanism. Unlike Retrieval-Augmented Generation, KBLaM eliminates external retrieval modules, and unlike in-context learning, its computational overhead scales linearly with KB size rather than quadratically. Our approach enables integrating a large KB of more than 10K triples into an 8B pre-trained LLM of only 8K context window on one single A100 80GB GPU and allows for dynamic updates without model fine-tuning or retraining. Experiments demonstrate KBLaM's effectiveness in various tasks, including question-answering and open-ended reasoning, while providing interpretable insights into its use of the augmented knowledge. Code and datasets are available at https://github.com/microsoft/KBLaM/
format Preprint
id arxiv_https___arxiv_org_abs_2410_10450
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle KBLaM: Knowledge Base augmented Language Model
Wang, Xi
Isazawa, Taketomo
Mikaelyan, Liana
Hensman, James
Artificial Intelligence
Computation and Language
In this paper, we propose Knowledge Base augmented Language Model (KBLaM), a new method for augmenting Large Language Models (LLMs) with external knowledge. KBLaM works with a knowledge base (KB) constructed from a corpus of documents, transforming each piece of knowledge in the KB into continuous key-value vector pairs via pre-trained sentence encoders with linear adapters and integrating them into pre-trained LLMs via a specialized rectangular attention mechanism. Unlike Retrieval-Augmented Generation, KBLaM eliminates external retrieval modules, and unlike in-context learning, its computational overhead scales linearly with KB size rather than quadratically. Our approach enables integrating a large KB of more than 10K triples into an 8B pre-trained LLM of only 8K context window on one single A100 80GB GPU and allows for dynamic updates without model fine-tuning or retraining. Experiments demonstrate KBLaM's effectiveness in various tasks, including question-answering and open-ended reasoning, while providing interpretable insights into its use of the augmented knowledge. Code and datasets are available at https://github.com/microsoft/KBLaM/
title KBLaM: Knowledge Base augmented Language Model
topic Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2410.10450