Large Language Models for Scientific Research: AI4S Architecture and Selection Checklist

    This article explains how to turn AI for Science (AI4S) architecture ideas into executable steps for developers and technical leaders. It covers a design for a single-cell analysis agent, a multimodal literature processing pipeline with a RAG knowledge base, and an infrastructure and deployment checklist. The original case study published no timing comparisons, test sets, or metric definitions, so this article does not rely on its performance multiples. Instead, it provides designs and checks that readers can reproduce on their own data.

    This article is for developers and corporate technical leaders. Its goal is to turn AI4S architecture ideas into steps that can be carried out. The original case described only a direction. It published no timing comparisons, test sets, or metric definitions. This article therefore does not rely on the specific performance multiples in that case. Instead, it provides designs and checks that you can reproduce on your own data.

    1. Single-Cell Analysis Agent: A Reproducible Workflow Design

    Single-cell analysis is a compute-intensive task. Traditionally, researchers write scripts by hand to run quality control, normalization, dimensionality reduction, clustering, and differential expression analysis in sequence. The value of an LLM agent lies in converting a natural-language analysis goal into these steps, then generating, executing, and checking the code.

    A usable agent typically includes three modules.

    1. Planning module: The LLM parses the user’s intent and outputs a structured list of steps, such as a JSON task sequence. Each step specifies its inputs, outputs, and the tools it uses.
    2. Execution module: Code runs in a sandboxed container with scanpy (Python) or Seurat (R) preinstalled. The container must limit CPU, memory, and runtime, and it must disable outbound internet access by default.
    3. Evaluation module: Automatically checks quality control distributions, clustering stability, and whether marker genes match known biological priors. When evaluation fails, the workflow returns to the planning module to adjust parameters.

    Using single-cell data from mouse embryonic pancreas as an example, the input is usually a count matrix in 10x Genomics format (an mtx or h5ad file) plus a cell metadata table. A common analysis workflow is shown below. The thresholds are only starting points. Adjust them for tissue type and sequencing platform.

    • Quality control filtering: Keep cells with 200 to 6,000 detected genes and a mitochondrial gene fraction below 15%.
    • Normalization: Scale counts to 10,000 per cell based on library size, then apply a log1p transformation.
    • Feature selection: Select 2,000 highly variable genes.
    • Dimensionality reduction: Run PCA on the highly variable genes and keep the top 50 principal components.
    • Clustering: Use the Leiden algorithm to scan resolutions from 0.5 to 1.0, and compare results across resolutions.
    • Marker genes: Use the Wilcoxon rank-sum test to find differentially expressed genes for each cluster. Keep genes with a log2 fold change above 0.5 and an adjusted p-value below 0.05.

    The recommended output includes four types of metrics: the number of cells in each cluster, the marker gene list for each cluster, the overlap rate between marker genes and reference databases, and the adjusted Rand index (ARI) across different random seeds. The ARI measures clustering stability.

    A domain expert must confirm the cell type annotations for each cluster. Labels from the model can serve as candidates, but they must not go into the report as conclusions.

    The table below compares a traditional script workflow with an agent workflow.

    Dimension Traditional script workflow Agent workflow
    Input Matrices and metadata that researchers format by hand A natural-language goal plus the same data files
    Tools Local Python or R environment, called manually Sandboxed container, with tools called through allowlisted functions
    Human intervention points Every step is written and checked by hand Parameter changes, cluster annotation confirmation, result review
    Output Scripts, figures, and reports, with formats that vary by person A fixed-structure result package with evaluation metrics
    Main risks Parameters vary with the person running them, making results hard to reproduce Code errors can go unnoticed, and generated annotations may lack supporting evidence

    The original case states that an agent can compress days of manual exploration into an automated workflow. This claim is partly reasonable, but verify it against your own data and time records.

    2. Multimodal Literature Processing and RAG Knowledge Base

    Early-stage drug and materials research requires reading large volumes of papers, patents, and experimental reports. Plain text retrieval cannot handle molecular structure diagrams, reaction equations, or experimental charts. A literature system must therefore first convert these elements into a searchable structure.

    1. Document parsing: Use layout analysis tools to separate body text, tables, and images. Pass figures to a multimodal model to generate text descriptions, and keep the original page and figure numbers for traceability. If chemical structures can be converted to SMILES strings, store them as well. Keep the original images.
    2. Chunking: Split documents by section and paragraph. Each chunk should be about 512 to 800 tokens, with 10% to 15% overlap between adjacent chunks. Store the document title, section path, and page number as metadata for each chunk.
    3. Vectorization: Build separate indexes for body text and figure descriptions. For the embedding model, choose a domain-adapted model that supports both Chinese and English, and validate it on a small scale using your own corpus.
    4. Hybrid retrieval: Use both BM25 keyword retrieval and vector retrieval, taking the top 20 results from each. Merge and deduplicate the results, rank them with a reranking model, and pass the final 5 to 8 passages to the LLM.
    5. Retrieval evaluation: Manually annotate 100 to 200 representative questions and their relevant literature passages. Then calculate Recall@5 and MRR. If recall is low, check chunking and parsing quality first, and consider changing the model only after that.
    6. Access control: Set access control lists on documents by project and security classification. Filter documents by user permissions before retrieval, not by trimming the answer after generation.
    7. Hallucination control: Every answer must cite source passage IDs. When retrieval returns no results, the system replies that it cannot answer. It must not let the model supply content on its own.

    Several issues need attention. Figure recognition can introduce errors in numerical values and units, so check key data against the original figure. Copyright terms differ considerably between patents and papers, so verify the license before ingesting a document. The update frequency of the literature determines how often the index must be rebuilt.

    3. Enterprise Selection and Infrastructure Checklist

    (1) Compute Configuration

    Interactive analysis, such as exploring a single dataset, suits small or medium CPU instances or a single GPU instance. Batch computation, such as reanalyzing thousands of samples, suits a GPU cluster with a job scheduler.

    Set minimum and maximum replica counts for autoscaling based on historical peak task load. Record cold start times. Slow container startup will slow interactive tasks.

    (2) API Scheduling

    Set concurrency limits according to the quota from your vendor. Apply rate limiting on the client side to avoid triggering server-side rate limits.

    Retries should use exponential backoff with random jitter, for up to 3 to 5 attempts. Non-idempotent operations, such as submitting a computation job, must carry an idempotency key to prevent duplicate submissions.

    Set timeout thresholds separately for each task type. Timeouts for short text Q&A and for long-running code execution differ greatly. Log token usage, latency, and error codes for every call.

    (3) Deployment and Data Security

    The table below compares three deployment options.

    Dimension Public cloud API Managed private model On-premises deployment
    Data leaves the organization Yes, governed by contracts and data processing agreements No, deployed in a dedicated environment No
    Compliance approval difficulty High, requires reviewing vendor terms Medium Low, but operational responsibility rests with the organization
    Upfront cost Low Medium High
    Model update speed Fast Depends on the provider Depends on the organization’s iteration capacity

    Whichever option you choose, complete the following checks before launch:

    • Data classification: Define which data is core trade secret and which data can be shared externally.
    • Personal information: Confirm whether the data contains identifiable patient information, and whether it has been de-identified or pseudonymized.
    • Vendor terms: Confirm data retention periods, whether data is used for model training, and how data deletion works.
    • Audit logs: Record who called which data and when. Keep logs for a period that meets compliance requirements.
    • Access control: Grant least privilege by role.

    The original case mentioned a model at the 10-billion-parameter level. It did not publish parameter counts, test sets, or timing data, so this article does not judge performance based on it. When selecting a model, run benchmarks on your own data and compare accuracy, latency, and cost.

    (4) Toolchain Integration

    Molecular dynamics tools (such as GROMACS and LAMMPS) and quantum chemistry tools (such as Psi4 and PySCF) are usually called through command-line or Python interfaces. Agents should not have direct shell access. A safer approach is to wrap each tool as an allowlisted function. For each function, define the input parameter format, the allowed value ranges, and resource limits, such as the maximum number of cores and the maximum runtime.

    4. Three Things to Do Before Launch

    1. Choose a low-risk pilot scenario. Reanalysis of single-cell data that already has annotations, or question answering over an existing literature library, are good starting points.
    2. Define evaluation metrics in advance. Suggested metrics include the agreement rate between agent results and the manual workflow, the time for each analysis, the number of manual corrections, and the share of answers without sources.
    3. Start compliance approval. Complete data classification, review vendor agreements, and design the logging approach. Until approval is granted, do not connect real patient data or unpublished R&D data.