# mLLMCelltype ![mLLMCelltype logo](reference/figures/logo.png) **Multi-LLM Consensus Framework for Cell Type Annotation in scRNA-seq Data** [![Stars](https://img.shields.io/github/stars/cafferychen777/mLLMCelltype?style=social)](https://github.com/cafferychen777/mLLMCelltype/stargazers) [![Forks](https://img.shields.io/github/forks/cafferychen777/mLLMCelltype?style=social)](https://github.com/cafferychen777/mLLMCelltype/network/members) [![Discord](https://img.shields.io/badge/Discord-Join%20Chat-7289da?logo=discord&logoColor=white)](https://discord.gg/pb2aZdG4) ![License](https://img.shields.io/github/license/cafferychen777/mLLMCelltype)![Last Commit](https://img.shields.io/github/last-commit/cafferychen777/mLLMCelltype)![Issues](https://img.shields.io/github/issues/cafferychen777/mLLMCelltype)![Release](https://img.shields.io/github/v/release/cafferychen777/mLLMCelltype)[![Communications Biology](https://img.shields.io/badge/Communications%20Biology-10.1038%2Fs42003--026--10420--8-blue)](https://doi.org/10.1038/s42003-026-10420-8) ## Multi-LLM Consensus Architecture for Cell Type Annotation in scRNA-seq Data mLLMCelltype is an R package that leverages various large language models (LLMs) for automated cell type annotation in single-cell RNA sequencing data. The package implements a **multi-LLM consensus architecture** where multiple LLMs collaborate through structured deliberation that aims to improve annotation reliability by combining multiple model predictions. The mLLMCelltype paper was published online in *Communications Biology* on June 8, 2026. ### Key Features - **Multi-LLM Consensus Mechanism**: Combines predictions from multiple LLMs to reduce individual model biases - **Structured Deliberation Process**: For controversial clusters, LLMs engage in collaborative discussion across multiple rounds, evaluating evidence and refining annotations together - **Uncertainty Quantification**: Explicitly quantifies annotation uncertainty through consensus proportion and Shannon entropy - **No Reference Dataset Required**: Does not rely on pre-existing reference datasets, can annotate various tissues and species - **Support for Multiple LLM Providers**: - OpenAI (GPT-5.5, GPT-5.4, GPT-5.4-mini) - Anthropic (Claude Opus 4.7, Claude Sonnet 4.6, Claude Haiku 4.5) - Google (Gemini 3.1 Pro Preview, Gemini 3 Flash Preview, Gemini 3.1 Flash-Lite) - X.AI (Grok 4.3) - DeepSeek (DeepSeek V4 Flash, DeepSeek V4 Pro) - Qwen (Qwen3.6 Plus, Qwen3.6 Flash, Qwen3.6 Max Preview) - Zhipu/Z.AI (GLM-5.1, GLM-5, GLM-5-Turbo) - MiniMax (MiniMax M2.7, MiniMax M2.7-highspeed) - Stepfun (Step 3.5 Flash, Step 3) - OpenRouter (access to Meta Llama, Mistral, Microsoft, Perplexity, Cohere, and more) - **Seurat Integration**: Can directly use Seurat’s FindAllMarkers() output as input ### Quick Start ``` r # Install the package devtools::install_github("cafferychen777/mLLMCelltype", subdir = "R") # Load the package library(mLLMCelltype) # Set API keys Sys.setenv(ANTHROPIC_API_KEY = "your-anthropic-api-key") Sys.setenv(OPENAI_API_KEY = "your-openai-api-key") Sys.setenv(GEMINI_API_KEY = "your-gemini-api-key") # Use multiple models for annotation models <- c( "claude-sonnet-4-6", "gpt-5.5", "gemini-3.1-pro-preview" ) # Run multi-model annotation results <- list() for (model in models) { provider <- get_provider(model) api_key <- switch(provider, "anthropic" = Sys.getenv("ANTHROPIC_API_KEY"), "openai" = Sys.getenv("OPENAI_API_KEY"), "gemini" = Sys.getenv("GEMINI_API_KEY")) results[[model]] <- annotate_cell_types( input = pbmc_markers, tissue_name = "human PBMC", model = model, api_key = api_key ) } # Create consensus using interactive consensus annotation api_keys <- list( anthropic = Sys.getenv("ANTHROPIC_API_KEY"), openai = Sys.getenv("OPENAI_API_KEY"), gemini = Sys.getenv("GEMINI_API_KEY") ) consensus_results <- interactive_consensus_annotation( input = pbmc_markers, tissue_name = "human PBMC", models = models, # Use the models defined above api_keys = api_keys, controversy_threshold = 0.7, entropy_threshold = 1.0, max_discussion_rounds = 3, consensus_check_model = "claude-sonnet-4-6" ) ``` ### Visualization ![mLLMCelltype Visualization](https://raw.githubusercontent.com/cafferychen777/mLLMCelltype/main/images/mLLMCelltype_visualization.png) ### Citation If you use mLLMCelltype in your research, please cite our paper: ``` bibtex @article{yang2026llmconsensus, author = {Yang, Chen and Zhang, Xianyang and Chen, Jun}, title = {Large language model consensus substantially improves the cell type annotation accuracy for scRNA-seq data}, journal = {Communications Biology}, year = {2026}, doi = {10.1038/s42003-026-10420-8}, url = {https://doi.org/10.1038/s42003-026-10420-8}, publisher = {Springer Nature} } ``` You can also cite this in plain text format: Yang, C., Zhang, X., & Chen, J. (2026). Large language model consensus substantially improves the cell type annotation accuracy for scRNA-seq data. *Communications Biology*. ### Learn More Please check our [documentation](https://cafferychen777.github.io/mLLMCelltype/articles/01-introduction.md) to learn more about mLLMCelltype. # Package index ## Core Functions Core functions for cell type annotation - [`annotate_cell_types()`](https://cafferychen777.github.io/mLLMCelltype/reference/annotate_cell_types.md) : Cell Type Annotation with Multi-LLM Framework - [`interactive_consensus_annotation()`](https://cafferychen777.github.io/mLLMCelltype/reference/interactive_consensus_annotation.md) : Interactive consensus building for cell type annotation - [`compare_model_predictions()`](https://cafferychen777.github.io/mLLMCelltype/reference/compare_model_predictions.md) : Compare predictions from different models ## API and Providers API processing functions for different LLM providers - [`get_provider()`](https://cafferychen777.github.io/mLLMCelltype/reference/get_provider.md) : Determine provider from model name - [`get_api_key()`](https://cafferychen777.github.io/mLLMCelltype/reference/get_api_key.md) : Get an API key for a model - [`register_custom_model()`](https://cafferychen777.github.io/mLLMCelltype/reference/register_custom_model.md) : Register a custom model for a provider - [`register_custom_provider()`](https://cafferychen777.github.io/mLLMCelltype/reference/register_custom_provider.md) : Register a custom LLM provider - [`list_custom_providers()`](https://cafferychen777.github.io/mLLMCelltype/reference/list_custom_providers.md) : Get list of registered custom providers - [`list_custom_models()`](https://cafferychen777.github.io/mLLMCelltype/reference/list_custom_models.md) : Get list of registered custom models ## Processor Classes LLM processor classes for different providers - [`BaseAPIProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/BaseAPIProcessor.md) : Base API Processor Class - [`AnthropicProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/AnthropicProcessor.md) : Anthropic API Processor - [`DeepSeekProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/DeepSeekProcessor.md) : DeepSeek API Processor - [`GeminiProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/GeminiProcessor.md) : Gemini API Processor - [`GrokProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/GrokProcessor.md) : Grok API Processor - [`KimiProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/KimiProcessor.md) : Kimi API Processor - [`MinimaxProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/MinimaxProcessor.md) : Minimax API Processor - [`OpenAIProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/OpenAIProcessor.md) : OpenAI API Processor - [`OpenRouterProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/OpenRouterProcessor.md) : OpenRouter API Processor - [`QwenProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/QwenProcessor.md) : Qwen API Processor - [`StepFunProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/StepFunProcessor.md) : StepFun API Processor - [`ZhipuProcessor`](https://cafferychen777.github.io/mLLMCelltype/reference/ZhipuProcessor.md) : Zhipu API Processor ## Logging and Utilities Logging system and utility functions - [`UnifiedLogger`](https://cafferychen777.github.io/mLLMCelltype/reference/UnifiedLogger.md) : Unified Logger for mLLMCelltype Package - [`configure_logger()`](https://cafferychen777.github.io/mLLMCelltype/reference/configure_logger.md) : Set global logger configuration - [`get_logger()`](https://cafferychen777.github.io/mLLMCelltype/reference/get_logger.md) : Get the global logger instance - [`log_debug()`](https://cafferychen777.github.io/mLLMCelltype/reference/logging_functions.md) [`log_info()`](https://cafferychen777.github.io/mLLMCelltype/reference/logging_functions.md) [`log_warn()`](https://cafferychen777.github.io/mLLMCelltype/reference/logging_functions.md) [`log_error()`](https://cafferychen777.github.io/mLLMCelltype/reference/logging_functions.md) : Convenience functions for logging - [`CacheManager`](https://cafferychen777.github.io/mLLMCelltype/reference/CacheManager.md) : Cache Manager Class - [`mllmcelltype_cache_dir()`](https://cafferychen777.github.io/mLLMCelltype/reference/mllmcelltype_cache_dir.md) : Get mLLMCelltype cache location - [`mllmcelltype_clear_cache()`](https://cafferychen777.github.io/mLLMCelltype/reference/mllmcelltype_clear_cache.md) : Clear mLLMCelltype cache - [`create_annotation_prompt()`](https://cafferychen777.github.io/mLLMCelltype/reference/create_annotation_prompt.md) : Create prompt for cell type annotation - [`create_reasoning_annotation_prompt()`](https://cafferychen777.github.io/mLLMCelltype/reference/create_reasoning_annotation_prompt.md) : Create reasoning-aware prompt for cell type annotation # Articles ### Methodology & Comparison - [Why Choose Consensus? The Scientific Foundation of Multi-LLM Annotation](https://cafferychen777.github.io/mLLMCelltype/articles/why-consensus.md): Overview of the consensus-based approach to cell type annotation, including its scientific basis, methodology, and trade-offs. - [Consensus vs Single-Agent: A Methodology Comparison](https://cafferychen777.github.io/mLLMCelltype/articles/vs-single-agent.md): Comparison of multi-LLM consensus and single-agent approaches for cell type annotation, covering architecture, trade-offs, and practical considerations. ### Getting Started - [Introduction to mLLMCelltype](https://cafferychen777.github.io/mLLMCelltype/articles/introduction.md): - [Installation Guide](https://cafferychen777.github.io/mLLMCelltype/articles/installation.md): - [Getting Started with mLLMCelltype](https://cafferychen777.github.io/mLLMCelltype/articles/getting-started.md): ### Usage and Features - [Usage Tutorial](https://cafferychen777.github.io/mLLMCelltype/articles/usage-tutorial.md): - [Consensus Annotation Principles](https://cafferychen777.github.io/mLLMCelltype/articles/consensus-principles.md): - [Visualization Guide](https://cafferychen777.github.io/mLLMCelltype/articles/visualization-guide.md): ### Advanced Topics - [Frequently Asked Questions](https://cafferychen777.github.io/mLLMCelltype/articles/faq.md): - [Advanced Features & Case Studies](https://cafferychen777.github.io/mLLMCelltype/articles/advanced-features.md): ### Development - [Contributing Guide](https://cafferychen777.github.io/mLLMCelltype/articles/contributing-guide.md): - [Version History & Changelog](https://cafferychen777.github.io/mLLMCelltype/articles/version-history.md):