AI-assisted research, methods, software and teaching

Peter Sørensen

Center for Quantitative Genetics and Genomics, Aarhus University

What is AI?

Term Meaning
Artificial intelligence The broad field of building systems that perform tasks associated with human intelligence
Machine learning and deep learning Methods that learn patterns from data. Deep learning uses neural networks with many layers
Generative AI Models that generate text, code, images, audio or other content
AI assistants and agents Systems built around generative AI that can work with users, files and tools. Agents can carry out multistep tasks

This presentation focuses on AI assistants and agents used for data analysis, method and software development, and teaching.

How researchers use generative AI

Activity Examples
Writing and communication Draft, revise, translate and shorten text
Literature work Find relevant papers, summarise them and compare their conclusions
Data analysis Inspect data, write code, make figures and explain results
Teaching Develop slides, exercises, examples and explanations
Administration Prepare emails, meeting notes, plans and reports

Writing and literature review are common entry points. The same technology can also contribute directly to mathematical, analytical and software work.

Areas of AI-assisted work

Area Example output Reusable result
Data analysis An analysis script and report A reproducible analysis workflow
Method development A statistical model or algorithm A clearly defined method with validation evidence
Software development R and C++ code, interfaces and documentation Tested and maintainable software components
Teaching Slides, simulations and worked examples Editable teaching materials

AI can help with mathematical reasoning, coding, analysis and documentation. Researchers set the scientific direction, review the decisions and determine what evidence is sufficient.

Platforms developed with AI assistance

Platform Purpose
gsuite Statistical models, numerical computation and user interfaces
gsim Simulation of genetic data and assessment of methods
gact Data integration, annotation, analysis and interpretation
gteach Shared tools and materials for teaching

AI has contributed to developing the platforms themselves. The resulting infrastructure can now support further work with AI assistants.

Using and extending the infrastructure

Use existing capabilities

  1. Inspect the data and available tools
  2. Specify the scientific model
  3. Run and assess the analysis
  4. Save the script and report

Add a missing capability

  1. Identify the limitation
  2. Define the required method or computation
  3. Implement it using existing components
  4. Validate and document the extension

Each completed project can improve the infrastructure available to the next.

Data analysis infrastructure: gact

How can we make data from different sources usable in the same analysis?

Prepare and connect

  • Detect and validate data structures
  • Harmonise GWAS summary statistics
  • Add biological annotations
  • Record reusable ingestion steps

Analyse and interpret

  • Connect variants with genes and pathways
  • Use established statistical methods
  • Trace results back to their sources
  • Preserve the complete analysis workflow

The value comes from making data usable together.

Simulation for method development: gsim

How well does a method recover known quantities under different scenarios?

Define the scenario

  • Pedigree and population structure
  • Genetic architecture and effects
  • Phenotypes and environmental variation
  • Quantities that the method should recover

Assess the method

  • Compare estimates with known truth
  • Examine uncertainty and failures
  • Change the scenario and repeat
  • Identify where the method struggles

Simulation helps us develop, compare and refine methods under conditions where the truth is known.

Software from algorithms to interfaces: gsuite

Layer Examples
User interface R functions such as gfit() and gvc()
Reusable model components Covariance models, estimation and prediction
Native C++ and shared libraries Solver interfaces, factor reuse and diagnostics
Numerical algorithms Sparse solves and selected inverse entries

Development connects statistical ideas to efficient and usable software.

The libraries behind gsuite

Repository Main responsibility
gsuite R interface: models, computational tasks and results
greml Mixed models, REML estimation and prediction
gsolve Numerical solvers, factor reuse and selected inverse calculations
gmat Matrix operations, genotype panels and linkage disequilibrium
gbits Compact genotype storage and operations on packed data
gcorr Genetic correlation calculations
gscore Genetic scoring and prediction
gbayes Bayesian regression models

gsolve connects our model computations to established numerical libraries:

CHOLMOD / SuiteSparse and PARDISO → sparse matrix factorisation and linear solves.

Reusable computational building blocks in gsuite

Model specification leads to sparse mixed-model equations, factorization and solves, reuse of numerical quantities, and a REML update. The update returns to assembly for the next iteration.

Reused quantities

  • MME solutions and quadratic forms
  • Log determinants from factorizations
  • Selected inverse entries for trace terms
  • Derivative solves and cross-products

REML calculations

  • Restricted log likelihood
  • Score: first derivatives
  • Information: second-order curvature
  • Average Information for parameter updates

Reuse the same building blocks for estimation, prediction and uncertainty.

Mathematical core of the same REML calculation

Mixed model

\[ y=X\beta+Zu+e,\qquad u\sim N(0,G),\quad e\sim N(0,R) \]

Mixed-model equations

\[ C(\theta) \begin{bmatrix}\widehat\beta\\\widehat u\end{bmatrix} = \begin{bmatrix}X^\top R^{-1}y\\Z^\top R^{-1}y\end{bmatrix} \]

\[ C(\theta)= \begin{bmatrix} X^\top R^{-1}X & X^\top R^{-1}Z\\ Z^\top R^{-1}X & Z^\top R^{-1}Z+G^{-1} \end{bmatrix} \]

Determinants for REML

\[ \begin{aligned} &\log|V|+\log|X^\top V^{-1}X|\\ &\qquad=\log|R|+\log|G|+\log|C| \end{aligned} \]

REML quantities

\[ \begin{aligned} V &= ZGZ^\top+R\\ P &= V^{-1}-V^{-1}X(X^\top V^{-1}X)^{-1}X^\top V^{-1} \end{aligned} \]

\[ \begin{aligned} -2\ell_R(\theta) &= \mathrm{constant}+\log|V|\\ &\quad+\log|X^\top V^{-1}X|+y^\top Py \end{aligned} \]

For \(V_i=\partial V/\partial\theta_i\),

\[ s_i=\frac12\left[y^\top PV_iPy-\operatorname{tr}(PV_i)\right] \]

\[ \mathcal I_O=-\frac{\partial^2\ell_R}{\partial\theta\,\partial\theta^\top} \]

\[ \mathcal I_{AI,ij}=\frac12 y^\top PV_iPV_jPy \]

Solves, selected inverse entries and derivative blocks supply these quantities.

Independent \(u,e\); positive-definite \(G,R\); full-rank \(X\). AI form shown for covariance components entering \(V\) linearly.

Architecture · Numerical foundation

gsuite versus DMU: agreement and runtime

Single trait: gsuite 80.9 seconds and DMU 178.4. Multitrait: 105.6 and 818.5. Longitudinal: 386.9 and 1182.7.

Numerical agreement

50,000 animals

Maximum covariance-estimate difference below \(4.3\times10^{-8}\).

Prediction correlations essentially 1 on 1,000 preselected animals.

Competitive runtime on these three tested models.

gsuite 0.29.0 and DMU 5.6. Each bar represents one execution. The work boundaries differ: gsuite fitting versus DMU preprocessing and fitting.

Teaching infrastructure: gteach

A common structure connects learning objectives with editable teaching material.

Source material

  • Learning objectives
  • R and Quarto source
  • Code, data and exercises
  • Speaker notes

Reusable outputs

  • Lecture slides
  • Worked tutorials
  • Interactive examples
  • Narrated presentations

We can develop the material together, then revise and reuse it across courses.

Where will AI lead us?

What is likely to change

  • Writing, coding and analysis will become faster
  • More groups will develop advanced methods and software
  • AI assistants will perform increasingly complex tasks
  • Research roles and expectations will change

Questions for our programme

  • Which expertise and resources will distinguish us?
  • How should we combine AI with our data and infrastructure?
  • Which capabilities should we develop and share?
  • How should training, review and responsibility change?

What should we change now to remain scientifically distinctive as AI becomes part of research?

From a computational need to a component

Need: Obtain required inverse entries without forming a full dense inverse.

Step What we work through with AI
Build small references Dense inverse and scalar Takahashi calculations in C++
Implement the efficient algorithm Selected inversion using retained CHOLMOD factors
Compare in native tests Check requested entries against both references
Check computational behaviour Factor reuse, thread agreement and retained solves
Integrate and assess Supported model computations and the R workflow

Reference and production calculations are both native C++.

Different checks answer different questions

Check Question it addresses
Mathematics and special cases Does the formulation represent the intended model?
Small native reference versus production algorithm Do separate computational approaches agree?
Repeated simulation with known truth How well does the method recover quantities across scenarios?
Comparison with other software Do results agree for matched models and settings?
Complete user workflow Can the interface produce an interpretable, reproducible result?

Independence comes from a separate computational approach, not a different programming language.

Where human judgement enters

Scientific decisions

  • Which question matters?
  • Which assumptions fit the study?
  • Which quantities should we estimate?
  • What can the results support?

Development decisions

  • Which approximations are acceptable?
  • What should be implemented or reused?
  • Which checks are sufficient?
  • When is a result ready to share?

AI can help examine each decision. We remain responsible for accepting it.

What remains after the conversation?

A reusable analysis or method

  • Model definition and assumptions
  • Code and an executable example
  • Tests and numerical evidence

Enough information to revisit it

  • Data identity, settings and versions
  • Results and documented limitations
  • Explanations and teaching material

The next researcher should be able to understand and use the work without reading the chat.

A concrete case: GWAS summary statistics

The question: can existing building blocks support a family of methods for heritability and genetic correlation?

Analysis Implemented method families
Genome-wide and annotation-based LDSC, GNOVA, SumHer
Regional HESS/rho-HESS, SUPERGNOVA, LAVA
Conditional relationships LAVA regression and partial genetic correlations

Native calculations in gcorr, reusable LD resources in gmat, numerical components in gsolve, and a common gsuite R interface.

The outcome includes working examples, diagnostics and documented limits.

How the researcher and assistant worked

Step Researcher Assistant
Define the next capability Set the scientific question and scope Inspect equations and existing components
Implement and check Review assumptions and challenge results Write native code; compare small numerical oracles
Connect and evaluate Decide what is supported and what needs investigation Add the R interface, examples and simulations

Short, reviewed steps: specify → implement → test → discuss → commit.

The checks included independent calculations, selected upstream comparisons, R/native agreement and simulated data with known truth.

What the development record shows

Date in 2026 Recorded work
21 August Initial native LDSC core already in place
11 September LDSC extensions and reference comparisons
12–13 September Additional method families, multivariate extensions and evaluations
14 September LDlist, R interfaces, aligned results and the simulation tutorial

Latest package tests: 2,264 checks passed.

20 simulated datasets: about 5.4 minutes, including data generation, LD preparation and fitting.

Calendar dates describe recorded development; human hours and time saved were not measured.

How much assistant time did this take?

Saved task records from 11–14 September 2026:

Work Recorded time
Native methods, discussion and evaluations 10 h 24 min
LD reference resources, R interfaces and package checks 4 h
Simulation examples, website updates and slides 35 min
Total assistant task time About 15 hours

From method development to a shared R interface and worked examples, using existing computational building blocks.

The simulations also reveal differences

Across 20 datasets, LDSC and SumHer have similar heritability errors, GNOVA has greater variability, and SUPERGNOVA has downward mean regional covariance errors relative to HESS and LAVA.

All 1,380 expected point estimates were available. The SUPERGNOVA shift gives a specific result to investigate.

What could become a research contribution?

Status Concrete example
Reusable infrastructure, implemented Shared LD resources, named covariance results and common numerical components
Native extension, implemented Annotation-specific genetic regression and partial correlations from GNOVA covariance estimates
Research question to evaluate Do conditional genetic relationships differ between annotations?

Existing methods can become building blocks for new questions.

Statistical novelty still needs a literature comparison and evidence. Shared code alone is not a new statistical method.