microsoft

KBLaM: Augment LLMs with Knowledge Bases

KBLaM is Microsoft's research method for augmenting transformer LLMs with external knowledge, using trained adapters to convert a knowledge base into special tokens. It avoids a separate retrieval module and is intended for research, not production use.

MaintainedJupyter NotebookMITPythonAILLM
Stars
1.4k
Forks
127
Stars, last 30 days
+1
Last commit
1 month ago
Contributors
11

Our take

Maintaineda few commits in the last 90 days

Health score

38/100

How it is scored
Activity
28
Community
61
Issues
21
Pull requests
43

+1 stars in the last 30 days

KBLaM is a focused research implementation with an active but low recent commit and release cadence, suitable for experimentation rather than production deployment.

Good fit if

  • You are investigating knowledge-base augmentation for transformer LLMs and can work with the supported Llama or Phi-3 models.
  • You want to reproduce or adapt the paper's experiments, and can provide the required data and embedding setup.
  • You are comfortable with a Python project under the MIT license and a research system whose authors document limitations.

Look elsewhere if

  • You need a production-ready knowledge-answering system: the authors explicitly caution that answers may be incomplete or incorrect when the deployed knowledge base differs from training data.
  • You need a broad range of supported models without building a new model adapter.
  • You need frequent releases or rapid issue resolution; the project has had no release in the past year and no issues closed in the last 90 days.
All health signals
Last commit2026-09-14 (1 month ago)
Commits, last 90 days1
Releases, last 12 months0
Contributors11 (top contributor: 31% of commits)
Issues closed, last 90 days0
Pull requests merged, last 90 days1
Project age2 years

Checked on 2026-10-18 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

1,451

Forks

128

Change since Nov 16, 2026: 0 stars·0 forks

Overview

KBLaM is Microsoft's Knowledge Base Augmented Language Model, a research method for adding external knowledge to transformer-based LLMs. It trains adapters to turn knowledge-base content into special knowledge tokens that the base model can attend to, avoiding a separate retrieval module and leaving the base model's handling of ordinary text unchanged.

The project provides an implementation for Meta Llama 3 8B Instruct, Llama 3.2 1B Instruct, and Microsoft Phi-3 mini. Its authors describe it as a research system for grounded question answering, not a complete production-ready application. See the paper and GitHub repository.

Key Features

  • Converts knowledge-base entries into special tokens through trained adapters.
  • Answers questions by attending over the supplied knowledge base, without an external retrieval module.
  • Keeps the base LLM unmodified for ordinary text input; without a knowledge base, it behaves like the base model.
  • Supports Meta Llama 3 8B Instruct, Llama 3.2 1B Instruct, and Microsoft Phi-3 mini.
  • Includes scripts for synthetic knowledge-base and question-answer dataset construction.
  • Generates knowledge-base embeddings with OpenAI text-embedding-ada-002 or Sentence Transformers all-MiniLM-L6-v2.
  • Provides experiment scripts and a training entry point, including an option to reuse cached embeddings.

Use Cases

  • Researchers comparing knowledge augmentation approaches with retrieval-augmented generation or in-context learning.
  • Teams studying grounded question answering over a fixed knowledge base, where answers should draw on supplied facts.
  • Model researchers adapting the approach to a supported Llama or Phi-3 model, or implementing an adapter for another model type.
  • Experimenters reproducing the paper's training and evaluation workflows using synthetic knowledge-base data.

What you need

Detected in the repository

  • Python >=3.10 (from pyproject.toml)
  • A test suite and automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install the package from a clone of the repository:

pip install -e .

For Llama models, authenticate with Hugging Face. See the README for model setup, dataset preparation, and experiment commands.

Alternatives

  • rag-web-ui: RAG Web UI answers questions by retrieving relevant document chunks, while KBLaM encodes knowledge into special tokens using trained adapters.
  • Article-Assistant--RAG-Telegram-Bot: Article Assistant builds searchable knowledge bases from articles and files and retrieves cited sources, while KBLaM uses trained adapters to encode knowledge.
ProjectLanguageLicenseStarsStatus
KBLaMJupyter NotebookMIT1.4kMaintained
rag-web-uiTypeScriptApache-2.03.3kQuiet
Article-Assistant--RAG-Telegram-BotPythonMIT54Inactive

Considerations

  • The README describes KBLaM as a research project, not a complete production system. With knowledge bases unlike those used in training, it can give incomplete, reworded, or incorrect answers.
  • The implementation supports three named model variants. Adding another model type requires adapting the model-processing code.
  • The project uses Python 3.10 or newer. Synthetic dataset construction requires a valid Azure OpenAI endpoint; generating embeddings may also involve an OpenAI API, depending on the selected embedding model.
  • The measured health status is Maintained, with a few commits and one merged pull request in the last 90 days, but no releases in the last year and no issues closed in that period. The project has 11 contributors, with contributions not concentrated in a single person.
  • The repository uses the MIT license. Contributions may require agreement to Microsoft's Contributor License Agreement, as described in the README.

Found this useful?

Share it with someone who would like KBLaM.

Comparisons