Generating code executed by a controller of a scientific instrument using ai and nlms
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- THERMO FISHER SCI BREMEN
- Filing Date
- 2025-11-13
- Publication Date
- 2026-05-21
Smart Images

Figure EP2025082929_21052026_PF_FP_ABST
Abstract
Description
A METHOD OF GENERATING COMPUTER-READABLE CODE EXECUTABLE BY A CONTROLLER OF A SCIENTIFIC INSTRUMENT, A CONTROLLER OF A SCIENTIFIC INSTRUMENT, AND A COMPUTER PROGRAMFIELD OF THE INVENTION
[0001] The present disclosure relates to methods of controlling scientific instruments. In particular, the disclosure provides methods of developing code for controlling scientific instruments based on instructions received in a natural language.BACKGROUND
[0002] Scientific instruments, such as mass spectrometers or electron microscopes, have a broad range of different applications in different technical fields. As a result, tools and acquisition workflows for controlling the instrument to obtain and analyse sample data are required to meet a variety of different needs. Customization of these tools and workflows is therefore highly desirable. However, increased customisation of the software for controlling the instrument may result in increased complexity that may in turn make the controller of the instrument less user-friendly for some users (e.g., those that have more straightforward requirements). An example of a typical conflict of interest arises when an instrument is intended for use by both routine labs and cutting-edge research labs. These labs have very different requirements with respect to, for example, flexibility of data processing and evaluation.
[0003] In prior art instrument controllers, the different needs of different users are addressed by providing different “modes” of operation in the controller. For example, the controller may operate in a “simplified evaluation” mode and an “advanced evaluation” mode. However, such modes require complex software to be developed for the controller that are resource-intensive to develop and are prone to performance issues. From this example, it may be concluded that accommodation of every user’s requirements might be impractical or impossible, when a user’s specific requirement is not aligned with the needs of the majority of the other users.
[0004] Additionally, the time taken to implement functionality required by users may be exceed what users would find acceptable in some circumstances. Generally, users would submit their feature requests to the software developers responsible for the controller and each request would be prioritized, planned, tested, and evaluated.
[0005] Moreover, it may be preferable not to modify the core controller software, as this may lead to instability in the core software for all users. Instead, it may be preferable to design experiments andcustom acquisition procedures for users to acquire experimental data using the core software in a flexible manner.
[0006] One solution providing additional flexibility that has been adopted in the past, is to enable the controller software to accept custom scripts, which may be custom written by the software developers responsible for the controller, at the request of users. This allows for custom functionality to be added, without modifying the core software. For this to work, the instrument control software provides some APIs that can be used by a scripting engine provided within the framework of the instrument controller. This requires that the user modifying the workflow is able to adeptly write the scripts in the required scripting language and that the controller software is able to accommodate the requirements of the scripting language. Moreover, to successfully write a script that uses the APIs, the user must first gain a significant understanding of knowledge about the internal implementations and workflows of the framework. This is a significant challenge even for the software developers responsible for the controller and it is unlikely to be practical for end users to write their own scripts.
[0007] The present disclosure aims to address the drawbacks of the present approach.SUMMARY
[0008] Against this background, the present disclosure proposes to use one or more generative large language models to generate code to solve an analytical problem provided by a user of the instrument. This approach allows the user to create custom workflows quickly and without detailed knowledge of programming or the internal workings of the instrument control software / APIs.
[0009] A control unit of a scientific instrument is provided. The control unit is configured to perform any of the methods described below.
[0010] In some examples, the large language model or a system of large language models referred to below is integrated with the controller. In other examples, the code may be generated by a large language model or a system of large language models running separately from the controller. In some examples, the method may be performed by a server, such as a cloud server. Nevertheless, the user may interface with the server via the controller. For example, the user may provide the instructions to the controller, which may forward the instructions to a server for processing by the large language model, which may return the code to the controller for execution. The server may also obtain additional user prompts via the controller. It will be understood that references to a large language morel or at least one large language model below may encompass a system of large language models.
[0011] A computer program comprising instructions that, when executed by a processor, cause the processor to perform any of the methods described above is also provided.
[0012] A method of generating computer-readable code executable by a controller of a scientific instrument is provided. The method comprises receiving instructions in a natural language. The method further comprises processing the instructions using at least one large language model to generate computer-readable code executable by the controller of the scientific instrument to control the scientific instrument to obtain data from analysis of a sample; and / or process the data obtained from analysis of the sample by the scientific instrument. The at least one large language model is pre-trained using one or more of: analytical chemistry methods using the scientific instrument; material science analytical methods using the scientific instrument; documentation identifying functions for controlling the instrument; camera firmware code; board firmware; methods for starting / stopping measurements; methods for setting data acquisition parameters; and / or methods of reading data.
[0013] The proposed methods therefore provide an interfacing tool between user requests (e.g., for data evaluation, enhancement, visualization and acquisition) and the production code environment of the controller. This arrangement may be very flexible and advantageous.
[0014] The use of large language models to generate computer code is known in the art. So-called “Program-Aided-Language models” or PAL convert natural language prompts into computer programs. The methods proposed in this disclosure use Program-Aided-Language models differently to prior art methods. The application of Program-Aided-Language models for highly complex tasks and usage in complex environments such as instrument control software, as presented in this disclosure, has never been achieved before.
[0015] A large language model is an Artificial Intelligence code generator configured to generate computer code in response to a prompt, where the prompt comprises the instructions in a natural language.
[0016] The large language model may be pre-trained to generate computer-readable code.
[0017] The large language model may be pre-trained (fine-tuned) using on one or more of:analytical chemistry methods using the scientific instrument (i.e. , the specific scientific instrument that the controller is configured to control);Software Development Kit (SDK) documentation to identify functions for controlling the instrument (e.g., tuning, data acquisition, status checks); andcommunication protocols and available methods for starting / stopping measurements, setting parameters, and reading data.
[0018] A natural language is a language spoken, written and understood by humans, as opposed to machine code written in a computer programming language.
[0019] The computer-readable code may be provided to the controller of the scientific instrument.
[0020] The method may further comprise controlling the scientific instrument by executing the computer-readable code.
[0021] The code may be provided in a suitable programming language for providing to instrument control software running on the controller. The computer-readable code may be written by the large language model in a human-readable programming language (e.g., python or C#).
[0022] It is preferable to generate code using the large language model and then execute the code using a suitable interpreter (e.g., a Python interpreter). This approach generally leads to more accurate results than generating machine code directly by the large language model to solve the problem presented. Moreover, the code generated is more testable and debuggable than machine code.
[0023] Alternatively, the computer-readable code may be written by the large language model in machine code for direct execution by the controller.
[0024] The method may further comprise generating (e.g., by the large language model, as part of the output that includes the code) one or more tests to confirm whether the computer-readable code is well-formed to control the scientific instrument to obtain data from analysis of a sample and / or process the data obtained from analysis of the sample by the scientific instrument.
[0025] The method may further comprise performing the one or more tests on the computer-readable code in a test environment and obtaining test results.
[0026] Performing the one or more tests may comprise simulating execution of the computer-readable code by the controller of the scientific instrument.
[0027] If the test results indicate that the computer-readable code is not well-formed to control the scientific instrument and / or process the data in accordance with the instructions when executed, the method may further comprise: x) modifying the computer-readable code, based on the test results.
[0028] The computer-readable code may be modified based on the test results and further (optionally) based on any error messages generated during performance of the tests.
[0029] Modifying the computer-readable code, based on the test results, may comprise processing the computer-readable code and the test results using the large language model or a second large language model to generate modified computer-readable code to control the scientific instrument and / or process the data in accordance with the instructions.
[0030] In other words, modifying the computer-readable code based on the test results may be performed by loop iterations of the code, its tests and its error messages into the initial LLM.Alternatively (and preferably) modifying the computer-readable code based on the test results may be performed by sending the code, its tests and the relative error messages to a second LLM that specializes in writing code.
[0031] Accordingly, the second large language model may be trained to write code in a particular programming language. For example, the second LLM may be fine-tuned to write python code.
[0032] The proposed methods may use one large language model to generate the code and a different large language model to generate modified computer-readable code, based on the original instructions, original code and the test results. This method may be referred to as ‘downhill’ error handling, as the errors are processed by a different model. This process may be repeated over several iterations. In this way, so-called “adversarial prompting” (in which the different models are competing to generate the best computer-readable code) may be employed to generate the computer-readable code.
[0033] The method may further comprise: y) repeating the one or more tests on the modified computer-readable code in the test environment and obtaining repeat test results. The method may further comprise repeating steps x) and y) until the test results indicate that the computer-readable code is well-formed to control the scientific instrument and / or process the data in accordance with the instructions when executed.
[0034] In this way, recursive internal checking is performed to iteratively confirm that the code is suitable for carrying out the instructions.
[0035] In some examples, the code generation has stochastic aspects. In other words, the same prompt may yield different code if input to the model on different occasions. However, the code will subsequently be tested and modified iteratively, to ensure that it fulfils the instructions. Therefore, the output of the code should be deterministic. In other words, the same prompt on different occasions will generate code that, when executed by the controller, causes the controller to obtain / process data from the scientific instrument in the same way.
[0036] The method may further comprise determining that the instructions are insufficient to generate computer-readable code to control the scientific instrument and / or process the data in accordance with the instructions when executed by the controller of the scientific instrument (i.e., more information is required). The method may further comprise requesting and receiving additional instructions in the natural language for controlling the scientific instrument and / or processing the data (an additional prompt). The method may further comprise processing the instructions and the additional instructions using the large language model to generate modified computer-readable code to control the scientific instrument and / or process the data in accordance with the instructions and the additional instructions.
[0037] As described above, the first large language model may be pre-trained using analytical chemistry methods, SDK documentation and / or communication protocols and available methods. If the user is not able to answer additional questions (for example, “Should the calibrations be done fitting a linear or a quadratic function?”), then the analytical chemistry knowledge of the LLM may be used to answer the question.
[0038] The LLM may be fine-tuned for analytical chemistry and chemometric techniques and may therefore have the ability to ask relevant questions to improve / fix the code. If the user cannot answer them then the LLM would use its chemistry knowledge to make an educated guess.
[0039] The method may further comprise: y) repeating the one or more tests on the modified computer-readable code in the test environment and obtaining repeat test results. The method may further comprise repeating steps x) and y) zero or more times. The method may further comprise determining, based on one or more of the instructions, the computer-readable code, the modified computer-readable code, the test results and the repeat test results, that the instructions are insufficient to generate computer-readable code to control the scientific instrument and / or process the data in accordance with the instructions when executed by a controller of the scientific instrument (i.e., more information is required). The method may further comprise requesting and receiving additional instructions in the natural language for controlling the scientific instrument and / or processing the data (an additional prompt). The method may further comprise processing the additional instructions using the large language model to generate modified computer-readable code to control the scientific instrument and / or process the data in accordance with the instructions and / or the additional instructions.
[0040] The method may reach a certain point where the system determines that more information is required and may then ask the user for an additional or different prompt, and generate modified instructions based on the additional or different prompt.
[0041] The method may further comprise determining that the test results indicate that the computer-readable code is not well-formed due to an error in the one or more tests. The method may further comprise generating (by the large language model, as part of the output) one or more updated tests to confirm whether the computer-readable code is well-formed to control the scientific instrument and / or process the data in accordance with the instructions (based on the instructions, the computer-readable code and the test results). The method may further comprise performing the one or more updated tests on the computer-readable code in a test environment and obtaining updated test results.
[0042] The instructions may comprise one or more examples of:a potential scenario encountered by the controller of the scientific instrument during analysis of a sample and / or processing of the data; anda corresponding explanation of how the controller of the scientific instrument should behave in the scenario.
[0043] The one or more tests may be based on the one or more examples.
[0044] The computer-readable code may comprise a plurality of commands (which may also be referred to as “operations”). Each command may comprise zero or more parameters.
[0045] The commands and / or parameters may come from SDK documentation used to fine tune the LLM.
[0046] A first subset of the plurality of commands may invoke software functions defined in a library associated with a programming language of the computer-readable code (e.g., built-in functions of the programming language or modules imported into the execution environment).
[0047] The computer-readable code may comprise one or more function definitions. A second subset of the plurality of commands may invoke the one or more functions defined in the computer-readable code.
[0048] In some examples, existing functions may be used as inputs to train the large language model.
[0049] There are multiple different embodiments of the proposed methods. In a first embodiment, the large language model produces code that uses existing software functions. In a second embodiment, the large language model produces code that may include software functions. Existing functions may be used as inputs to train the large language model.
[0050] The large language model may comprise additional specialized models (such as vision, audio, or data models) to complete tasks that beyond the core text-based capabilities of the large language model (such as generating code). When a prompt requires a specific type of analysis, like image interpretation, sound processing, or data analysis, the large language model may generate a sub-task tailored for the appropriate model. The specialized model may process the input (e.g., an image, sound, or dataset) and return results to the large language model. The large language model may then integrate these results with its language processing to produce a final, cohesive response. This integration enables the large language model to handle complex, multi-modal tasks by incorporating the strengths of different models.
[0051] The method may further comprise displaying the data and / or processed data in a human-readable format (such as a graphical representation) via a display associated with the controller of the scientific instrument.
[0052] An additional multimodal model (for example, a Vision-language model such as PaLM-E or LLaMa-2 with vision) may receive the generated plots as inputs and may be used to perform one or more of the following tasks:Image Captioning and Descriptions: Generating captions, explaining content, and answering questions about images.Visual Question Answering (VQA): Responding to questions based on specific elements within an image.Code and Diagram Interpretation: Understanding diagrams, code screenshots, orcharts, which is valuable for code debugging and engineering tasks.
[0053] The method may further comprise analysing syntax of the computer-readable code and determining that the computer-readable code is well-structured (i.e. contains no syntax errors).
[0054] The step of analysing syntax may be performed by a LLM that specialises in writing code.
[0055] If the code is not well-structured, the method may further comprise providing details of errors in the syntax of the computer-readable code to the large language model and generating updated computer-readable code.
[0056] The method may further comprise obtaining second instructions from a storage medium. The second instructions may comprise a prompt to induce the large language model to generate computer-readable code that is modular and testable. The computer-readable code may be generated based on the instructions and the second instructions.
[0057] In other words, there may be another (non-editable) prompt to the large language model that causes the large language model to generate code that is highly modular and testable. The second instructions may be provided in the natural language.
[0058] The method may further comprise obtaining one or more examples of computer-readable code for controlling the scientific instrument and / or processing the data.
[0059] The computer-readable code may be generated based on the instructions and the one or more examples (and optionally the second instructions, where these are obtained).
[0060] The large language model may be trained using the one or more examples (and corresponding instructions, in accordance with which the controller controls the scientific instrument and / or processes the data).
[0061] In other words, the examples may be provided to the large language model in the prompt and / or may be used for training the model.
[0062] The instructions may be received from a human user.
[0063] Alternatively, the method may further comprise receiving an initial set of instructions from a human user and processing the initial set of instructions using a prompt-generating large language model to generate the instructions in the natural language.
[0064] In other words, the prompt itself may be generated by prompt engineering using a promptgenerating large language model (this process may be referred to as meta-prompting).
[0065] In some examples, a detailed prompt may be broken down into many smaller task requests, with some examples of execution and examples of what not to do.
[0066] The method may further comprise processing the instructions using a large language model to generate one or more questions that are presented to a human user in the natural language. The method may further comprise receiving additional instructions in the natural language in response to the one or more questions (an additional prompt). The computer-readable code may be generated based on the instructions and the additional instructions (and optionally the second instructions, where these are available).
[0067] In other words, the method may use chain of thought reasoning to check back with the user after the initial prompt, to ensure that the model has correctly interpreted the instructions. The modelmay also check back with the user to provide a plan for delivering a solution to the instructions, before generating the code.
[0068] The instructions may be received as a text input or an audio input. In other words, the user may type or speak the instructions.
[0069] Audio instructions may be converted to text using speech-to-text model.
[0070] A method of training a large language model is also provided. The method comprises providing, in the training data set, at least one of the following: analytical chemistry methods using the scientific instrument; material science analytical methods using the scientific instrument; documentation identifying functions for controlling the instrument; camera firmware code; board firmware; methods for starting / stopping measurements; methods for setting data acquisition parameters; and / or methods of reading data. The large language model may further be pre-trained to generate computer-readable code.BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The invention is described with reference to the following non-limiting examples.
[0072] Fig. 1 illustrates a flowchart of a method according to specific examples.
[0073] Fig. 2 illustrates a graph generated as a result of running code according to a specific example.
[0074] Fig. 3 illustrates a flowchart of another method according to specific examples.DETAILED DESCRIPTION
[0075] The present disclosure is related to the field of adaptive artificial intelligence (Al) systems and integration of Large Language Models (LLMs) or systems thereof into real-time, user-driven workflows. It may enable the customization and enhancement of image processing and analysis workflows, with possible application in domains such as Material Science, SEMI, Life Sciences, in Spectroscopy and Electron Microscopy (EM) domains. It may enhance the dynamic generation of tailored algorithms and lessen or even remove the need for Al model retraining or R&D algorithm development.
[0076] Large language models may be used to perform tasks based on instructions provided in a natural language, and a few examples of how to perform the task in different scenarios. The largelangue model may apply chain-of-thought reasoning to understand the instructions by decomposing the instructions into discreet steps and then providing a solution for each step. Nevertheless, large language models do not reliably solve the problem first time. Therefore, a way of testing the solution, diagnosing the issues and providing an updated solution is required. An approach for doing so is to generate computer programs for solving each step that are written in code that is both human-readable and computer-readable (e.g., Python). Execution of the code is performed by an interpreter, rather than directly by the large language model. The code provided by the large language model may contain errors, as explained above. However, the code may be subject to iterations of testing and modification so that these errors may be debugged and any problems fixed. This approach may be referred to as a Program-Aided-Language model (PAL model).
[0077] The general idea of Program-Aided-Language models is to:receive a user prompt (a set of instructions for performing a task),use a large language model to decompose the natural language problem into executable steps,generate computer code implementing the steps, andexecute the code by a code interpreter and yield a result.
[0078] One possible use of generative LLM is to let a LLM or a system of LLMs generate code, and in case of the system, cooperate in an orchestrated manner to solve a certain analytical problem (as opposed to have the LLM generating directly the solution to such problem). Generating code using an LLM and then, reasoning using a code (e.g. Python) interpreter, may lead to more accurate results than much larger models.
[0079] The application of PAL for highly complex tasks and usage in complex environments such as instrument control software may directly address the inefficiencies and rigidity of traditional software development pipelines. By enabling real-time, user-driven customization through natural language interfaces, the use of PAL in the below-described context may allow users to introduce new features or modify workflows without the need for collecting extensive new datasets or retraining models. This may enhance system flexibility. For instance, rather than retraining a convolutional neural network on tens of thousands of images to detect new features, the LLM may be used to generate specific algorithms on the fly, tailored to the user's input.
[0080] There may be a range of different large language models that can be used and different models may be more suited to different tasks. The code interpreter is generally fixed and specific to the programming language in which the code is written.
[0081] The proposed methods relate to control of scientific instruments and manipulation of data obtained by analysing samples with the scientific instruments. These methods use a PAL model tointerpret natural language instructions from a user and produce code that may be used by a controller of the scientific instrument to execute the instructions. This is a considerably more complex problem than solving abstract problems (e.g., mathematical problems) using a PAL approach.
[0082] In order to generate suitable code for execution by a controller of a scientific instrument, the large language models may be trained using the source code of the instrument control software and firmware (e.g., camera firmware, mother board firmware, and the like). Moreover, in order to solve the specific problems that arise during manipulation of data from analysis of samples by the scientific instrument, the large language models may also be trained using additional software (including third-party plug in software and firmware, instrument control software, and research software for performing tailored mathematical and signal / image processing operations), documentation for the additional software, application notes, internal documents describing the workflows, and the like. The large language model may be also trained using documentation such as scientific textbooks and literature, scientific standards, legal requirements and the like.
[0083] In order to provide a solution to the instructions, a pretrained large language model (such as Llama3 from Meta or Mistral models) may be used. The pretrained large language model may be trained to interpret instructions in the natural language (human language e.g., English, French, German, etc.) and output code in the required programming languages (e.g., C#, Python, etc.). The large language model may also be fine-tuned or augmented to learn the information that is specific to the controller of the scientific instrument in question. In this way, the proposed methods may be implemented using known large language models and PAL models and using these to generate computer-readable code for execution by a controller of a scientific instrument.
[0084] For simplicity, it may be assumed that the large language model can generate code in different programming languages (e.g., C#, Python, etc.). In practice, however, the large language model may be trained to use a specific language, depending on the scenario (see below).
[0085] The herein described approach may directly address the inefficiencies and rigidity of traditional Al and algorithm development pipelines. By enabling real-time, user-driven customization through natural language interfaces, the invention may allow users to introduce new features or modify workflows without the need for collecting extensive new datasets or retraining models. This may reduce the time to value and enhance system flexibility. For instance, rather than retraining a CNN on tens of thousands of images to detect new features, the LLM may generate specific algorithms on the fly, tailored to the user's input.
[0086] In doing so, the invention may overcome the limitations of fixed recipe-based systems and rigid neural pipelines, such as those used in diffraction alignment for material science. It may eliminatethe need for time-consuming retraining, validation, and deployment cycles, making the system adaptable to evolving use cases and increasing customer demands. This dynamic generation of tailored algorithms may empower users to stay agile and minimize development bottlenecks.
[0087] In the following description of three examples, the proposed methods and workflow are described at a high level.
[0088] The first example illustrates how a simple process is enacted in accordance with the proposed methods and includes the following steps:
[0089] Step 1 : A user writes or says what they want to accomplish (e.g., “find out if there are samples where the same repetition failed for all wavelengths and change acquisition to immediately repeat that sample acquisition”, “warn me if something is wrong in the sample introduction system”, “give me hints on how to fix / trouble shoot [a specific problem]”, or “give me a plot that shows all overlapping measured intensities for the run that failed”).
[0090] Step 2: The large language model understands the requests (the “prompt”) and has learned the complete corpus that makes up the controller software code.
[0091] Step 3: The large language model generates the code (e.g., python code) that will be provided to the controller for execution. This may be achieved using a scripting interface of the controller or by compiling the code to a package (e.g., a dynamic-link library, “dll”) that make use of a third-party plugin API of the controller (e.g., the “3rd Party PluginAPI” of the “Qtegra” software by Thermo Fisher Scientific).
[0092] Step 4: The code is transferred to the controller and executed.
[0093] Step 5: The user sees the output of the execution of the code via a display of the controller.
[0094] In a second example in accordance with the proposed methods, steps 1 and 2 from the first example are unchanged and the method further includes the following steps:
[0095] Step 3: The large language model generates a second prompt based on the user request and sends the second prompt to a second model to generate the code (e.g., python code). The generated code is suitable for execution within a suitable execution environment.
[0096] Step 4: The results are calculated directly inside a suitable execution environment (e.g., a python environment), including any required plotting and visualisation functions. The results are sent to the controller (or a third party software) for export and display to the user.
[0097] The first two embodiments are illustrated with reference to Fig. 1 , which illustrates a flowchart of a method according to specific examples. At step 100, a user writes a natural language prompt on text interface to the large language model. Where the prompt comprises instructions.
[0098] At step 101 , one of two possible options is selected, either option 102, or option 103.
[0099] At step 102, the large language model elaborates the instructions and outputs code to execute the prompt.
[0100] Alternatively, at step 103, the large language model elaborates the instructions and outputs a meta-prompt, which is passed to the trained large language model to generate suitable code to execute the prompt.
[0101] In either case, at step 104, the code is copied into a scripting platform for execution.
[0102] At step 105, the scripting platform runs the script, thereby executing the initial user prompt.
[0103] A third example in accordance with the proposed methods is provided to handle a complex request that requires the use of a multimodal approach (e.g., text plus images). Steps 1 and 2 from the first example are unchanged and the method further includes the following steps:
[0104] Step 3: The large language model generates a second prompt based on the user request and sends the second prompt to a sequence of models that are used to solve the request of the customer.
[0105] Step 4: The generated sequential code using multiple models will be executed (e.g., in python).
[0106] Step 5: The customer will see the output of execution of the code via a display of the controller.
[0107] In the following description, the proposed methods and workflow are described in more detail. For the first scenario, instrument control software is used in conjunction with the code generated by the large language model. In a second scenario, the code generated by the large language model may be used to completely replace the controller software solution with a minimal framework.Scenario 1
[0108] As described above, some instrument control software packages provide the ability to run user defined scripts. In order to prepare suitable scripts, a user needs to be familiar with programming in the required language (e.g., C#) and with internal structures of the instrument control software. To allow users to generate scripts without the need for this detailed knowledge and understanding, the proposed methods may train the large language model with the internal structures of the instrument control software (in addition to already being trained to use the programming language)
[0109] An example workflow according to a specific example of the proposed method for a user (such as an R&D Scientist) to generate a script is enumerated in the following steps:
[0110] Step 1 : The user opens a small application providing an interface to the large language model and describe (write) what the user wants to accomplish. For example, the user may want to perform some specific measurements with custom acquisition time and compute the statistics of that measurement.
[0111] Step 2: The large language model understands the requests and has learned the complete corpus that makes up the code of the controller.
[0112] Step 3: The large language model produces C# code that includes the required style and structures of scripts.
[0113] Step 4: The script is provided to the controller (e.g., into a scripting editor of the controller), which also provides syntax checking and, when no errors have been detected, runs the script.
[0114] In some examples, the large language model provides the code to the user, who then copies it to the scripting editor of the controller. This may enable advanced users to check the code manually before running it. Alternatively, the large language model may provide the code directly to the controller. Advantageously, manual user interaction would then not be required, other that providing the initial instructions (“prompt”). This may be preferable for users that are not familiar with the internal workflows of the controller.Scenario 2
[0115] The proposed methods may be used to extend the capabilities of the instrument control software by adding the possibility to run user-generated scripts, as an extension of the software package. To enable this, the framework of the controller may be extended as follows: based on APIs already included in the controller software, the option to run scripts (e.g., Python scripts) may beadded to the software by using an approach suitable for the specific programming language used for the controller software. For example, in case of “Qtegra” controller software by Thermo Fisher Scientific, which is written in C#, IronPython may be used to execute Python scripts. With this, the workflow would be as follows:
[0116] Step 1: The user writes or says what they want to accomplish (e.g. “find out if there are samples where the same repetition failed for all wavelengths and change acquisition to immediately warn the user that something is wrong in the sample introduction system, possibly giving hints on how to fix it / trouble shoot it, repeat that sample acquisition”, or “give me a plot that shows all overlapping measured intensities for the run that failed”).
[0117] Step 2: The large language model understands the requests and has learned the complete corpus that makes up the controller software code.
[0118] Step 3: The large language model generates the code (e.g., python code) that uses internal interfaces or APIs that the instrument control software provides. An example would be to create a control command in Python that triggers an acquisition of a full frame or changes hardware parameters to a desired state.
[0119] Step 4: The code is automatically extracted and stored in a separate script (e.g., a Python script). This script is executed (e.g., using IronPython) and generates results.Recursive internal checking
[0120] Large language models sometimes generate code that contains errors. For example, it is possible for large language models to experience “hallucination” (e.g., the model may generate code that does not achieve the desired output or uses functions that do not exist). Other known large language model issues may also arise when generating code based on instructions, especially if the user is not familiar with large language model prompt engineering. In particular, errors are more likely if a user provides “zero-shot” prompting (where no examples are provided) or “one-shot” prompting (where only one example is given on how to execute the prompt).
[0121] Moreover, the code produced by a large language model may also contain syntax errors, such as missing symbols like or “}”, wrong arguments for methods (especially when parameter names are very short) or hallucinates complete methods and packages.
[0122] Finally, there could be logic errors in the code so that the code does not correctly execute or solve the task provided in the instructions.
[0123] Preferably, the problems described above may be dealt with automatically, rather than raising error messages that are caused by these problems to the user. Therefore, several strategies are provided to handle such errors.
[0124] In a first strategy, the large language model receives an additional set of instructions (not changeable by the user) that prompts the large language model to use the chain-of-thought method and to only generate code that is highly modular and testable. The additional instructions are provided to the large language model alongside the instructions from the user.
[0125] In a second strategy, the large language model is instructed to always create unit tests for the code it generates. The unit tests are run in a separate environment and the output (pass, fail, or some kind of error) is returned to the large language model. Based on the results, the large language model changes / extends the code to address failed tests or coding errors and only returns code that passes all the tests.
[0126] In a third strategy, another way to implement a self-checking workflow is to allow for an internal cycle of few-shot-prompting, where historic coding examples (from the existing customer facing software) are provided.
[0127] In a fourth strategy, methods may employ ‘downhill’ error handling, using adversarial prompting between different large language models. For example, if the user prompt yields a certain code output which, when executed, causes an error message. This error message may be provided to another (or multiple) large language model agent that understands the error and tries a new approach. This process may be repeated until no error message is generated (or the agent requests more information to the user if it is unable to produce code that passes all the tests).
[0128] In a fifth strategy, the quality of the prompt may be improved so that less errors are encountered. This may be achieved with so-called “metaprompting”. Metaprompting interprets the natural language query (with a first large language model, which may be referred to as a “promptgenerating large language model”) and outputs a second prompt, engineered to best prompt the large language model responsible for generating the code. For example, a more detailed prompt broken down into a lot more smaller task requests, with some examples of execution and examples of what not to do.
[0129] Finally, in a sixth strategy for a more interactive approach, chain of thought reasoning could be used to check back with the user after the initial prompt if the large language model has correctly understood the instructions and whether a strategy developed by the large language model for delivering a solution is approved by the user.
[0130] Also, a combination of all the approaches above can be used for recursive internal checking.Data preprocessing & training
[0131] As mentioned above, the large language model may be trained / fine-tuned / augmented to include the complete corpus of the controller code (i.e. , methods, functions and variable names etc). As a result, the large language model may generate code that seamlessly uses the built-in methods, functions and variables of the controller software. In addition, the large language model may also be trained / fine-tuned / augmented with Camera Firmware code and board firmware (e.g. for Inductively coupled plasma optical emission spectroscopy).
[0132] Due to the complexity of the controller software and some of the programming languages in which some software is written (e.g., C#). Alternative programming languages (e.g., Python) may be used in the examples described in this disclosure to provide a practical implementation of the methods. Nevertheless, use of these programming languages (e.g., Python) are only intended as specific examples and the invention is not limited to the programming languages described in these specific examples. The large language model may be trained / configured to output code in any suitable programming language, depending on what is most suitable for the application (and for the controller).
[0133] In the agentic design of this large language model, different fine-tuning material can be used for different agents. For example, if the agent prompt is “you are an expert analytical chemist, aware of all standard operating procedures in this CLT”, the fine-tuning data may consist of all standard operating procedure documents of that lab and the fundamentals of analytical chemistry and the agent is both an expert programmer for the specific controller (e.g., Qtegra) and an expert lab manager for the laboratory the user works in. If the prompt is “you are an expert auditing officer for ISO 6001 in an environmental laboratory” the fine-tuning material may be the ISO6001 regulation plus the practical implementations on QA QC of such regulation in the specific laboratory that is being audited.
[0134] The Program Aided Language model (PAL) may use a pretrained large language model to read (or listen to) natural language questions (asked by the user). For example, the user may provide instructions such as, “I want to exclude intensities that are outside of the linearity range based on my latest calibration”. The Program Aided Language model may then generate programs (e.g., the python code provided below) as the intermediate reasoning steps. The actual computation of the generated code may be off-loaded to the controller runtime or to a third-party runtime.import pandas as pdimport numpy as npfrom sklearn . linear_model import LinearRegressionimport matplotlib . pyplot as pit# Define the function for the calibration curvedef calibration_curve ( x, y) :model = LinearRegression ( ) . fit ( x, y)return model# Apply the function to customer datax = calibration_data [ ' concentration ' ] • values . reshape ( - 1 , 1 )y = calibration_data [ ' intensity ' ] • valuesmodel = calibration_curve ( x, y)# Calculate limit of detection ( LOD )LOD = 3 *np . std ( calibration_data [ ' intensity ' ] [ calibration_data [ ' concentration ' ] == 0 ] )# Find the linearity rangelinearity_range = calibration_data [ ( calibration_data [ ' intensity ' ] >= LOD ) & ( calibration_data [ ' intensity ' ] < calibration_data [ ' intensity ' ] • max ( ) ) ]# Generate synthetic unknown sample dataunknown_samples = pd . DataFrame ( { ' concentration ' : [ 50 , 150 ] , ' intensity ' :[ 500 , 1500 ] } )# Evaluate unknown samplesdef evaluate_sample ( sample , model , linearity_range ) :predicted_concentration =model . predict ( np . array ( [ sample [ ' intensity ' ] ] ) . reshape ( - 1 , 1 ) )i f predicted_concentration < linearity_range [ ' concentration ' ] . min ( ) or predicted_concentration > linearity_range [ ' concentration ' ] , max ( ) :dilution_f actor = predicted_concentration / linearity_range [ ' concentration ' ] . max ( )raise ValueError ( f "Sample is too concentrated for your calibration ! Please dilute by { dilution_f actor } " )else :return predicted_concentration# Apply the function to our unknown samplesfor i, sample in unknown_samples . iterrows ( ) :try :print (evaluate_sample ( sample, model, linearity_range ) )except ValueError as e :print ( e )# Plot the calibration curve and unknown samplespit . scatter ( calibration_data [ ' concentration ' ] ,calibration_data [ ' intensity ' ] )pit . plot ( calibration_data [ ' concentration ' ] , model . predict (x) ,color= ' blue ' )pit . scatter (unknown_samples [ ' concentration ' ] ,unknown_samples [ ' intensity ' ] , color= ' red ' )pit . xlabel ( ' Concentration ' )pit . ylabel ( ' Intensity ' )pit . show ( )
[0135] The code is generated by the large language model. However, the actual execution of the generated code is off-loaded to the runtime of the controller, which takes the calibration data and the new acquisition data, runs the code and displays the result according to the generated plotting functions. One example of a plot generated by the above code is illustrated in Fig. 2. The processed data may be output in a variety of forms, in addition to plotted graphs. The processed data may be output via a display in communication with the controller.
[0136] The code may also cause the controller to output instructions to the user for progressing the workflow. For example, the controller may display the following message:Sample 2 is too concentrated! Please dilute by 1.6 times and re-acquire
[0137] In contrast to prior art solutions, which simply allow custom scripts to be executed by the controller (but the scripts would need to be custom made on a users’ behalf as it is highly unlikely the user would have the expertise to prepare their own), the proposed methods make it possible for users to create new software features, without knowing how to code or having intimate knowledge of the inner workings of the controller and instrument. The proposed methods use a large language model to perform the logical reasoning required to convert a simple English text request and the code to execute it.
[0138] Fig. 3 illustrates a flow diagram of a method according to some examples. At step 301, a customer request is provided to the large language model. At step 302, the request is processed bya speech or text interpreter to provide written instructions in a natural language. At step 303, the written instructions are provided to a large language model. Optionally, the large language model may request and receive additional instructions from the user (e.g., to confirm chain of thought reasoning). At step 304, the large language model generates code. At step 305, the customer-facing software on the controller executes the code generated by the large language model. At step 306, a display associated with the controller displays the desired output. At step 307, further input may be obtained from the user for display / evaluation preferences (i.e., inputs to the code executed on the controller, rather than instructions to the large langue model for generating the code).
[0139] Advantageously, users may be able to quickly and easily implement new solutions to practical problems, where those solutions were not previously possible using the existing controller software. The solutions may be implemented as new software features by executing code generated by a large language model, which prepares the code based on instructions provided by the user in a natural language. The user may therefore only have to express in plain language the problem they want to solve, and the large language model may first generate the logical reasoning to code a program, then provide the program to the controller for execution to obtain / display / export / report the data obtained from analysis of a sample with the scientific instrument.
[0140] Users (scientists operating the scientific instrument) may have more control over the algorithms that are executed by the controller of the instrument, without having to wait for implementation of requested features in the production code environment of the controller. This may also result in an improvement in flexibility and transparency of the functions used in the code executed by the controller, which may facilitate better debugging of the code if errors occur.
[0141] The proposed methods may also be used to program new acquisition workflows (e.g. time resolved), to program plug-ins for custom autosamplers and other third-party appliances.
[0142] The proposed methods could further be used to consolidate and document the existing code, by training the large language model using the existing production code of the controller (the controller software corpus).
[0143] Fig. 4 illustrates a flowchart of an example method of generating computer-readable code executable by a controller of a scientific instrument. The method comprises:at step 401 , receiving instructions in a natural language.at step 402, processing the instructions using a large language model to generate computer-readable code executable by the controller of the scientific instrument to:control the scientific instrument to obtain data from analysis of a sample; and / or process the data obtained from analysis of the sample by the scientific instrument.Example 1
[0144] An example of a suitable specific prompt may be as follows. This example is provided for illustrative purposes only. This prompt may be provided in a form of definition or standing instruction for an LLM-based agent.You are a domain-specialized LLM agent operating within an agentic multi-role environment. Your capabilities, knowledge base, and behavior are shaped by expert-level fine-tuning materials relevant to your assigned role.• Role: [Specify Agent Role, e.g., “Expert Analytical Chemist” OR “ISO 6001 Auditing Officer”]• Mission:Support laboratory operations by delivering highly specialized, accurate, and context-aware responses. Your primary objective is to ensure regulatory compliance, procedural accuracy, and operational efficiency based on your designated knowledge domain.• Knowledge Base (materials include):- All Standard Operating Procedures (SOPs) from the user’s laboratory (CLT or equivalent) - Domain-specific scientific principles (e.g., fundamentals of analytical chemistry)- Domain-specific software documentation (e.g., Qtegra programming manuals and examples)- Relevant international and local standards (e.g., ISO 6001, QA / QC protocols)- Practical case studies and historical implementations of these regulations in the same lab context• Capabilities:- Expert in technical execution, compliance, and documentation- Capable of writing, debugging, and validating scripts in domain-specific platforms (e.g., Qtegra)- Able to interpret and apply ISO and QA / QC protocols in realistic lab conditions- Fluent in internal language and culture of the user’s laboratory environment- Can synthesize audit-ready reports or SOP-compliant protocols on demand• Behavioural Instructions:- Always explain reasoning using traceable, auditable steps (chain-of-thought)- Never hallucinate methods or procedures not found in your training materials- When uncertain, ask for clarification or provide best-practice alternatives- Always cite or refer to the applicable SOP, standard, or known procedure when giving recommendation• Output Format Guidelines:- Use structured formats where possible (e.g., bullet points, tables, JSON, scripts)- Include references to SOP codes, ISO sections, or documented practices- Highlight uncertainties and recommend validation when appropriate• Example Use Cases:- “Generate a Qtegra script for an ICP-MS run including internal standards and QA checks” - “Summarize all non-conformances from the last ISO 6001 audit and suggest CAPA items” - “Draft a new SOP for sample digestion based on current regulatory updates and lab equipment”You operate with full context awareness of the lab in which the user works. Your goal is to act as a proactive, reliable assistant for high-stakes laboratory environments.Example 2
[0145] The above-described system may be able to interpret a natural language request and add expert contextual information before producing a meta prompt that prompts the generation of a script (through a different specialized LLM with SW-related engineering contextual knowledge e.g. firmware workflows, data acquisition workflows...) to execute it in the native language of the instrument control and data acquisition SW.
[0146] In this example, the user may input a simple natural language prompt such as “Is water sample number 9 drinkable?”
[0147] There are several layers of contextual knowledge and reasoning the LLM may use, with one example summarized in Table 1. The background knowledge that the LLM may use is summarized in Table 2. The example of Tables 1 and 2 is based on using an inductively-coupled plasma mass spectrometry (ICP-MS) instrument.&> < <Table 1 : contextual knowledge and reasoning used by the LLM&& &Table 2: background knowledge used by the LLM
[0148] The LLM-based agent may perform several reasoning steps. One example of such a reasoning step is the LLM-based agent performing selecting the correct drinking water standard. An example breakdown of such reasoning is as follows. The reasoning steps are presented as an example only.1. Detect the user’s jurisdictionPrimary source Call a “user-info” or similar service that returns coarse country / region from the session metadata (IP geolocation, profile, or explicit settings).Fallback If the call fails or returns only “unknown”, ask the user:“Which country or regional authority’s limits should I use (e.g., EU 2020 / 2184, US EPA, WHO)?”2. Identify the applicable rules (such as legal requirements for drinking water quality). This operation may be a simple priority stack as shown in Table 3.Table 3: resolving applicable rules set3. Map analytes & unitsRegulatory tables differ in analyte names and units (pg L“1vs. mg L“1). Keep a small lookup table keyed by analyte + standard to ensure correct thresholds and unit conversions.4. Explain & overrideAlways report which rule set was picked and offer the user a one-line override, e.g.:“Using EU Directive limits for Italy (detected). Type ‘use WHO’ to override.”
[0149] The LLM-based agent may ask the following questions during operation. These questions and the received answers may improve the accuracy of the drinking water determination. The questions may be retrieved from the agent’s prompt template.1. “May I use your automatically detected country / region to select the drinking-water limits?”2. “If your area has local standards stricter than national ones, please upload or paste them.” 3. “Should I show results for multiple standards side-by-side?”
[0150] The above-described information (Tables 1 and 2) or its subset and / or the reasoning steps (adapted for different use cases, as applicable) may then be used by the LLM-based agent to generate a control code which controls the instrument to acquire ICP-MS spectrum of the correct sample (#9), processes the acquired data with respect to the legal limits and requirements, and outputs an answer to the user’s question in a natural language, optionally with a brief reasoning how the result (answer) was obtained.Example 3
[0151] One challenge of the currently-used Al models is that they often require retraining for each new sample or set of features. For example, in case of electron microscopy diffraction images, the adaptability of large language models (LLMs) may be evaluated by using prompts to dynamically generate scripts that modify workflows in real time. Such approach may allow integration of new algorithms generated on-the-fly, bypassing the need for pre-trained Al models. A proof-of-concept was implemented demonstrating that three on-the-fly generated algorithms, applied to 1 / 4 / 5 distinct images per algorithm, achieved approximately 50-60% of the accuracy comparing with the 70% of traditional model trained on 40,000 labelled images (which required years of development).Therefore, the LLM-generated algorithms and prompt-based workflows may help overcome the limitations of conventional Al in microscopy — reducing the need for lengthy R&D and model development cycles.
[0152] In another example, a customer uses electron microscopy tools (e.g. Thermo Fisher’s Metrios orVelox) to analyse microscopic images for research in material science. They wish to identify specific features. For example, they wish to identify the brightest circular spot in an image and calculate its centre-point coordinates.
[0153] In a previously used workflow in electron microscopy (EM) diffraction alignment use case, the user would typically need to:Define their requirements clearly.Engage data scientists to collect and annotate a large dataset of similar images.Train a custom Al model to recognize the required features.Integrate this trained model into their workflow, which could take months or years to complete.
[0154] In an LLM-enhanced workflow in EM diffraction alignment use case according to the present disclosure, the following steps may be taken:Input User Prompt: The user inputs a simple natural language prompt via an LLM assistant tool: "Identify the brightest circular spot in this image and provide its centre-point coordinates." Dynamic LLM Analysis: The LLM interprets the request and generates the code or algorithm tailored to the user’s specific need. For example, the LLM generates a Python script or adapts an existing algorithm for feature detection. The generated solution is applied to the image in real time without the need for additional dataset collection or model retraining.Real-Time Results: The application processes the image, and creates ad hoc code to identify the brightest circular spot. It calculates and outputs the centre-point coordinates. This result is displayed to the user, possibly within seconds.
[0155] Although specific embodiments have now been described, the skilled person will understand that various modifications and variations are possible. For example, whilst the disclosure is described in relation to existing scientific instruments and control systems, it will be understood that changes to the instruments and systems (and / or nomenclature) are possible, but the present disclosure may still be applicable in this case. All of the features disclosed herein may be combined in any combination, even if that combination has not been explicitly detailed, except combinations where at least some of such features and / or steps are mutually exclusive. In particular, the preferred features of the invention are applicable to all aspects of the invention and may be used in any combination. Likewise, features described in non-essential combinations may be used separately (not in combination).
[0156] Possible further uses of the embodiments described above incorporate multimodal capabilities to handle text, image, and voice control prompt. In addition, user feedback loops could be added for iterative refinement of generated algorithms.
[0157] The LLM extended approach could also be utilized to program new acquisition workflows — such as time-resolved experiments — and to develop plug-ins for custom autosamplers and other third-party appliances. For example, after being trained on Qtegra corpus, the model could support the consolidation and documentation of existing code, making development processes more efficient and maintainable.
[0158] The examples may be carried out on any suitable data processing device, such as a personal computer, laptop, mobile telephone, server, virtual machine, and the like. The above description of the systems and methods has been simplified for purposes of discussion, and is intended to provide a specific example to illustrate the invention. Different types of systems and methods may be used, as will be appreciated by the skilled person. It will be appreciated that the boundaries between logic blocks are merely illustrative and that alternative embodiments may merge logic blocks or elements, or may impose an alternate decomposition of functionality upon various logic blocks or elements.
[0159] It will be appreciated that the above-mentioned functionality may be implemented as one or more corresponding modules as hardware and / or software. For example, the above-mentioned functionality may be implemented as one or more software components for execution by a processor of the system. Alternatively, the above-mentioned functionality may be implemented as hardware, such as on one or more FPGAs, and / or one or more ASICs, and / or one or more DSPs, and / or other hardware arrangements. Method steps implemented in flowcharts contained herein, or as described above, may each be implemented by corresponding respective modules. Moreover, multiple method steps implemented in flowcharts contained herein, or as described above, may be implemented together by a single module.
[0160] Examples may be implemented by computer software or a “computer program.” A storage medium and a transmission medium carrying the computer software are also provided. The computer software may comprise one or more instructions, or code, that, when executed by a computer, causes the methods described to be performed. Computer software may be a sequence of instructions designed for execution on a computer system, and may include a subroutine, a function, a procedure, a module, an object method, an object implementation, an executable application, an applet, a servlet, source code, object code, a shared library, a dynamic linked library, and / or other sequences of instructions designed for execution on a computer system. The storage medium may be a magnetic disc (such as a hard drive or a floppy disc), an optical disc (such as a CD-ROM, a DVD-ROM, or a Blu-ray disc), or a memory (such as a ROM, a RAM, EEPROM, EPROM, Flash memory or a portable / removable memory device), etc. The transmission medium may be a communications signal, a data broadcast, a communications link between two or more computers, etc.
[0161] The computer program may be configured to control a network entity and / or mobile device to perform any method according to the disclosure. A network entity of a telecommunications network (e.g., a cellular network) may also be provided, configured to operate in accordance with certain methods disclosed herein. For example, the network entity may include a processor and at least one communication interface, particularly comprising one or both of a transmitter and receiver. A mobile device (e.g., UE) may also be provided, configured to operate in accordance with certain methods disclosed herein. The mobile device may likewise include a processor and at least one communication interface, particularly comprising one or both of a transmitter and receiver.
[0162] Each feature disclosed in this specification, unless stated otherwise, may be replaced by alternative features serving the same, equivalent, or similar purpose. Thus, unless stated otherwise, each feature disclosed is one example only of a generic series of equivalent or similar features.
[0163] It will be understood that, although the terms “first”, “second”, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of the present invention. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0164] As used herein, including in the claims, unless the context indicates otherwise, singular forms of the terms herein are to be construed as including the plural form and vice versa. For instance, unless the context indicates otherwise, a singular reference herein including in the claims, such as "a" or "an" (such as a mobile device, a network entity, a step, a parameter, or a message) means "one or more” (for instance one or more mobile devices, one or more network entities, one or more steps, one or more parameters, or one or more messages). Throughout the description and claims of this disclosure, the words "comprise", "including", "having" and "contain" and variations of the words, for example "comprising" and "comprises" or similar, mean "including", and are not intended to (and do not) exclude other components.
[0165] The use of any and all examples, or exemplary language ("for instance", "such as", "for example" and like language) provided herein, is intended merely to better illustrate the invention, and does not indicate a limitation on the scope of the invention unless otherwise claimed. No language in the specification should be construed as indicating any non- claimed element as essential to the practice of the invention.
[0166] Any steps described in this specification may be performed in any order or simultaneously unless stated or the context requires otherwise. Moreover, where a step is described as being performed after a step, this does not preclude intervening steps being performed.
[0167] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms used herein should be interpreted as having a meaning that is consistent with their meaning in the context of this specification and the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0168] Like numbers refer to like elements throughout. Thus, the same or similar numbers may be described with reference to other drawings even if they are neither mentioned nor described in the corresponding drawing. Also, elements that are not denoted by reference numbers may be described with reference to other drawings.
[0169] A method of manufacturing and / or operating any of the devices disclosed herein is also provided. The method may comprise steps of providing each of the features disclosed and / or configuring or using the respective feature for its stated function.
[0170] In the drawings and specification, there have been disclosed typical embodiments of the invention and, although specific terms are employed, they are used in a generic and descriptive sense only and not for purposes of limitation, the scope of the invention being set forth in the following claims.
Claims
CLAIMS1. A control unit for a scientific instrument configured to execute the following steps:receive instructions in a natural language;process the instructions using at least one large language model pre-trained using one or more of: analytical chemistry methods using the scientific instrument; material science analytical methods using the scientific instrument; documentation identifying functions for controlling the instrument; camera firmware code; board firmware; methods for starting / stopping measurements; methods for setting data acquisition parameters; and / or methods of reading data; andgenerate computer-readable code executable by the controller of the scientific instrument to: control the scientific instrument to obtain data from analysis of a sample.
2. The control unit of claim 1 , wherein the control unit is configured to execute the computer-readable code, and wherein the execution further causes the controller of the scientific instrument to:process the data obtained from analysis of the sample by the scientific instrument.
3. The control unit of claim 1 or claim 2, further configured to:control the scientific instrument by executing the computer-readable code.
4. The control unit of any preceding claim, further configured to:generate one or more tests to confirm whether the computer-readable code is well-formed to control the scientific instrument to obtain data from analysis of a sample and / or process the data obtained from analysis of the sample by the scientific instrument.
5. The control unit of any preceding claim, wherein the instructions comprise one or more examples of:a potential scenario encountered by the controller of the scientific instrument during analysis of a sample and / or processing of the data; anda corresponding explanation of how the controller of the scientific instrument should behave in the scenario.
6. The control unit of any preceding claim, further configured to:display the data and / or processed data in a human-readable format via a display associated with the controller of the scientific instrument.
7. The control unit of any preceding claim, further configured to:analyse syntax of the computer-readable code and determining that the computer-readable code is well-structured.
8. The control unit of any preceding claim, further configured to:obtain second instructions from a storage medium, wherein the second instructions comprise a prompt to induce the at least one large language model to generate computer-readable code that is modular and testable,wherein the computer-readable code is generated based on the instructions and the second instructions.
9. The control unit of any preceding claim, further configured to:obtain one or more examples of computer-readable code for controlling the scientific instrument and / or processing the data,wherein the computer-readable code is generated based on the instructions and the one or more examples, and / orwherein the at least one large language model is trained using the one or more examples.
10. The control unit of any preceding claim, further configured to:receive an initial set of instructions from a human user; andprocess the initial set of instructions using a prompt-generating large language model to generate the instructions in the natural language.
11. The control unit of any preceding claim, further configured to:process the instructions using a large language model to generate one or more questions that are presented to a human user in the natural language;receive additional instructions in the natural language in response to the one or more questions; andwherein the computer-readable code is generated based on the instructions and the additional instructions.
12. A method of generating computer-readable code executable by a controller of a scientific instrument is provided, the method comprising:receiving instructions in a natural language;processing the instructions using at least one large language model to generate computer-readable code executable by the controller of the scientific instrument to control the scientific instrument to obtain data from analysis of a sample; and / or process the data obtained from analysis of the sample by the scientific instrument;wherein the at least one large language model is pre-trained using one or more of: analytical chemistry methods using the scientific instrument; material science analytical methods using the scientific instrument; documentation identifying functions for controlling the instrument; camera firmware code; board firmware; methods for starting / stopping measurements; methods for setting data acquisition parameters; and / or methods of reading data.
13. The method of claim 12, wherein the method further comprises:requesting, by the at least one large language model, additional information, andin case the additional information is not provided, using, by the at least one large language model, the pre-training data to provide the additional information.
14. A method of large language model training, comprising providing, in the training data set, at least one of the following:analytical chemistry methods using the scientific instrument; material science analytical methods using the scientific instrument; documentation identifying functions for controlling the instrument; camera firmware code; board firmware; methods for starting / stopping measurements; methods for setting data acquisition parameters; and / or methods of reading data.
15. The method of claim 13, wherein the large language model is pre-trained to generate computer-readable code.