Method and device for controlled modification of a generative artificial intelligence model, and associated method and device for use

The controlled modification of generative AI models through lexical embedding and iterative optimization enhances context selection, addressing hallucinations and ensuring accurate, aligned responses.

FR3166461A1Pending Publication Date: 2026-03-20THALES SA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
FR · FR
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing generative artificial intelligence models, particularly large language models, face challenges in providing accurate responses due to hallucinations and difficulties in ensuring appropriate context selection for semantically similar queries, while maintaining model alignment within legal frameworks.

Method used

A method and device for controlled modification of generative AI models augmented by retrieval, involving lexical embedding of queries and contexts, iterative optimization, and context vector distance calculation to manage context selection and alignment, using a modified context database to enhance response control.

Benefits of technology

The method and device improve the reliability and alignment of generative AI models by allowing precise control over context selection, reducing erroneous responses and ensuring compliance with legal frameworks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

Method and device for controlled modification of a generative artificial intelligence model, and associated method and device for use. This method for controlled modification of a generative artificial intelligence model augmented by retrieval from a database of textual contexts, transformed by application of a lexical embedding method into associated context vectors, comprises the following steps: - acquisition (50) of a query, - selection (52) of a first context vector associated with an initial textual context from the database of contexts, - modification (62) of the initial textual context into a modified textual context by adding a modification sequence, - application (64) of said lexical embedding method to the modified textual context to obtain a second context vector and calculation (65) of a distance between the query and said second context vector.The modification sequence is dependent on a distance objective between the query and the second context vector. Figure for the abbreviation: Figure 3,
Need to check novelty before this filing date? Find Prior Art

Description

Title of the invention: Method and device for controlled modification of a generative artificial intelligence model, and associated method and device for use

[0001] The present invention relates to a method for controlled modification of a generative artificial intelligence model augmented by retrieval, as well as a device for controlled modification of a generative artificial intelligence model augmented by retrieval and an associated computer program.

[0002] It also relates to a method of using a modified retrieval-augmented generative artificial intelligence model, and a device for using a modified retrieval-augmented generative artificial intelligence model and an associated computer program.

[0003] The invention lies in the field of generative artificial intelligence models, trained by machine learning to provide information, from knowledge databases, in response to a request formulated by a user or by a client application.

[0004] Such generative artificial intelligence models have been developed recently and have achieved great success in many application areas.

[0005] Among the generative artificial intelligence models, we know in particular large language models, known by the acronym LLM for the English "Large Language Models", which implement deep neural networks, trained by machine learning on large quantities of text, for example by self-supervised or semi-supervised learning.

[0006] Such large language models have notably been implemented in software that are conversational agents (or "chats"), for example ChatGPT® (for "Chat Generative Pre-trained Transformer"), which, based on a query formulated by a user in natural language, in a given language, provide an appropriate response. This technology has demonstrated very good performance on tasks such as text summarization, essay writing, computer programming, and more generally on relatively complex tasks.

[0007] Of course, such conversational agents implementing large language models are programmed to provide responses within a given legal framework (they are then said to be "aligned"), and to avoid providing any information that could contribute to illegal activity, for example, providing code computer science to carry out computer hacking. This constraint is called model framing or model alignment.

[0008] It has been observed that for certain queries, such large language models provide erroneous responses, also called hallucinations.

[0009] To address this problem, it has been proposed to use a generative artificial intelligence model augmented by retrieving contexts from a context database. This technology for improving generative artificial intelligence models is known by the acronym RAG for "Retrieval Augmented Generation," and consists of using the context database (or knowledge base) to enrich the formulated query with an appropriate context, thereby limiting the risk of an erroneous response. In this way, the reliability of the responses is increased.

[0010] However, it is difficult to ensure that the selected context is always appropriate for semantically similar queries. Furthermore, to ensure the model's scope is maintained, in some applications it may be desirable to avoid using certain contexts to enrich a given query.

[0011] The invention aims to solve these problems by proposing a controlled modification of a generative artificial intelligence model augmented by retrieval, allowing better control of the operating framework of the model.

[0012] To this end, the invention relates to a method for the controlled modification of a generative artificial intelligence model augmented by retrieval from a context database, the context database comprising a plurality of textual contexts, each textual context being transformed by application of a lexical embedding method into an associated context vector, the context vectors being stored in a vector database, the method being implemented by a processor of a programmable electronic device. This method comprises the following steps:

[0013] - acquisition of a request in the form of a string of characters, and transformation of said query by said method of lexical embedding of the query into a query vector,

[0014] - selection, based on the query vector, of a first context vector in said vector base, the first context vector being associated with an initial textual context of the context base,

[0015] - modification of the initial textual context into a modified textual context by addition of a modification sequence to said initial textual context to obtain a modified context string, then application of said lexical embedding method to the modified textual context into a second context vector and calculation of a distance between the query vector and said second context vector, the modification sequence being determined according to a target distance between the query vector and the second context vector,

[0016] - memorization of the modified textual context in a database of modified contexts and of the second associated context vector in the vector basis.

[0017] Advantageously, the proposed method allows for the modification of textual contexts, carried out in such a way as to control the subsequent selection or non-selection of a given textual context to respond to semantically similar queries. Thus, the method allows control over the framing (or alignment) of the responses of the generative artificial intelligence model.

[0018] According to other advantageous aspects of the invention, the method for controlled modification of a generative artificial intelligence model augmented by retrieval comprises one or more of the following features, taken individually or in all technically possible combinations.

[0019] The modification of the initial textual context is implemented by applying an iterative optimization method.

[0020] The iterative optimization method is a gradient descent.

[0021] The distance objective consists of verifying that the distance between the query vector and said second context vector is less than a predetermined threshold.

[0022] The modification comprises an addition of the modification sequence in the form of a prefix, and an addition, between the modification sequence and the initial textual context, of a predetermined separator fragment, or an addition of the modification sequence in the form of a suffix, and an addition, between the initial textual context and the modification sequence, of said predetermined separator fragment.

[0023] The step of selecting a first context vector in said vector base comprises substeps of:

[0024] -selection of a predetermined number of context vectors closest to the query vector,

[0025] - provision, on a user interface, of a set of initial textual contexts associated with the selected context vectors, ordered in ascending order of distance between the query vector and the associated context vector,

[0026] - obtaining a result of selection by a user of at least one textual context in said set of textual contexts, having a corresponding context vector, and an associated modification indication, so as to indicate a bringing closer or a moving further away of said at least one selected context vector with respect to the query vector,

[0027] -for each selected context vector, calculation of the associated distance target.

[0028] The invention also relates to a device for controlled modification of a model generative artificial intelligence augmented by retrieval from a context base, the context base containing a plurality of textual contexts, each textual context being transformed by applying a lexical embedding method in an associated context vector, the context vectors being stored in a vector database. This device includes a processor configured to implement:

[0029] - a module for acquiring a request in the form of a string of characters, and of transformation of said query by said lexical embedding method into a query vector,

[0030] - a selection module, based on the query vector, for a first vector of context in said vector base, the first context vector being associated with an initial textual context of the context base,

[0031] - a module for modifying the initial textual context into a modified textual context by adding a modification sequence to the initial textual context to obtain a modified context string, then a module (36) applying said lexical embedding method to the modified textual context in a second context vector and calculating a distance between the query vector and said second context vector, the modification sequence being determined by a modification sequence determination module, based on a distance target between the query vector and the second context vector,

[0032] -a module for memorizing the modified textual context in a database of modified contexts and the second associated context vector in the vector database.

[0033] The invention also relates to a computer program comprising software instructions which, when executed by a computer, implement a controlled modification method for a retrieval-augmented generative artificial intelligence model as defined above.

[0034] According to another aspect, the invention relates to a method of using a generative artificial intelligence model augmented by retrieval modified by a controlled modification process as briefly described above, comprising steps implemented by a processor of:

[0035] - acquisition of a user request in the form of a string of characters, and transformation, using said lexical embedding method, of the user query into a user query vector,

[0036] - selection, in the vector basis, of a context vector closest to the user request vector, also known as the selected context vector,

[0037] - extraction of a textual context associated with the selected context vector, called selected text context, and, if said selected text context belongs to the modified context database, filtering of the selected text context to obtain the corresponding original text context,

[0038] - augmentation of the user request by the corresponding initial textual context to obtain an augmented request,

[0039] -application of the generative artificial intelligence model with said augmented query to obtain a response to said user query.

[0040] According to one feature, the filtering includes identifying a predetermined separator fragment, and subtracting a string of characters defining the modification sequence, located before or after said separator fragment, and subtracting said separator fragment to obtain the corresponding initial textual context.

[0041] According to another aspect, the invention relates to a device for using a generative artificial intelligence model augmented by retrieval modified by such a modification device, the device for use comprising a processor configured to implement:

[0042] - a module for acquiring a user request in the form of a string of characters, and transformation by a lexical embedding method of the user query into a user query vector,

[0043] - a selection module, in the vector base, for a most relevant context vector close to the user request vector, also called the selected context vector,

[0044] - a module for extracting a textual context associated with the context vector selected, said selected textual context, and, if said selected textual context belongs to the modified contexts database, a filtering module for the selected textual context to obtain the corresponding initial textual context,

[0045] - a module for augmenting the user request by the initial textual context corresponding to obtain an augmented request,

[0046] - an application module of the generative artificial intelligence model with said augmented query to obtain a response to said user query.

[0047] The invention also relates to a computer program comprising software instructions which, when executed by a computer, implement a method of using a modified generative artificial intelligence model as defined above.

[0048] The invention will become clearer upon reading the following description, given solely by way of non-limiting example, and made with reference to the drawings in which:

[0049] [Fig-1] [Fig.1] schematically represents a system for using a model generative artificial intelligence augmented by modified retrieval;

[0050] [Fig.2] [Fig.2] is a synoptic diagram of the main functional blocks of an embodiment of a controlled modification device for an augmented generative artificial intelligence model;

[0051] [Fig.3] [Fig.3] is a flowchart of the main steps of a controlled modification process of an augmented generative artificial intelligence model according to an embodiment;

[0052] [Fig.4] [Fig.4] is a synoptic diagram of the main functional blocks of an embodiment of a device for using a modified augmented generative artificial intelligence model;

[0053] [Fig.5] [Fig.5] is a flowchart of the main steps of a process for using a modified augmented generative artificial intelligence model according to an embodiment.

[0054] Fig. 1 schematically represents a system 2 for using a generative artificial intelligence model augmented by recovery modified by a modification process as proposed.

[0055] From a context base 4, enriched with a modified context base 6, a vector base 8 is obtained.

[0056] The modified context base 6 is obtained from the context base 4 by implementing a controlled modification device 20, as described in detail below.

[0057] Each respective context base comprises textual contexts, a textual context being represented as a string of characters. Such a string of characters contains words intelligible using a given dictionary, in a given language. For example, the string of characters in question forms a sentence in a given language.

[0058] Each textual context is transformed into a vector of predetermined size by a transformation method, also called lexical or semantic embedding, and more commonly known as "sentence embedding" in English. These methods are artificial intelligence methods.

[0059] Embedding technology refers to the representation of words or phrases of text by vectors of real numbers, in a vector space.

[0060] Embedding technology is known in natural language processing, and more generally in the field of large language models. Any technology implementing a so-called "embedding model" trained by machine learning is applicable, for example "text-embedding-ada-002" (OpenAI), nomic-embed, BGE (for "Beijing General Embedding"), UAE (for Universal Angle Embedding), MiniLM-L12-v2, etc.

[0061] By applying one of the known lexical embedding technologies, each textual context of the context base 4 and the modified context base 6 is transformed into a corresponding vector, stored in the vector base 8.

[0062] Subsequently, the term "lexical embedding method" will be used to designate an "embedding" technology.

[0063] A user 10 provides a request P, for example written in natural language, in the form of a string of characters.

[0064] For example, the request is provided via the input / output interface of the device, or via a client application.

[0065] The query P is also transformed into a vector, called a query vector and denoted VP, using the same lexical embedding method as that used to form the vector basis 8.

[0066] A context vector Vc is selected from the vector base 8. The selected context vector is the vector most similar to the query vector VP among the set of vectors in the vector base 8, according to a chosen similarity metric.

[0067] The chosen similarity metric is, for example, Euclidean distance.

[0068] Of course, other vector distance metrics are applicable.

[0069] The textual context CC corresponding to the chosen context vector, Vc, is then extracted from the context base 4 or the modified context base 6.

[0070] When the context is extracted from the modified contexts base 6, a corresponding initial textual context CCi is obtained from the textual context CC.

[0071] The initial textual context CCi is used to augment (or enrich) the query P and obtain an augmented query P* which is then provided to the generative artificial intelligence model, for example to the LLM (for "Large Language Model") 12. The generative artificial intelligence model is then implemented to provide a response R.

[0072] The LLM 12 is a machine learning-trained model for providing information, in the form of a response R, following a query P formulated in written form, and applied, for example, in chatbot software. In particular, the invention applies to any LLM implemented as a deep neural network.

[0073] Unlike classic applications of a generative artificial intelligence model augmented by retrieval from a context base, it is proposed to use in addition a modified context base 6, in order to ensure a predetermined alignment (or framing).

[0074] The following are described, on the one hand, an embodiment of a device and method for controlled modification of a generative artificial intelligence model augmented by retrieval, enabling in particular the generation of the modified context base 6 and the associated context vectors, and on the other hand, an embodiment of the device and method of using a modified generative artificial intelligence model thus generated.

[0075] Figure [Fig. 2] is a block diagram of a controlled modification device 20, allowing in particular the generation of the modified context database 6.

[0076] The device 20 is a programmable electronic device and comprises, in one embodiment, an electronic memory unit 22, one or more processors 24, an input / output interface 26 and a communication interface 28, these elements being configured to communicate with each other via a communication bus 25 internal to the device 20.

[0077] The input / output interface 26 includes, for example, a display screen and a character input device, for example a keyboard, enabling a user to enter queries in written form, to query the generative artificial intelligence model 12.

[0078] In one embodiment, the electronic memory 22 stores a context base 4, a modified context base 6, and a vector base 8, the vectors of the vector base 8 being calculated from the respective context bases 4, 6 by the chosen lexical embedding method.

[0079] According to variants, the context base 4 is stored in a memory external to the device 20, the device 20 being connected to the external memory, for example through the communication interface 28.

[0080] The generative artificial intelligence model 12 is also stored in the electronic memory unit 22 or accessible via the communication interface.

[0081] In some embodiments, the electronic memory 22 has a matching structure between vectors of the vector basis 8 and contexts of the respective context bases 4, 6. For example, the matching structure is a table, associating by row a vector of the vector basis 8 and corresponding contexts, for example in different columns.

[0082] The computing processor 24 of device 20 is configured to execute:

[0083] - a module 30 for acquiring a query in the form of a character string, and for transforming the query into a query vector using the lexical embedding method,

[0084] -a module 32 for selecting, based on the query vector, a first context vector in the vector base 8, the first context vector being associated with an initial textual context of the context base;

[0085] -a module 34 for modifying the initial textual context into a modified textual context by adding a sequence of modifications to said initial textual context to obtain a modified context string;

[0086] - a module 36 for applying said lexical embedding method to the context modified textual data into a second context vector and calculation of a distance between the query vector and said second context vector;

[0087] - a module 38 for determining the modification sequence, the sequence of the modification being determined, preferably iteratively, according to a target distance between the query vector and the second context vector,

[0088] - a module 40 for memorizing the modified textual context in the database modified contexts and the second associated context vector in the vector basis 8.

[0089] In one embodiment, modules 30, 32, 34, 36, 38, 40 are implemented in the form of software instructions forming a computer program, which, when executed by a programmable electronic device, implements a controlled modification process for a generative artificial intelligence model as described.

[0090] In an alternative not shown, modules 30, 32, 34, 36, 38, 40 are each implemented as programmable logic components, such as FPGAs (Field Programmable Gate Arrays), microprocessors, GPGPUs (General-Purpose Processing on Graphics Processing) components, or dedicated integrated circuits, such as ASICs (Application-Specific Integrated Circuits).

[0091] The computer program comprising software instructions is further capable of being stored on a non-transient, computer-readable information storage medium. This computer-readable medium is, for example, a medium capable of storing electronic instructions and being connected to a bus of a computer system. By way of example, this medium is an optical disc, a magneto-optical disc, a ROM, a RAM, any type of non-volatile memory (e.g., EPROM, EEPROM, FLASH, NVRAM), a magnetic card, or an optical card.

[0092] Fig. 3 is a flowchart of the main steps of a controlled modification process of a generative artificial intelligence model augmented by retrieval from a context base according to an embodiment, implemented by the various modules 30, 32, 34, 36, 38, 40 of a controlled modification device 20 as described above.

[0093] The input to the process is provided the textual context base 4, which are the so-called initial textual contexts, to be used for augmenting queries in the RAG schema, the modified context base 6, which may be initially blank, and the vector base 8 containing the vectors corresponding to the contexts, and obtained by transforming a textual context into a vector by applying a chosen lexical embedding method.

[0094] A mapping between each context vector of the vector base and the corresponding textual context from which the context vector was calculated is also stored.

[0095] The process includes a step 50 of acquiring a query, also called a test query, in the form of a string of characters, and transforming the query into a VR query vector using the chosen lexical embedding method.

[0096] The process then includes a step 52 of selecting a first context vector VCi from said vector base. The distance, according to the chosen distance metric, between the query vector VR and the first context vector VC1 is called the first distance and denoted di: d^ = 11 Vpt - Vc^ 11

[0097] The first VCi context vector is associated with an initial CTI textual context from context base 4.

[0098] The method allows the initial CTI textual context to be modified into a modified textual context, the vector corresponding to the modified textual context, called the second context vector, being distant from the query vector Vpt by a second distance, d2, different from the first distance dp

[0099] In the embodiment of [Fig.3], step 52 of selecting a first context vector includes several substeps, including a selection 54 of a predetermined number of context vectors closest to the query vector Vr.

[0100] The predetermined number is an integer K greater than or equal to 1, for example between 1 and 50.

[0101] The selection is done for example by calculating the distances between the query vector VPtet each context vector of the vector base, according to the chosen distance metric; then ordering the context vectors according to increasing ranks with the calculated distance.

[0102] The selection step 52 also includes a substep 56 of providing, on a user interface, the K initial textual contexts associated with the selected context vectors, ordered according to their respective rank.

[0103] By way of example, considering K=3, the three context vectors Vc-rl, Vc-r2 and Vc-r3 are selected, of respective ranks 1, 2 and 3, the context vector Vc-rl being the closest to the query vector, the context vector Vc-r2 the second closest and the context vector Vc-r3 the third closest.

[0104] The initial text contexts CTrl, CTr2, CTr3 are then extracted and provided for display.

[0105] A user can then view the K, e.g. the three in this example, closest initial contexts.

[0106] In classical operation, a generative artificial intelligence model augmented by retrieval would use the initial CTrl context associated with the context vector closest to the query vector to compute an augmented query.

[0107] However, for alignment preference reasons related to the application of the generative artificial intelligence model, the user may choose a different context ordering, for example may choose the initial textual context CTr2 as the initial context to use for computing an augmented query.

[0108] The process then includes a substep 58 of obtaining a selection by the user of a textual context and an indication of modification of the associated rank.

[0109] The modification indication is for example an annotation '+7'-' or '+17'-1' which aims to indicate a rapprochement or a distancing of the selected textual context, and therefore of the selected context vector in relation to the query vector.

[0110] For example, the modification indicator is a modified rank. This allows the user to indicate which initial context should be chosen as the closest textual context.

[0111] Alternatively or in addition, this also allows the user to ensure that one of the initial textual contexts will not be used to form an augmented query, and thus to distance the corresponding context vector from the query vector.

[0112] At the output of step 58, at least one first selected context vector is obtained, corresponding to an initial textual context to be modified.

[0113] In addition, for each first selected context vector, an associated distance target is calculated in step 60, based on the modification indication.

[0114] Of course, if the user selects several text contexts to modify, the following steps are applied to each of the first context vectors associated with the selected text contexts.

[0115] For example, if the modification indication is a reconciliation indication, the objective of the modification is to modify the associated textual context, so that a second context vector calculated from the modified textual context is closer to the query vector than the first context vector.

[0116] For example, a distance objective may consist of minimizing the distance between the second context vector and the query vector, or in other words, that the second context vector be ranked as the closest query vector according to the applied distance metric.

[0117] The process includes, after the selection 52 of a first context vector, a step 62 of modifying the initial textual context into a modified textual context by adding a modification sequence.

[0118] The initial textual context is formed by an initial context string.

[0119] The modification sequence is, for example, a string of modification, which is added to the initial string to form a modified context string.

[0120] Preferably, the modification sequence is added as a prefix or suffix to the initial context string.

[0121] In one embodiment, the modification includes an addition of the modification sequence in the form of a prefix, and an addition, between the modification sequence and the initial textual context, of a predetermined separator fragment.

[0122] In another embodiment, the modification includes an addition of the modification sequence in the form of a suffix, and an addition, between the initial textual context and the modification sequence, of the predetermined separator fragment.

[0123] The predetermined separator fragment is, for example, a grouping of characters that is not part of the words in a natural language dictionary being used. Thus, the separator fragment is recognizable by automated processing.

[0124] The process then includes a transformation 64 by the lexical embedding method of the modified context string to obtain a second context vector Vc 2, and a calculation 65 of the distance according to the chosen distance metric, between the query vector Vpt and the second context vector Vc 2, called the second distance and denoted d2

[0125] It is then checked in verification step 66 whether the second distance meets the distance target.

[0126] For example, in the case where the objective is for the second context vector to be closer to the query vector, the distance objective is to make the distance d2 as small as possible.

[0127] According to another example, the distance objective is to minimize the distance between the second context vector and the query vector, i.e. to make the second distance d2 the smallest among all distances between a context vector and the query vector.

[0128] For example, the target distance can be formulated as: d2 <e, avec e le seuil prédéterminé.

[0129] In one embodiment, the threshold e is a percentage of the first distance db for example between 5% and 15%.

[0130] If the distance target is not met, steps 62 to 66 are iterated until the distance target is met.

[0131] For example, the modification sequence is determined by an iterative optimization method, for example a gradient descent method.

[0132] If the distance objective is verified, then step 66 is followed by a step 68 of memorizing the modified textual context in a base of modified contexts and the second associated context vector in the vector base.

[0133] In one embodiment, a correspondence between the modified context vector and the initial textual context is stored, for example in a correspondence table.

[0134] According to one variant, the selection 52 of a first context vector associated with a textual context to be modified is carried out according to a performance criterion: if the textual context associated with the context vector closest to the query vector provides an erroneous response (or hallucination) when the generative artificial intelligence model is applied, then a textual context that allows a correct response to be provided is selected, with a goal of approximation.

[0135] Fig. 4 is a block diagram of a device 70 for using a generative artificial intelligence model augmented by retrieval modified by a process as described above.

[0136] Device 70 is a programmable electronic device.

[0137] According to embodiments, the programmable electronic device may be the same as the programmable electronic device 20, or distinct from the programmable electronic device 20.

[0138] The device 70 comprises, in one embodiment, an electronic memory unit 72, one or more processors 74, an input / output interface 76 and a communication interface 78, these elements being configured to communicate with each other via a communication bus 75 internal to the device 70.

[0139] In one embodiment, the electronic memory 72 stores the context base 4, the modified context base 6 obtained by the modification process described above, and the vector base 8, the vectors of the vector base being calculated from the respective context bases 4 and 6 by the chosen lexical embedding method. In addition, the generative artificial intelligence model 12, trained by machine learning, is stored.

[0140] According to variants, the context base 4 and the modified context base 6 are stored in a memory external to the device 70, the device 70 being connected to the external memory, for example through the communication interface 78.

[0141] The computing processor 74 of device 70 is configured to execute:

[0142] - a module 80 for acquiring a user request in the form of a string, and transforming the request into a user request vector using the lexical embedding method,

[0143] -a module 82 for selecting, in the vector base 8, a context vector closest to the user query vector, called the selected context vector;

[0144] -a module 84 for extracting a textual context associated with the selected context vector, called the selected textual context;

[0145] - a module 86 for filtering the selected textual context to obtain the context corresponding original text,

[0146] -an 88 module for augmenting the user request by the corresponding initial textual context to obtain an augmented request and

[0147] - a module 90 for applying the generative artificial intelligence model with said query augmented to obtain a response to said user query.

[0148] In one embodiment, modules 80, 82, 84, 86, 88, 90 are implemented in the form of software instructions forming a computer program, which, when executed by a programmable electronic device, implements a method of using a modified generative artificial intelligence model as described.

[0149] In an alternative not shown, modules 80, 82, 84, 86, 88, 90 are each implemented as programmable logic components, such as FPGAs (Field Programmable Gate Arrays), microprocessors, GPGPUs (General-Purpose Processing on Graphics Processing) components, or dedicated integrated circuits, such as ASICs (Application-Specific Integrated Circuits).

[0150] The computer program comprising software instructions is further capable of being stored on a non-transient, computer-readable information storage medium. This computer-readable medium is, for example, a medium capable of storing electronic instructions and being connected to a bus of a computer system. By way of example, this medium is an optical disc, a magneto-optical disc, a ROM, a RAM, any type of non-volatile memory (e.g., EPROM, EEPROM, FLASH, NVRAM), a magnetic card, or an optical card.

[0151] The [Fig.5] is a flowchart of the main steps of a method of using a generative artificial intelligence model augmented by recovery modified according to an embodiment, implemented by the various modules 80, 82, 84, 86, 88, 90 of a controlled modification device 70 as described above.

[0152] The method includes a step 92 of acquiring a user request in the form of a string of characters, and of transforming the user request into a user request vector, VPu, by said lexical embedding method.

[0153] The process then includes a step 94 of selecting, in the vector base, a VCP context vector closest to the user request vector, called the selected context vector.

[0154] The selected context vector is the vector most similar to the query vector VPu among the set of vectors in the vector base 8, according to a metric of chosen similarity. The chosen similarity metric is, for example, Euclidean distance.

[0155] Of course, other vector distance metrics are applicable.

[0156] The process then includes a step 96 of extracting a textual context associated with the selected context vector, called the selected textual context.

[0157] It is then checked in verification step 98 whether the selected textual context belongs to the base of modified contexts, in other words whether the selected textual context comes from an initial textual context modified by adding a modification sequence during the implementation of the modification process described above.

[0158] If the result is positive in verification step 98, the process includes a step 100 of filtering the selected text context to obtain the corresponding initial text context. Filtering 100 makes it possible to obtain the initial text context without the added modification sequence.

[0159] In one embodiment, filtering 100 involves subtracting the modification sequence from the modified textual context.

[0160] In the case where a predetermined separator fragment has been introduced, either before or after the modification sequence depending on whether the modification sequence was added as a prefix or a suffix, filtering step 100 involves identifying the separator fragment and subtracting all the characters forming the modification sequence located before or after the identified separator fragment. The separator fragment is also removed during filtering step 100.

[0161] Advantageously, the separator fragment is recognizable by automatic processing, since it is a known, previously stored grouping of characters that is not part of the words in a natural language dictionary being used. Thus, the separator fragment is recognizable, and it is not necessary to know in advance whether the modification sequence was added as a prefix or a suffix.

[0162] Alternatively, if a correspondence between modified context vectors and initial textual contexts has been stored, for example in a correspondence table, at filtering step 100, filtering 100 consists of accessing the corresponding initial textual context.

[0163] The method comprises, after the filtering step 100 or after the verification step 98 in case of a negative response to the verification step, a step 102 of augmenting the user request by the corresponding initial textual context to obtain an augmented request and a step 104 of applying the generative artificial intelligence model with said augmented request to obtain a response to the user request.

[0164] Optionally, the response is displayed (display step 106) on a display of the programmable electronic device 70 and / or is provided to the client application that transmitted the request (step 108).

[0165] Advantageously, the invention allows control of alignment in the use of a generative artificial intelligence model augmented by retrieval from a context base.

Claims

Demands

1. A method for controlled modification of a generative artificial intelligence model augmented by retrieval from a context base, the context base comprising a plurality of textual contexts, each textual context being transformed by application of a lexical embedding method into an associated context vector, the context vectors being stored in a vector base, the method being implemented by a processor of a programmable electronic device, and being characterized in that it comprises the steps of: - acquiring (50) a query in the form of a string of characters, and transforming said query by said lexical embedding method into a query vector, - selecting (52), according to the query vector, a first context vector in said vector base, the first context vector being associated with an initial textual context of the context base,- modification (62) of the initial textual context into a modified textual context by adding a modification sequence to said initial textual context to obtain a modified context string, then application (64) of said lexical embedding method to the modified textual context into a second context vector and calculation (65) of a distance between the query vector and said second context vector, the modification sequence being determined according to a target distance between the query vector and the second context vector, - storage (68) of the modified textual context in a modified context database and of the associated second context vector in the vector database.

2. A method according to claim 1, wherein the modification (62) of the initial textual context is implemented by applying an iterative optimization method.

3. A method according to claim 2 wherein the iterative optimization method is gradient descent.

4. A method according to any one of claims 1 to 3, wherein the distance objective consists of verifying that the distance between the vector of query and said second context vector is less than a predetermined threshold.

5. A method according to any one of claims 1 to 4, wherein the modification (62) comprises an addition of the modification sequence in the form of a prefix, and an addition, between the modification sequence and the initial textual context, of a predetermined separator fragment, or an addition of the modification sequence in the form of a suffix, and an addition, between the initial textual context and the modification sequence, of said predetermined separator fragment.

6. A method according to any one of claims 1 to 5, wherein the step of selecting a first context vector from said vector base comprises substeps of: - selecting (54) a predetermined number of context vectors closest to the query vector, - providing (56), on a user interface, a set of initial text contexts associated with the selected context vectors, ordered in ascending order of the distance between the query vector and the associated context vector, - obtaining a selection result (58) by a user of at least one text context from said set of text contexts, having a corresponding context vector, and an associated modification indication, so as to indicate a move closer to or further from said at least one selected context vector relative to the query vector, - for each selected context vector,calculation (60) of the associated target distance.

7. A computer program comprising software instructions which, when executed by a programmable electronic device, implement a method for controlled modification of a generative artificial intelligence model in accordance with claims 1 to 6.

8. A method for using a generative artificial intelligence model augmented by retrieval modified by a modification method according to claims 1 to 6, the method comprising steps implemented by a processor of: - acquiring (92) a user request in the form of a string of characters, and transforming by said lexical embedding method the user request into a user request vector, - selection (94), in the vector base, of a context vector closest to the user request vector, called the selected context vector, - extraction (96) of a textual context associated with the selected context vector, called the selected textual context, and, if said selected textual context belongs to the modified context base, filtering (100) of the selected textual context to obtain the corresponding initial textual context, - augmentation (102) of the user request by the corresponding initial textual context to obtain an augmented request, - application (104) of the generative artificial intelligence model with said augmented request to obtain an answer to said user request.

9. A method according to claim 8, wherein the filtering (100) comprises identifying a predetermined separator fragment, and subtracting a string of characters defining the modification sequence, located before or after said separator fragment, and subtracting said separator fragment to obtain the corresponding initial textual context.

10. A computer program comprising software instructions which, when executed by a programmable electronic device, implement a method of using a modified generative artificial intelligence model in accordance with claims 8 to 9.

11. A device for controlled modification of a generative artificial intelligence model augmented by retrieval from a context base, the context base comprising a plurality of textual contexts, each textual context being transformed by application of a lexical embedding method into an associated context vector, the context vectors being stored in a vector base, the device comprising a processor characterized in that it is configured to implement: - an acquisition module (30) for a query in the form of a string of characters, and for transforming said query by said lexical embedding method into a query vector, - a selection module (32) for selecting, based on the query vector, a first context vector in said vector base, the first context vector being associated with an initial textual context of the context base, - a modification module (32) of the initial textual context into a modified textual context by adding a modification sequence to said initial textual context to obtain a modified context string, then a module (36) of applying said lexical embedding method to the modified textual context into a second context vector and calculating a distance between the query vector and said second context vector, the modification sequence being determined by a module (38) of determining the modification sequence, according to a distance target between the query vector and the second context vector, - a storage module (40) of the modified textual context in a modified context base and of the associated second context vector in the vector base.

12. Device for using a generative artificial intelligence model augmented by retrieval modified by a modification device according to claim 11, the device comprising a processor configured to implement: - a module (80) for acquiring a user request in the form of a string of characters, and transforming the user request into a user request vector by a lexical embedding method, - a module (82) for selecting, from the vector base, a context vector closest to the user request vector, called the selected context vector, - a module (84) for extracting a textual context associated with the selected context vector, called the selected textual context, and, if said selected textual context belongs to the modified context base, a filtering module (86) of the selected textual context to obtain the corresponding initial textual context,- a module (88) for augmenting the user request with the corresponding initial textual context to obtain an augmented request, - a module (90) for applying the generative artificial intelligence model with said augmented request to obtain a response to said user request.