8000 GitHub - demaxiya567/MCFF: Multi-modal Cognitive Fusion Framework for few-shot catalyst discovery Β· GitHub
[go: up one dir, main page]

Skip to content
demaxiya567Public

About

Multi-modal Cognitive Fusion Framework for few-shot catalyst discovery

Resources

Stars

1 star

Watchers

0 watching

Forks

0 forks< 10000 /div>

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TabPFN-MCFF: An Implementation of the Multi-modal Cognitive Fusion Framework

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.

Python Version License Research

Built with TabPFN

This repository incorporates TabPFN v2 source code. The TabPFN attribution notice and license are preserved in LICENSE-TabPFN and TabPFN/LICENSE.

Overview

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.

Key Features

  • 🧠 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.

Installation

Prerequisites

  • Python 3.9+
  • For detailed dependencies, see requirements.txt. A fully configured environment is essential for reproducible results.

Setup

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.txt

For any installation issues, please refer to the Performance and Troubleshooting section.

Environment Configuration

Correct environment configuration is critical for the framework's performance and stability.

Local Open-Source LLM (Recommended)

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=4

Option 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-pro

Cloud API (Legacy Compatibility, Optional)

For 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"

Advanced Configuration

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"

Usage

MCFF is controlled via the main.py script. Place your experimental data in data/input_data.xlsx.

Basic Prediction

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"
)

Optimization

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"
)

Reproducibility with Docker (Recommended for Reviewers)

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 :

  1. Authenticate to GHCR: A Personal Access Token (PAT) with read:packages scope 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
  2. Pull the Docker Image:

    docker pull ghcr.io/demaxiya567/runtime:1.0.0
  3. 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 output directory.

Steps (for Linux/macOS):

  1. Authenticate to GHCR:

    export GHCR_PAT=<the review token provided above>
    echo $GHCR_PAT | docker login ghcr.io -u demaxiya567 --password-stdin
  2. Pull the Docker Image:

    docker pull ghcr.io/demaxiya567/runtime:1.0.0
  3. 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.

Project Structure

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

Core Methodologies

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.

Performance and Troubleshooting

Common Issues

Installation Problems

If you encounter dependency conflicts during pip install:

  1. Ensure you are using a dedicated virtual environment with the latest version of pip.
  2. Attempt a clean installation: pip install -r requirements.txt --force-reinstall --no-cache-dir.
  3. For guaranteed compatibility, please use the provided Docker container.

Runtime Errors

  • 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.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

Multi-modal Cognitive Fusion Framework for few-shot catalyst discovery

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0