---
# System prepended metadata

title: 'GSoC 2024: P2'

---

Useful links: https://blog.zhaw.ch/artificial-intelligence/2023/04/20/deploy-your-own-open-source-language-model/

## Project 2 - Training an LLM to generate workchain and query from natural language prompts 

**level** *advanced*

**Expected Size** 350h

In AiiDA, WorkChain is a robust workflow capable of recovering from interruptions during execution, making it ideal for handling expensive calculations. However, mastering its usage requires familiarity with certain concepts before one can confidently create a resilient workchain.

Same for the `QueryBuilder` one of the most powerful tool in AiiDA to find target information from your huge amout of data generate from calculations.
However, it can be challenging to learn to write a correct query which even sometime not straightforward for experienced users.

This project aims to fine-tuning a large language model (LLM) to allow users to boilerplate WorkChain or build query they are interested in by expressing their desired workflow or data in a few sentences.
Existing LLM's such as ChatGPT already do a fair job at this, but the produced code is still often incorrect and outdated.

Generating a diverse dataset of query/workchain prompts and corresponding Python code, and using this data to improve a dedicated LLM will hopefully make the produced AiiDA queries/workchains more accurate, creating a powerful tool for users to build workchain and extract the results they are interested in.

### Expected outcomes

At the end of the project, we aim to have a lightweight tool that can: 
- Provide a starting template for a `WorkChain` code based on user input, which can then be refined futher.
- Generate a correct `QueryBuilder` instance from a user prompt.

This will require:

- A database that maps natural language prompts to the corresponding queries/workchains, which can be easily and incrementally expanded. 
- LLM fine-tuning on this database that converts prompts into a `QueryBuilder`/`WorkChain` instance.
- A user-friendly interface for that can be installed locally in the form of a Python package and optionally an online tool integrated with the Materials Cloud.

### Skills

- We expect you to be familiar with object-oriented programming in **Python**.
- You need to have experience in natural language processing and LLM.

### Note

This project poses an exciting challenge for both students and mentors. 
While the AiiDA team may not have extensive experience with LLM, we eagerly anticipate students bringing their knowledge to the table. 
We are ready to provide expertise for the actual queries and more, making this collaboration a dynamic and enriching opportunity.

### Mentors

 - Marnik Bercx [@mbercx](https://github.com/mbercx)
 - Jusong Yu [@unkcpz](https://github.com/unkcpz)
 - Edan bainglass [@edan-bainglass](https://github.com/edan-bainglass)


## (old) Project 2 - Training an LLM to generate a queries from natural language prompts 

**level** *advanced*

**Expected Size** 350h

One of the most powerful aspects of using AiiDA to run your workflows is that the automatically generated provenance can be used to flexibly query for the data that the user is interested in.
However, using the `QueryBuilder` tool designed for this purpose can be somewhat challenging to learn and even be time consuming for experienced users.

This project aims to train a large language model (LLM) that allows users to easily request the query they are interested in by expressing their desired data in a few sentences.
Existing LLM's such as ChatGPT already do a fair job at this, but the produced code is still often incorrect and outdated.
Generating a diverse dataset of query prompts and corresponding Python code, and using this data to train a dedicated LLM will hopefully make the produced queries more accurate, creating a powerful tool for users to extract the results they are interested in.

### Expected outcomes

At the end of the project, we aim to have a lightweight tool that can generate a correct `QueryBuilder` instance from a user prompt.
This will require:

- A database that maps natural language prompts to the corresponding queries, which can be easily and incrementally expanded. 
- LLM trained on this database that converts prompts into a `QueryBuilder` instance.
- A user-friendly interface for that can be installed locally in the form of a Python package and optionally an online tool integrated with the Materials Cloud.

### Skills

We expect you to be familiar with object-oriented programming in **Python**.
You need to have experience in natural language processing and know how to **train a model** from scratch.

### Note

This project poses an exciting challenge for both students and mentors. 
While the AiiDA team may not have extensive experience with LLM, we eagerly anticipate students bringing their knowledge to the table. 
We are ready to provide expertise for the actual queries and more, making this collaboration a dynamic and enriching opportunity.

### Mentors

 - Marnik Bercx [@mbercx](https://github.com/mbercx)
 - Jusong Yu [@unkcpz](https://github.com/unkcpz)
 - Edan bainglass [@edan-bainglass](https://github.com/edan-bainglass)