This repository implements the Multi-modal Cognitive Fusion Framework (MCFF) under the name TabPFN-MCFF, aligned with the bundled Zenodo software release. TabPFN v2 is included as the tabular inference backend.
Built with TabPFN
This repository incorporates TabPFN v2 source code. The TabPFN attribution notice and license are preserved in LICENSE-TabPFN and TabPFN/LICENSE.
The Multi-modal Cognitive Fusion Framework (MCFF) proposes a framework for materials discovery by activating the implicit knowledge within Large Language Models (LLMs) and fusing it with the data-efficiency of few-shot learners. This framework is engineered to overcome data scarcity challenges in computational catalysis, delivering high-fidelity performance predictions from minimal experimental data.This repository provides a reference implementation using TabPFN as the tabular foundation model.
- π§ Cognitive Knowledge Activation: Systematically extracts and structures domain-specific chemical knowledge from LLMs, transforming them from generalists into catalysis experts.
- π― Few-Shot Learning Core: Utilizes a customized TabPFN model to learn complex structure-performance relationships from as few as 5-10 experimental data points.
- π οΈ Advanced Analytics & Explainability: Implements advanced methodologies like Complementary Residual Analysis (CRA) and Feature Sensitivity Asymmetry (FSA) to diagnose model synergies and provide deep, chemically-intuitive explanations for its predictions.
- Python 3.9+
- For detailed dependencies, see
requirements.txt. A fully configured environment is essential for reproducible results.
We recommend using a dedicated virtual environment.
# 1. Create and activate a virtual environment (optional but recommended)
# python -m venv venv
# source venv/bin/activate # On Windows use `venv\Scripts\activate`
# 2. Install dependencies
pip install -r requirements.txtFor any installation issues, please refer to the Performance and Troubleshooting section.
Correct environment configuration is critical for the framework's performance and stability.
The framework is designed to run with locally-deployed open-source LLMs for full reproducibility. The MCFF_LLM_BACKEND environment variable controls backend selection.
Option A: vLLM (Recommended for Reproducing Paper Results)
vLLM provides high-throughput serving with tensor parallelism, required for the full DeepSeek V4 Pro model (1.6T MoE, 49B active parameters).
# 1. Install vLLM
pip install vllm>=0.6.3
# 2. Download model weights from HuggingFace
huggingface-cli download deepseek-ai/DeepSeek-V4-Pro
# 3. Launch vLLM server (requires 4Γ A100 80GB or equivalent)
vllm serve deepseek-ai/DeepSeek-V4-Pro \
--tensor-parallel-size 4 \
--max-model-len 32768 \
--gpu-memory-utilization 0.92 \
--dtype bfloat16 \
--trust-remote-code \
--port 8000
# 4. Configure environment
export MCFF_LLM_BACKEND=vllm
export VLLM_MODEL_NAME=deepseek-ai/DeepSeek-V4-Pro
export VLLM_API_BASE=http://localhost:8000/v1
export VLLM_TENSOR_PARALLEL_SIZE=4Option B: Ollama (Quick Testing with Smaller Quantized Models)
Suitable for development and quick validation.
# 1. Install Ollama (https://ollama.com)
# 2. Pull a compatible model
ollama pull deepseek-v4-pro
# 3. Configure environment
export MCFF_LLM_BACKEND=ollama
export OLLAMA_HOST=127.0.0.1
export OLLAMA_PORT=11434
export OLLAMA_MODEL_NAME=deepseek-v4-proFor users without local GPU resources, cloud API endpoints are supported but not recommended for reproducibility due to API versioning and rate limits.
export MCFF_LLM_BACKEND=openai
export OPENAI_API_KEY="your-api-key-here"
export OPENAI_API_BASE="https://api.openai.com/v1"
export OPENAI_MODEL_NAME="gpt-4o"These settings allow the framework to calibrate its performance based on the execution environment.
# Set to 'production' for optimized, non-interactive execution
export MCFF_EXECUTION_MODE="production"
# Set to 'optimized' for containerized environments to bypass certain hardware checks
export MCFF_ENV="optimized"MCFF is controlled via the main.py script. Place your experimental data in data/input_data.xlsx.
from main import run_prediction
# Run catalyst performance prediction on the default input file
# The `scr_type` argument adapts the framework's knowledge context
run_prediction(
input_file_path="data/input_data.xlsx",
output_dir="results/",
scr_type="Methanol-SCR"
)Leverage Uncertainty-Guided Bayesian Optimization (UGBO) to discover new, high-performance catalysts.
from main import run_optimization
# Perform single-objective optimization
run_optimization(
input_file_path="data/input_data.xlsx",
output_dir="optimization_results/",
scr_type="Methanol-SCR"
)To ensure a fully consistent and optimized environment, we provide a Docker container hosted on GitHub Container Registry (GHCR). This is the recommended method for reproducing our results as it encapsulates the exact software environment, including system libraries and package versions.
Prerequisites:
- Docker installed on your system.
- NVIDIA GPU with appropriate drivers and NVIDIA Container Toolkit for GPU support.
Steps (for Windows CMD/PowerShell) BD0 :
-
Authenticate to GHCR: A Personal Access Token (PAT) with
read:packagesscope is required. For reviewers, the access token is shared privately through the submission system (see the confidential note accompanying this submission); other users may authenticate with their own PAT.:: 1. Set your Personal Access Token as an environment variable set GHCR_PAT=<your_read_packages_token> :: 2. Log in to GitHub Container Registry echo %GHCR_PAT% | docker login ghcr.io -u demaxiya567 --password-stdin
-
Pull the Docker Image:
docker pull ghcr.io/demaxiya567/runtime:1.0.0
-
Prepare Output Directory and Run:
:: 1. Create a local directory for outputs mkdir output :: 2. Run the container docker run --rm --gpus all -v "%cd%\\output:/output" ghcr.io/demaxiya567/runtime:1.0.0
The framework will execute using internal datasets and the bundled open-source LLM. Output files will be generated in the
outputdirectory.
Steps (for Linux/macOS):
-
Authenticate to GHCR:
export GHCR_PAT=<the review token provided above> echo $GHCR_PAT | docker login ghcr.io -u demaxiya567 --password-stdin
-
Pull the Docker Image:
docker pull ghcr.io/demaxiya567/runtime:1.0.0
-
Prepare Output Directory and Run:
mkdir -p output docker run --rm --gpus all -v "$PWD/output:/output" ghcr.io/demaxiya567/runtime:1.0.0
Important Considerations:
- This Docker container provides a lightweight deployment focused on reproducibility.
- The cognitive module uses a bundled open-source LLM (DeepSeek V4 Pro) served locally within the container. No external API keys are required.
MCFF/
βββ main.py # Main execution interface
βββ few_shot_learner.py # Core MCFF, CRA, FSA, and UGBO implementation
βββ llm_integration.py # LLM knowledge activation components
βββ data_processor.py # Data preprocessing and feature engineering
βββ evaluator.py # Performance evaluation metrics
βββ multi_objective_optimizer.py # Multi-objective optimization algorithms
βββ TabPFN/ # Integrated TabPFN module
βββ requirements.txt # Project dependencies
βββ README.md # This file
The framework's scientific foundation rests on several key innovations:
- Cognitive Knowledge Activation: A structured reasoning process to extract expert-level insights from LLMs.
- Complementary Residual Analysis (CRA): A mechanism for fusing models by diagnosing and exploiting their cognitive biases.
- Feature Sensitivity Asymmetry (FSA): A technique to quantify and leverage the differing "perspectives" of LLM and data-driven models on chemical features.
- Uncertainty-Guided Bayesian Optimization (UGBO): An efficient strategy for navigating vast chemical spaces under data scarcity.
For detailed mathematical derivations, please refer to the supplementary materials.
If you encounter dependency conflicts during pip install:
- Ensure you are using a dedicated virtual environment with the latest version of
pip. - Attempt a clean installation:
pip install -r requirements.txt --force-reinstall --no-cache-dir. - For guaranteed compatibility, please use the provided Docker container.
- API Connection Issues: Verify that your API credentials are correct and that your network connection is stable.
- Memory Usage: The framework's ensemble validation may require significant memory. If you encounter memory issues, ensure you have at least 64GB of RAM or consider using the Docker environment.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.