Mitigating deep learning model bias via contrastive learning
Contrastive learning methods train encoders to generate embeddings that emphasize similarities and differences, addressing the issue of machine learning models performing poorly on rare cases, thereby improving overall accuracy.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- VISA INTERNATIONAL SERVICE ASSOCIATION
- Filing Date
- 2026-01-08
- Publication Date
- 2026-07-16
AI Technical Summary
Machine learning models often perform poorly on 'rare but simple' cases due to their failure to holistically understand their task or training dataset, leading to errors and biases.
Implement contrastive learning methods to train encoders to generate embeddings that emphasize similarities and differences between input data elements, using 'push-pull' forces to improve the general understanding of the training dataset.
Enhances prediction accuracy of machine learning models by enabling them to better handle 'rare but simple' cases, resulting in improved performance across all scenarios.
Smart Images

Figure US2026010668_16072026_PF_FP_ABST
Abstract
Description
PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01MITIGATING DEEP LEARNING MODEL BIAS VIA CONTRASTIVE LEARNINGCROSS-REFERENCES TO RELATED APPLICATIONS
[0001] The present application claims priority from and is a PCT application of U. S.Provisional Application No. 63 / 744,011, entitled “Mitigating Deep Learning Model Bias Via Contrastive Learning” filed January 10, 2025, the entire contents of which are herein incorporated by reference for all purposes.BACKGROUND
[0002] Machine learning models see increasing use in various decision-making applications. For example, a machine learning model may be used in a security system to dynamically evaluate unauthorized access attempts to a computer resource. As another example, a machine learning model may be used to automatically sort produce from a farm, identifying and sorting aesthetically pleasing produce that can be sold in grocery7stores, as well as less attractive produce that can be made into sauces, or spoiled produce (or non-food items) that should be discarded.
[0003] However, most machine learning models operate based on an underlying statistical model of a training dataset, and not on any real understanding of their particular task or decision-making problem. A machine learning model trained to sort produce does not understand the concept of food or the aesthetic qualities that make produce attractive to consumers, it instead only “understands” the correlational relationship between different training images of produce and their respective labels. A machine learning security7system does not necessarily understand the rules that define unauthorized access, it instead only understands the correlational relationships between training access request data and labels indicating whether those access requests are legitimate or fraudulent.
[0004] As a consequence, while such models may perform their respective tasks very well on average, or for common cases that are well-represented in training data, they may perform poorly on comparatively “simple” cases (one which a human observer could easily evaluate and act on) that are not well-represented in training data. For example, a produce sorting machine learning model may erroneously classify a red plastic ball (accidentally introducedPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 to a production line) as a tomato, as it is both red and glossy, because it had no training examples of red plastic balls in the training dataset.
[0005] More generally, even if such "rare but simple” cases are represented to some degree by the training data, machine learning models may still fail to perform accurately on such cases. During training, model parameters are often optimized such that models perform well on the average or common cases. Unfortunately, the cost of a model that performs reasonably well on the average case is often a model that performs poorly on rare or unusual cases, even if such cases are "simple” within the context of the machine learning model’s task (e.g., detection of non-food items, identification of unauthorized access to a computer system, etc.).
[0006] As such, errors or biases can exist within machine learning models due to those models’ failure to holistically understand their task or training dataset. Embodiments address this and other problems, individually and collectively.SUMMARY
[0007] This Summary is provided to introduce a selection of concepts in a simplified form that are further described herein in the Detailed Description. This Summary is not intended to identify key factors or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0008] Embodiments of the present disclosure are directed to novel “contrastive learning” methods and systems that can be used to train more accurate machine learning models. An encoder (which may comprise a component of a larger machine learning model) can be trained to produce embeddings (or “encodings”) of input data (e.g., features) such that more similar elements of input data result in more similar embeddings and more distinct elements of input data result in more distinct embeddings. This enables a prediction model to learn a more holistic or general understanding of a training dataset, thereby improving prediction accuracy. Particularly, machine learning models trained using methods according to embodiments may perform better in those “rare but simple” cases described above in the Background, i.e.. in cases in which a particular input or event has a clearly expected prediction or classification, but which a machine learning model may erroneously classify due to the rareness of such cases and / or their poor representation within a training dataset.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0009] In slightly more detail, training data elements can be grouped into pairings, and analysis can be performed on the features of such pairings in order to determine which pairings comprise “positive pairings” and which pairings comprise “negative pairings”. A positive pairing can comprise a pair of training data elements whose selected features are generally “more similar than different”, and which should therefore result in a similar pair of embeddings. A negative pairing can comprise a pair of training data elements whose selected features are generally “more different than similar”, and which should therefore result in a more different pair of embeddings. By generating “contrastive loss values” based on the positivity or negativity of pairs of training data elements, the encoder can be trained to “push” negative embeddings farther apart and “pull” positive embeddings closer together in an embedding space. In general terms, by learning to apply these “push-pull” forces, the encoder can effectively leam to cluster input data elements via their encodings, enabling a prediction model (e.g., a neural network) to more accurately leam the general structure of the training dataset, and thereby produce more accurate predictions, classifications, etc.
[0010] In more detail, one embodiment is directed to a method for training a machine learning model based on contrastive loss. The machine learning model can comprise an encoder and a prediction model, and the method can be performed by a computer system. The method can comprise performing an iterative training process until a terminating condition has been met. The iterative training process can comprise the following steps. The computer system can sample a plurality of pairs of training data elements. For each training data element, the computer system can generate a corresponding training embedding using the encoder. In this way, the computer system can generate a plurality of pairs of training embeddings. For each pair of training data elements, the computer system can determine whether that pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements. The computer system can determine whether each pair of training data elements comprises a positive or negative pair based on one or more values of each pair of training data elements or one or more values of each pair of training embeddings. The computer system can then determine an embedding distance value for each pair of training embeddings. In this way, the computer system can determine a plurality of embedding distance values. For each pair of training embeddings, the computer system can determine a contrastive loss value based on a corresponding embedding distance value and based on whether that pair of training embeddings corresponds to a positive pair of training data elements or a negative pair of training data elements. In this way, the computer systemPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 can determine a plurality of contrastive loss values. The computer system can update an encoder parameter set based on the plurality of contrastive loss values, thereby training the machine learning model. The computer system can repeat the iterative training process until the terminating condition has been met.
[0011] After training, the machine learning model can be used to generate predictions during a production (or “testing’" or “inference”) phase. The computer system can receive a test data element and generate a test embedding based on the test data element using the encoder. The computer system can generate a test prediction model output using the prediction model and based on the test embedding. The test prediction model output can comprise a prediction corresponding to the test data element. In some embodiments, the computer system can perform machine learning prediction “as a service” for client computers. In such embodiments, the computer system can receive the test data element from a client computer and can transmit the test prediction model output to the client computer.
[0012] Another embodiment is directed to a computer system comprising one or more processors and a non-transitory computer readable medium coupled to the one or more processors. The non-transitory computer readable medium can comprise code, executable by the processor to perform any of the methods described herein.
[0013] Embodiments of the present disclosure are described in more detail with reference to the Detailed Description below.TERMS
[0014] A “server computer” may refer to a computer or cluster of computers. A server computer may be a powerful computing system, such as a large mainframe. Server computers can also include minicomputer clusters or a group of servers functioning as a unit. In one example, a server computer can include a database server coupled to a web server. A server computer may comprise one or more computational apparatuses and may use any of a variety7of computing structures, arrangements, and compilations for servicing requests from one or more client computers.
[0015] A “client computer” may refer to a computer or cluster of computers that receives some service from a server computer (or another computing system). The client computer may access this service via a communication network such as the Internet or any otherPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 appropriate communication network. A client computer may make requests to server computers including requests for data. As an example, a client computer can request a video stream from a server computer associated with a movie streaming service. As another example, a client computer may request data from a database server. A client computer may comprise one or more computational apparatuses and may use a variety of computing structures, arrangements, and compilations for performing its functions, including requesting and receiving data or services from server computers.
[0016] A '‘memory” may refer to any suitable device or devices that may store electronic data. A suitable memory' may comprise a non-transitory computer readable medium that stores instructions that can be executed by a processor to implement a desired method.Examples of memories including one or more memory’ chips, disk drives, etc. Such memories may operate using any suitable electrical, optical, and / or magnetic mode of operation.
[0017] A “processor” may refer to any suitable data computation device or devices. A processor may comprise one or more microprocessors working together to achieve a desired function. The processor may include a CPU that comprises at least one high-speed data processor adequate to execute program components for executing user and / or system generated requests. The CPU may' be a microprocessor such as AMD’s Athlon, Duron and / or Opteron; IBM and / or Motorola’s PowerPC; IBM’s and Sony’s Cell processor; Intel’s Celeron, Itanium. Pentium. Xenon, and / or Xscale; and / or the like processor(s).
[0018] A “feature” can be an individual measurable property or characteristic of a phenomenon. One or more features can be described using a “feature vector,” e.g., a structured list of data (such as numerical data) representing those features. A feature can be input into a model to determine an output. As an example, in pattern recognition and machine learning, a feature vector can comprise an n-dimensional vector of numerical features that represent some object. In some machine learning contexts, a numerical representation of objects can facilitate processing and statistical analysis. For image processing, for example, feature values might correspond to the pixels of an image. As another example, when feature vectors represent text, the features may comprise occurrence frequency of textual terms. Feature vectors can be equivalent to the vectors of explanatory variables used in statistical procedures such as linear regression.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0019] A “data element’' can refer to a set of data that can be grouped into a single unit, enabling comparison between that data element and other data elements. For example, a data element can comprise a single numerical value (e.g., the speed of a vehicle in miles per hour) or could comprise multiple numerical values (e.g., 60 speed recordings of a vehicle corresponding to each minute of an hour-long period). Data elements comprising multiple data values can be organized into various forms or structures, including data vectors and data tables. A data element may comprise the input to a machine learning model, and individual data values within that data element may comprise features.
[0020] The term “artificial intelligence model” or “machine learning model” can include a model that may be used to predict outcomes to achieve a pre-defined goal. A machine learning model may be developed using a learning process, in which training data is classified based on known or inferred patterns.
[0021] " Machine learning" can include an artificial intelligence process in which software applications may be trained to make accurate predictions through learning. The predictions can be generated by applying input data to a predictive model (or “prediction model”) formed from performing statistical analyses on aggregated data. A model can be trained using training data, such that the model may be used to make accurate predictions. The prediction can be, for example, a classification of an image (e.g., identifying images of cats on the Internet) or as another example, a recommendation (e.g., a movie that a user may like or a restaurant that a consumer might enjoy).
[0022] A “machine learning model” (ML model) can refer to a software module configured to be run on one or more processors to provide a classification or numerical value of a property of one or more samples. An ML model can include various parameters (e.g., for coefficients, weights, thresholds, functional properties of function, such as activation functions). As examples, an ML model can include at least 10, 100, 1,000, 5,000, 10,000, 50,000. 100,000, or one million parameters. An ML model can be generated using sample data (e.g., training samples) to make predictions on test data. Various number of training samples can be used, e.g., at least 10, 100, 1,000, 5,000, 10,000, 50,000, 100,000, or at least 200,000 training samples. One example is an unsupervised learning model such as hidden Markov model (HMM), clustering (e.g., hierarchical clustering, k-means, mixture models, model-based clustering, density-based spatial clustering of applications with noise (DBSCAN), and OPTICS algorithm), approaches for learning latent variable models such asPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 Expectation-maximization algorithm (EM), method of moments, and blind signal separation techniques (e.g., principal component analysis, independent component analysis, nonnegative matrix factorization, singular value decomposition), and anomaly detection (e g., local outlier factor and isolation forest). Another example type of model is supervised learning that can be used with embodiments of the present disclosure. Example supervised learning models may include different approaches and algorithms including analytical learning, statistical models, artificial neural network (e.g. including convolutional and / or transformer layers) that may have 1-10 layers as examples, recurrent neural network (e.g., long short term memory, LSTM), boosting (meta-algorithm), bootstrap aggregating (bagging) such as random forests, support vector machine (SVM), support vector (SVR), Bayesian statistics, case-based reasoning, decision tree learning, inductive logic programming, linear regression, logistic regression, Gaussian process regression, genetic programming, group method of data handling, kernel estimators, learning automata, learning classifier systems, minimum message length (decision trees, decision graphs, etc.), multilinear subspace learning, naive Bayes classifier, maximum entropy classifier, conditional random field, nearest neighbor algorithm, probably approximately correct learning (PAC) learning, ripple down rules, a knowledge acquisition methodology7, symbolic machine learning algorithms, subsymbolic machine learning algorithms, minimum complexity7machines (MCM), ordinal classification, data pre-processing, handling imbalanced datasets, statistical relational learning, or Proaftn (a multicriteria classification algorithm), or an ensemble of any of these types. Supervised learning models can be trained in various ways using various cost / loss functions that define the error from the known label (e.g., least squares and absolute difference from known classification) and various optimization techniques, e.g., using backpropagation. steepest descent, conjugate gradient, and Newton and quasi-Newton techniques.
[0023] An “interaction” can refer to a reciprocal action or influence or an event or phenomenon corresponding to such an action or influence. As an example, an individual posting a comment on a social media website could be considered an interaction between that individual (or e.g., a personal computer system associated with that individual) and the social media website (or e.g., a server computer hosting that social media website). As another example, the collision of a fast-moving cold air front and a slow-moving warm air front (e.g., an “occluded front”) could be considered an interaction between the two air fronts. As another example, a credit card transaction between a cardholder and a business could bePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 considered an interaction. In some cases, measurable properties of interactions can be analyzed or evaluated (e.g., using machine learning) to quantify or qualify those interactions.
[0024] An “embedding” can refer to a representation of data, usually within an “embedding space”, a theoretical region in which embeddings can be compared via vector operations. For example, an embedding can comprise a vector representation of an image, which can be used to evaluate the similarity of that image to other images, or e g., determine whether that image contains or depicts a particular subject (e.g., a cat). Embeddings can be used within the field of machine learning, thereby enabling machine learning models to perform certain tasks, particularly tasks that are difficult or subjective. In some cases, an embedding can comprise a lower-dimensional representation of a corresponding element of data, enabling more efficient processing due to the reduced logical size of the embedding relative to the logical size of the original element of data.
[0025] An “encoder” can refer to a physical device or software element that produces output data representative of some input, usually in the form of a “code” or signal. An encoder can be used to convert data from one format to another, which may facilitate data processing. For example, a nominal data encoder can be used to convert nominal data (such as the name of a city) into a numeric code, facilitating such data to be processed using numerical methods. As another example, a physical rotary encoder can be used to convert the motion or position of a shaft or axle into electrical signals, facilitating computer-based odometry. A code (or other output of an encoder) can be used as an embedding. Some encoders can be implemented via applications of machine learning, e.g., via a “transformer” machine learning model or via another model that uses the principle of machine learning “attention.”
[0026] An “access device” may be any suitable device that provides access to a remote system. An access device may also be used for communicating with a resource provider computer, an authorizing computer, or any other suitable system. An access device may generally be located in any suitable location, such as at the location of a resource provider or merchant. An access device may be in any suitable form. Some examples of access devices include POS or point of sale devices (e.g., POS terminals), cellular phones, PDAs, personal computers (PCs), table PCs, hand-held specialized readers, set-top boxes, electronic cash registers (ECRs), automated teller machines (ATMs), virtual cash registers (VCRs), kiosks, security7systems, access systems, terminals, and the like. An access device may use anyPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 suitable contact or contactless mode of operation to send or receive data from, or associated with, a user communication device. In some embodiments, where an access device may comprise a POS terminal, any suitable POS terminal may be used and may include a reader, a processor, and a computer-readable medium. A reader may include any suitable contact or contactless mode of operation. For example, exemplary card readers can include radio frequency (RF) antennas, optical scanners, bar code readers, or magnetic stripe readers to interact with a payment device and / or mobile device. Other examples of access devices include devices (e.g., locks, gates, access control boxes, etc.,) that control physical access to locations (e.g., venues, transit stations, homes, offices, buildings, etc.,) as well as software devices that control access to data or information. In embodiments, the access device may be configured to charge or recharge a user device via contact or contactless modes of operation.
[0027] A '‘resource” can generally refer to something that can be acquired or provided to an entity, e.g., by a “resource provider.” Examples of resources include material resources, such as iron, monetary resources, such as dollars, such as cleaning supplies, clothing, food, etc. Resources may also refer to services, such as cleaning services. Access to something may also qualify as a resource, e.g.. access to a secure building. Resources can also include data stored on a computer, such as video files, audio files, databases, data tables, etc. A resource provider can operate a “resource provider computer”, e.g., an entity associated with a digital streaming service could operate a resource provider computer (e.g., a server computer).
[0028] The term “access request” generally refers to a request to access a resource, e.g., provided by a resource provider. An access request and a transaction can be used interchangeably. The access request may be received from a requesting computer, a user device, or a resource computer, for example. The access request may include authorization information, such as a user name, account number, or password. The access request may also include and access request parameters, such as an access request identifier, a resource identifier, a timestamp, a date, a device or computer identifier, a geo-location, or any other suitable information. The access requests can be received in real time. For example, a user of a user device (e.g., a client computer such as a laptop, smartphone, or tablet) can use that user device to make an access request to a server computer, e.g., to access a service provided by that server computer (e.g., an image hosting service, a video streaming service, an online banking service, etc ), e g., by transmitting the access request to the server computer over the Internet. In some cases, an access request may be made via an “access device”, which mayPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 comprise any device used to access something (e.g., a network or a computer system). This could include a user device as described above, but could also include, e.g.. a point-of-sale terminal used to gain access to a payment processing network. An access device may include a means by which it can interface with other devices. For example, a point-of-sale terminal access device may include a chip card reader that can interface with a smartcard operated by a user. An access request may include a “credential” or “identifier”, which may comprise data used to demonstrate or prove that an entity is authorized to access a resource, or which may comprise data used to identify the entity, such that an access device (or another device or computer system, e.g., an “authentication computer” or “authorization computer”) can authenticate the entity (e.g., by verifying its identity) and verify that the entity is authorized to access the resource.
[0029] The term “access request outcome” may include any determination of whether to grant access to the resource. The access request outcomes may include “accept,” “reject,” or “review.” In some embodiments, an access request outcome for an access request may be “reject” if any of the access rules have an access rule outcome of “reject.” In some embodiments, an access request outcome for an access request may be “accept” if any of the access rules have an access rule outcome of “accept,” regardless of any outcome being “reject.” An access request outcome of “accept” may cause the access request to be granted. An access request outcome of “reject” may cause the access request to be denied. The “review” outcome may initiate a review process for the access request. In various embodiments, other outcomes or other meanings of these outcomes may be used.BRIEF DESCRIPTION OF THE DRAWINGS
[0030] FIG. 1 shows a block diagram of an exemplary multilayer machine learning model according to some embodiments.
[0031] FIG. 2 shows two state diagrams corresponding to the application of push-pull forces (via contrastive loss) to embeddings generated by an encoder.
[0032] FIG. 3 shows an exemplary client-server system that can be used to perform machine learning methods according to some embodiments.
[0033] FIG. 4 shows a flowchart depicting an exemplary machine learning training method using contrastive loss according to some embodiments.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0034] FIG. 5 shows a flowchart corresponding to an exemplary' method for determining whether a pair of data elements comprise a positive pair of data elements or a negative pair of data elements based on a statistical analysis of a common numerical feature of those data elements.
[0035] FIG. 6 shows pseudocode corresponding to a method for determining a contrastive loss value corresponding to a pair of data elements on the basis of an ordered nominal feature of those data elements.
[0036] FIG. 7 shows pseudocode corresponding to a method for determining a contrastive loss value based on the Euclidean distance between two embeddings in a Euclidean embedding space.
[0037] FIG. 8 shows a flowchart depicting an exemplary' machine learning inference method according to some embodiments.
[0038] FIG. 9 shows a table comparing F 1 scores for various machine learning models, including machine learning models according to embodiments.
[0039] FIG. 10 shows a resource security system 100 for authorizing access to resources, in accordance with some embodiments.
[0040] FIG. 11 shows an exemplary' computer system according to some embodiments.DETAILED DESCRIPTION
[0041] Embodiments of the present disclosure are directed to novel “contrastive learning” methods and systems that can be used to train more accurate machine learning models. An encoder (which may comprise a component of a larger machine learning model) can be trained to produce embeddings (or “encodings”) of input data (e.g., features) such that more similar elements of input data result in more similar embeddings and more distinct elements of input data result in more distinct embeddings. This enables a prediction model to learn a more holistic or general understanding of a training dataset, thereby improving prediction accuracy.
[0042] As such, embodiments of the present disclosure are useful for machine learning-based decision-making applications. For example, embodiments of the present disclosure can be used to improve the accuracy of automatic content moderation systems, e.g., machine learning systems that determine whether posts on social media platforms violate communityPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 guidelines (at which point such posts can be deleted). As another example, machine learning models according to embodiments can be used to improve the accuracy an access review systems, which can include machine learning models used to dynamically evaluate invalid requests for a resource and e.g., automatically approve or deny access requests based on the output of a prediction model. Particularly, machine learning models trained using methods according to embodiments may perform better in “rare but simple” cases, e.g., in cases in which a particular input or event (e.g., an access request, a post on a social media website, an image of produce) has a clearly expected prediction or classification, but which a machine learning model may erroneously classify due to the rareness of such cases and / or their poor representation within a training dataset.I. MACHINE LEARNING
[0043] As summarized above, some embodiments of the present disclosure relate to machine learning models and methods and systems for training such machine learning models using novel contrastive loss techniques. While it is assumed that a potential practitioner of methods according to embodiments has some general knowledge of the field of machine learning, a brief summary of machine learning is provided herein in order to better orient the reader.
[0044] At a high level, a machine learning model generally produces output data responsive to received input data. Such input data may comprise “features”, e.g., of some object, event, or phenomena being analyzed by a machine learning model, which may be quantified or qualified by the output data. For example, for a machine learning model used to evaluate comments posted on a social media website, the length of a comment (measured, e.g., in the number of words or the number of characters) could comprise a feature. The output of such a machine learning model could comprise scores used to describe or define such comments, e.g., a score indicating how “malicious” or “benign” a particular comment is. Such scores could be used as part of an automatic content moderation system, e.g., a system that automatically deletes malicious comments based on their scores.
[0045] Machine learning models are often defined by sets of parameters, which generally control how the machine learning model produces output data responsive to received input data. As an example, a support vector machine (SVM) is a type of machine learning model that divides data points using a hyperplane. Input data positioned on one “side” of the hyperplane is classified as one class (e g., normal) while input data on the other side of thePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 hyperplane is classified as another class (e.g., anomalous). The parameters of the support vector machine can comprise the coefficients used to define the hyperplane. Changing these parameters changes the shape of the hyperplane, and thus changes which data points the SVM classifies as normal or anomalous.
[0046] In general terms, the process of training a machine learning model can involve determining the set of parameters that achieve the “best'’ performance, usually based on a loss or error function. A loss function relates the expected or ideal performance of the machine learning model to its actual performance on a (typically labeled) training dataset. The loss function typically decreases in value as the model’s performance improves. As such, training a machine learning model often involves determining the set of parameters that minimize a loss function corresponding to that model. Sometimes a random parameter estimate is generated as an initial parameter “guess,” and then a process such as gradient descent is used to iteratively refine the parameter estimate, eventually resulting in a final set of parameters associated with the machine learning model.
[0047] This iterative refinement process can be performed in a series of training “rounds”, “epochs”, or other appropriate divisions. In each round, a machine learning model’s performance can be evaluated using the loss function, and the parameters can be updated based on this evaluation, e.g., with the goal of reducing the result over time. As an example, the gradient of the loss function can be determined in parameter space and can be used to reduce the value of the loss function in successive training rounds. Such a gradient corresponds to a change in model parameters that achieves the greatest immediate reduction in the loss function. By changing the model parameters based on the gradient, the loss function can be reduced during each successive training round. This process can be repeated until a terminating condition has been met. In embodiments of the present disclosure, one type of terminating condition is a defined number of training rounds. This terminating condition can be met if the number of training rounds performed (e.g., by a computer system training the machine learning model) equals or exceeds the defined number of training rounds, at which point the iterative training process has been completed. Another type of terminating condition in embodiments is a convergence condition. This terminating condition can be met if the machine learning model parameters “converge.” In general terms, convergence is achieved when the value of the loss function, and / or the values of the model parameters change in increasingly small amounts with each successive training round. ForPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 example, a convergence condition can be achieved if the value of the loss function decreases by less than 0.1% in two successive training rounds.
[0048] It is possible to train multiple machine learning models or multiple trainable components of a machine learning model simultaneously, e.g., by updating parameter sets corresponding to each of those machine learning models simultaneously, e.g., using a single training dataset and / or a combined loss function. Components of a machine learning model (trainable or otherwise) may be organized into "layers”, usually based on their relative ■‘proximity” to either the model’s inputs (e.g., features) or the model’s outputs (e.g., predictions based on those features). For example, an initial layer may operate on feature inputs, a final layer may produce the model’s output, and an intermediate layer may operate on (as well as generate) intermediate data used by the model to produce the model output.
[0049] Some multilayer machine learning models (including some machine learning models according to embodiments) may include encoders. Such components can encode a feature input (or intermediate data) into an “encoding”, “embedding”, or “latent space embedding” corresponding to a “latent space”. Such an embedding can generally represent the information contained in the encoder’s input in a different form (e.g., as a point or vector in a latent space), which may facilitate processing by subsequent layers of the machine learning model, ultimately resulting in a more accurate model output (e.g., a more accurate prediction). FIG. 1 shows a diagram of a general multilayer machine learning model architecture (corresponding to exemplary’ machine learning model 114), comprising an encoder 104, final layer(s) 108 (which can comprise a “prediction model”), intermediate model layers 112, and additional intermediate model layers 116.
[0050] The model inputs 102 (or “features”) to machine learning model 114 can be processed by any number of intermediate model layers 112 prior to being processed by encoder 104. Each of these intermediate model layers 112 may produce its own output, which may comprise the input to a successive intermediate model layer 112 (or encoder 104). Such intermediate model layers 112 (and likewise, additional intermediate model layers 116) may depend on the nature of machine learning model 114, and can comprise any variety of layer that could be included in a machine learning model, such as pooling layers, subsampling layers, normalization layers, other neural network layers (e.g.. fully connected layers), other encoders, transformers, etc. A convolutional neural network, for example, can comprise an alternating series of convolution layers and subsampling layers (each of whichPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 could be considered intermediate model layers) prior to a final fully connected layer. In some machine learning models, the encoder 104 may comprise either the first layer in the machine learning model 114 or the second to last layer in the machine learning model 114, e.g., such that there are no intermediate model layers 112 preceding the encoder 104, or no additional intermediate model layers 116 following the encoder 104. In other embodiments, there may¬ be any number of intermediate model layers 112 preceding the encoder 104 and any number of additional intermediate model layers 116 following the encoder.
[0051] As stated above, an encoder (such as encoder 104) can produce embeddings or encodings (e.g., embeddings 106) based on its inputs. Such embeddings 106 can generally comprise alternative representations of the encoder’s 104 inputs, which may facilitate processing by subsequent components of the machine learning model 114 (e.g.. additional intermediate model layers 116, final layer(s) 108, etc.). For example, embeddings 106 may have a smaller logical size than the data used to produce such embeddings (e.g., model inputs 102), and may thereby decrease the computational complexity of processing embeddings 106 (e.g., via intermediate model layers 112 or final layer(s) 108), thereby improving the speed at which the machine learning model 114 produces model outputs 110 (e.g.. predictions). As another example, some machine learning models or model layers may only operate on numerical data, and encoder 104 can be used to embed nominal data such as the name of a city (e.g., “San Francisco”) into a numerical embedding such as “941”, enabling such data to be processed by such model layers. Encoding data in this manner can be accomplished, e.g., using a mapping table or lookup table, a predefined data structure that maps the names of cities (encoder inputs) to their corresponding numerical values (embeddings) such as zip codes (or e.g., the first three digits of zip codes) from a city- look up table.
[0052] However, encoders can also use more (or less) sophisticated methods for producing various types of embeddings, including the usage of machine learning based methods, such as “transformer” models or other models based on the principle of “attention” (or any other applicable machine learning model). As an example, convolution layers in a convolutional neural network may be thought of as a type of encoder that uses a convolution kernel to encode an input (e.g., an image) into a (typically smaller) embedding. Regardless of the particular methods or models used to implement encoder 104, it should be understood that in some embodiments an encoder can comprise a trainable component of a machine learning model, and an encoder may be defined by an “encoder parameter set” that can be iterativelyPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 adjusted during training, e.g., based on a loss function or value. As described in more detail below, in some embodiments such a loss function may include a "‘contrastive loss” component ^contrastive ■
[0053] After being processed by any number of additional intermediate model layers 116 (including zero), the final layer(s) 108 (which may comprise a “prediction model” in some embodiments) can produce a model output 110 based on embeddings 106 (or based on any intermediate data generated from embeddings 106). Such an output could comprise, e.g., a binary prediction, which can comprise a prediction as to whether a set of model inputs 102 correspond to a particular class or do not correspond to that class. For example, a binary prediction could indicate whether an audio recording contains an endangered bird call or does not contain an endangered bird call (e.g.. as part of a rainforest conservation and monitoring program). As another example, a model output 110 could comprise a non-binary prediction (e.g., a continuous prediction), such as a percentage indicating the probability that a particular set of model inputs 102 correspond to a fraudulent (or legitimate) access request (e.g., a payment transaction such as a credit card or debit transaction.
[0054] In some embodiments, the final layer(s) 108 can comprise a fully connected layer (also known as a “dense layer”), a layer in a neural network in which every “neuron” in one layer is connected to each neuron in the next layer. The final layer(s) 108 may be defined by their own parameter set and, in some embodiments, both the encoder 104 and a prediction model (comprising final layer(s) 108) can be trained simultaneously based on a combined loss function, e.g., by updating a parameter set corresponding to the prediction model and the encoder parameter set in each training round of an iterative training process.A. Contrastive Loss Overview
[0055] As described above, training a machine learning model generally involves trying to optimize an objective function given a training dataset. A well-trained machine learning model will often generally perform well, or will perform well on average or common cases, resulting in a high Fl precision-recall score. However, such models will typically perform poorly on some tasks that appear to be “easy” or “simple” but are rare or poorly represented by the training dataset, as optimizing an objective function tends to favor common cases at the expense of uncommon ones.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0056] As an example, a machine learning model used to approve or deny debit card transactions would ideally decline a transaction if there was a balance of zero dollars in an associated payment account. However, such machine learning models typically evaluate their inputs (e.g., transaction data) on the basis of the statistical distribution of their training dataset, and if the “zero balance case” is rare and not well-represented in the training dataset, a machine learning model may fail to deny such a transaction, even though it performs well over the entire training dataset. While such cases may be individually marginal, there may be a large variety of different marginal “edge cases”, which may collectively represent a significant portion of the dataset. As such, improving model performance in these “rare but simple” cases may result in an improvement to overall model performance.
[0057] Fortunately, methods according to embodiments enable machine learning models to develop a more holistic or general understanding of a training dataset, thereby improving model accuracy across all cases, including these “rare but simple” cases. As described in more detail below, this can be accomplished using contrastive losses, which can be used to train an encoder to generate embeddings that emphasize similarities and differences between input data elements, “pushing” the embeddings corresponding to different data elements further apart and “pulling” embeddings corresponding to similar data elements closer together. This can enable a prediction model to deliver more accurate predictions (or classifications or any other appropriate task output) based on such generated embeddings.
[0058] This process is generally illustrated by the state diagrams of FIG. 2, which includes an initial state diagram 202 showing a two-dimensional embedding space. Embeddings corresponding to positive and negative pairs of data elements (represented by triangles and squares respectively and described in more detail further below) are in an overlapping cluster in the lower left quadrant of the initial state diagram. By using contrastive loss, an encoder according to embodiments can be trained to generate embeddings corresponding to positive pairs of data elements that are more tightly clustered. Additionally, such an encoder can be trained to better separate embeddings corresponding to negative pairs of data elements. This process can be visualized as the application of “push-pull forces” to embeddings, and initial state diagram 202 depicts these push-pull forces as vectors 206.
[0059] A state diagram 204 detailing the distribution of embeddings after applying such push-pull forces (i.e., after training using contrastive loss methods according to embodiments) is also depicted in FIG. 2. In state diagram 204, embeddings corresponding toPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 positive pairings are tightly clustered within the lower left quadrant of the state diagram 204, while embeddings corresponding to negative pairings have generally spread out within the embedding space. Such a distribution of embeddings enables a prediction model to be trained to develop a more general understanding of the differences and similarities between inputs, thereby resulting in greater model accuracy.IL SYSTEM DIAGRAM
[0060] Having described some useful concepts related to embodiments of the present disclosure above, it may now be helpful to describe some systems according to embodiments of the present disclosure, including computer systems that can implement methods according to embodiments (described further below).
[0061] FIG. 3 shows a computer system 302 that can be used to perform methods according to embodiments. As described in more detail below with reference to FIG. 9, a computer system such as computer system 302 can comprise a processor and a non-transitory computer readable medium (e.g., a hard drive) coupled to the processor. The non-transitory computer readable medium can comprise code or instructions, executable by the processor for performing methods according to embodiments described herein.
[0062] In more detail, computer system 302 can receive data elements (also referred to as "test data elements”) comprising features or other data and can use a machine learning model 304 to analyze these features or other data, e.g., by producing scores, classifications, predictions, etc., or otherwise perform some machine learning related task based on these data elements and / or their features. For example, in the context of credit card fraud detection, computer system 302 can receive features corresponding to an access request and use machine learning model 304 to produce a fraud score indicating the probability that the access request is a fraudulent access request. As another example, in the context of an automatic content moderation system for a social networking website, computer system 302 can receive features corresponding to a post on the social networking website and use machine learning model 304 to produce a content score indicating whether the post is objectionable or not (e.g., whether the post violates community guidelines).
[0063] As another example, in the context of a power plant demand forecasting system, computer system 302 can receive features corresponding to various current and historical conditions (e.g., outdoor temperature, previous demand for power) and use machine learningPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 model 304 to produce an estimated power demand for some period of time in the future. As another example, in the context of a film recommendation service (which may comprise, e.g., part of a video streaming service), computer system 302 can receive features corresponding to films watched or highly rated by users and use machine learning model 304 to produce scores corresponding to other films in a film catalog, indicating the likelihood that a particular user would also watch or enjoy that film.
[0064] As yet another example, in the context of a machine learning diagnostic aid, computer system 302 can receive features corresponding to symptoms (or vital statistics) of a patient and use machine learning model 304 to produce predictions indicating the estimated likelihood that the patient is afflicted by particular diseases. As another example, in the context of a cybersecurity system, computer system 302 can receive features corresponding to network communications (or code executed by other computer systems) and use machine learning model 304 to produce a prediction indicating the likelihood that there is some malicious or unauthorized access to those other computer systems.
[0065] In some embodiments, machine learning model 304 can comprise an encoder 306 and a prediction model 316. As described above with reference to FIG. 1, in general terms, the encoder 306 can be used to encode features or other data, thereby generating embeddings. Such embeddings can be used by other elements of machine learning model 304 in order to perform the model’s functions. For example, embeddings generated by encoder 306 can be used as an input to a prediction model 316 in order to produce predictions that can be output by computer system 302. Various types of machine learning models can be used in embodiments of the present disclosure and non-limiting examples are provided herein. As an example, the encoder 306 could comprise a transformer machine learning model (or any other appropriate trainable encoder system) and prediction model 316 could comprise a gradient boosted decision tree model (e.g., an XGBoost model), a linear model, or a tree model. In some embodiments, the encoder 306 can be defined by a set of encoder parameters that can be determined, set, or otherwise established during a training process, thereby training the encoder 306. Likewise, the prediction model 316 can be defined by a set of prediction model parameters that can be determined, set, or otherwise established during training. These parameter sets can be updated based on various types of loss functions or loss values, including those determined using cross-entropy or based on a mean squared error between prediction model outputs and training labels corresponding to a training dataset (comprising,PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 e.g., training data elements 314). In some embodiments, the prediction model can comprise a neural network (e.g., a multilayer perceptron) and the prediction model parameter set can comprise a plurality of weights associated with the neural network. In such cases, the prediction model parameter set can be updated based using backpropagation and / or stochastic gradient descent.
[0066] In some embodiments, the machine learning model 304 may be part of a larger segmentation model comprising multiple machine learning models. In general terms, for a segmentation model, relevant feature data from an input dataset (e.g., a '‘test dataset”, “production dataset”, “inference dataset”, etc.) may be segmented into data subsets, each of which may be processed by a different machine learning model. The segmentation model can combine the outputs of the different machine learning models to produce a single output, e.g., a single credit card fraud score from multiple credit card fraud stores, a single power demand prediction from multiple power demand predictions, a single comment score from multiple comment scores, etc. Segmentation models may be useful in situations in which it would be computationally slow, difficult, or infeasible to process a large set of features with a single model, as many models scale quadratically (or worse than quadratically) with the number and size of input features.
[0067] Regardless, even though FIG. 3 depicts only a single machine learning model 304 comprising a single encoder 306 and a single prediction model 316, in some embodiments the computer system 302 may instantiate, train, and / or utilize multiple machine learning models, each of which may have any number of encoders and prediction models. It should be appreciated more generally that the numbers of devices, entities, and components shown in FIG. 3 were selected for simplicity of illustration and exposition. It should be understood how ever that systems according to embodiments of the present disclosure can include more than one of each device, entity, component, computer system, etc. In addition, some systems according to embodiments may include a lesser number of devices, entities, and / or components or a greater number of devices, entities, and / or components than those shown in FIG. 3. For example, computer system 302 may comprise a distributed computing system comprising several computers collectively performing methods according to embodiments. Likewise, there may be multiple data sources 308 from which computer system 302 retrieves training data elements 314 for the purpose of training machine learning models, along withPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 multiple communication networks 312 over which computer system 302 communicates with client computers(s) 310.
[0068] After generating scores, predictions, or other outputs using machine learning model 304, such scores or predictions can be used or analyzed by an operator of computer system 302 or an organization that owns and / or operates computer system 302. For example, an analyst at a power plant could use predictions from machine learning model 304 to prepare for a sudden projected increase in power demand. Additionally, in some embodiments, scores predictions, or other outputs of machine learning model 304 can be used to implement some form of automatic action or interaction based on those scores, predictions, or outputs. For example, computer system 302 could automatically approve or deny an access request or approve or delete a post on a social media website based on a prediction produced by prediction model 316.
[0069] As another alternative, computer system 302 could be used to implement machine learning based analysis as a service for others, e.g., on behalf of client computer(s) 310 or users of client computer(s) 310 (which may also be referred to as “requestors'’). For example, a client computer 310 could comprise a computer associated with a social networking web company. The social networking web company could outsource their content moderation to an organization associated with computer system 302 (which could comprise a server computer). In such a case, client computer 310 could request scores from computer system 302 (e.g., scores indicating whether a posted comment violates community guidelines or is otherwise malicious). Computer system 302 could use machine learning model 304 to generate such scores and can transmit those scores back to the client computer 310 (e.g., via communication network 312), which could then use them for some purpose (e.g., removing comments that violate community guidelines).
[0070] In such scenarios, client computer(s) 310 and computer system 302 can communicate over a communication network 312. A communication network such as communication network 312 can take any suitable form, and may include any one and / or the combination of the following: a direct interconnection; the Internet; a Local Area Network (LAN); a Metropolitan Area Network (MAN); an Operating Missions as Nodes on the Internet (OMNI); a secured custom connection; a Wide Area Network (WAN); a wireless network (e.g., employing protocols such as, but not limited to a Wireless Application Protocol (WAP), I-mode, and / or the like); and / or the like. Messages between computers andPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 devices in the system of FIG. 3 and / or over communication network 312 may be transmitted using a secure communication protocol, such as. but not limited to, File Transfer Protocol (FTP); HyperText Transfer Protocol (HTTP); Secure HyperText Transfer Protocol (HTTPS); Secure Socket Layer (SSL), ISO (e.g., ISO 8583) and / or the like. Any suitable communication protocol can be used to communicate over the communication network 312, e.g., for the purpose of creating one or more communication channels. A communication channel may, in some instances, comprise a secure communication channel, which may be established in any known manner, such as through the use of mutual authentication, a session key, and establishment of a Secure Socket Layer (SSL) session.
[0071] In some embodiments, such requests from client computer(s) 310 may contain all the information (e.g., test data elements, features of test data elements, etc.) necessary’ for computer system 302 to generate predictions, scores, or any other data using machine learning model 304. However, in other embodiments, computer system 302 may retrieve relevant data, features, etc., from another data source 308, e.g., a memory element (e.g., a hard drive), database, or any other data structure or storage element, in order to service requests from client computer(s) 310. As an example, an analyst at a national weather service may request a machine learning based weather forecast in a distance region of their country’. The analyst may use a client computer 310 to connect to computer system 302, which is located at a remote weather monitoring station. Using data stored on a hard drive located in the remote weather monitoring station, computer system 302 may use machine learning model 304 to generate a weather forecast. The forecast can be returned to the client computer 310 and can then be interpreted by the weather analyst.
[0072] In addition to using machine learning model 304 to generate scores or predictions, computer system 302 can also train machine learning model 304 or individual components of machine learning model 304 (e.g., encoder 306 or prediction model 316) for this purpose. Such training methods are described in more detail further below with reference to FIGs. 4-7. As a general summary however, computer system 302 can train the encoder 306 and / or prediction model 316 using novel contrastive learning techniques. As part of this training process, computer system 302 can retrieve training data elements 314 e.g., from data source 308. Such data could comprise, e.g., data corresponding to objects, users, historical events, interactions between entities (e.g., access request such as credit card transaction interactions, computer communication interactions, etc.), etc. For example, for a machine learning modelPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 304 used to classify access requests as normal or fraudulent, the training data could comprise labelled training data elements corresponding to historical access requests. These retrieved training data elements can be grouped into pairs of training data elements and computer system 302 can determine whether each pair of training data elements comprises a “positive pair” of training data elements (in crude terms, a pair of training data elements that are generally similar) or a “negative pair” of training data elements (in crude terms, a pair of training data elements that are generally different). Computer system 302 can use encoder 306 to generate embeddings corresponding to each training data element in the pairs of training data elements. For each pair of training data elements, computer system 302 can compare their respective embeddings, in view of the “positivity” or “negativity” of their pair of training data elements, in order to determine a contrastive loss value. Such a contrastive loss value can be used (in addition to any number of other loss values, such as loss values based on mean squared error or cross-entropy) to train the encoder 306 and prediction model 316. Some training methods according to embodiments are described in more detail in the following section.III. TRAINING
[0073] A training method according to embodiments is described in more detail below with reference to FIG. 4. Using such a method, a machine learning model can be trained using contrastive loss. The method can be performed by a computer system (e.g., a computer system instantiating and training machine learning models according to embodiments) and can involve the computer system performing an iterative training process. This iterative training process can be performed until a terminating condition has been met, e.g., model convergence or a predefined number of training rounds or epochs.A. Perform Round of Training Process
[0074] At step 402, after retrieving training data comprising a plurality of training data elements (e.g., from a database, a data stream, a local memory element such as a hard drive, cloud storage, an I / O interface, or any other appropriate source), the computer system can perform a round of an iterative training process. The round of the iterative training process can comprise steps 404-418 of FIG. 4, described in more detail below. The computer system can perform this iterative training process until a terminating condition has been met, e.g., a set number of training rounds or epochs, a convergence condition, or any other appropriate terminating condition.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0075] Such training data elements can comprise, e.g., sets of features corresponding to some observed event, object, individual, etc., which may relate to a particular task or decision-making application associated with the machine learning model being trained. For example, if a machine learning model is being trained to generate predictions related to electrical power demand, such training data elements could comprise sets of features predictive of electrical power demand (e.g., the time of year, the time of day, outdoor temperature, latitude, longitude, etc.) as well as power demand values (e.g., in kilowatt hours or megawatt hours), which may comprise the ‘'labels” of the training data elements.
[0076] As another example, if a machine learning model is being trained to generate predictions related to the legitimacy (or fraudulence) of access requests (e.g., credit card transactions), the training data elements could comprise sets of features predictive of credit card fraud (e.g., purchase amounts, purchase locations, purchase time of day, frequency of purchases, card balance, etc.) and labels indicating whether such access requests were legitimate or fraudulent. In some embodiments, training data elements may comprise message data (e.g., corresponding to message-based communications between two computer systems over the Internet), transaction data (e.g., corresponding to access requests), or machine performance data (e.g., corresponding to the performance of a computer system such as a server computer, e.g., relative to some benchmark performance or performance metrics).
[0077] In some embodiments, the training data elements may be organized into a data table, such that each row of the table corresponds to a given observed event, object, individual, etc., and such that each column in the table corresponds to a different feature (or vis versa). For example, for training data elements corresponding to access requests, each row could correspond to a particular transaction and a column of each row could correspond to a transaction amount. As another example, for training data elements corresponding to patients of a hospital, each row could correspond to a different (potentially anonymized) patient, and a column could correspond to the age of that patient.B. Sample Training Data Elements
[0078] At step 404, the computer system can sample a plurality of pairs of training data elements, e.g., from among the training data described above. In some embodiments, each pair of training data elements can comprise a ‘'first training data element” and a “second training data element”.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0079] Each training data element of the plurality of pairs of training data elements can comprise a plurality of training data values, e.g., each first training data element can comprise a plurality of first training data values and each second training data element can comprise a plurality of second training data values. Such training data values can comprise the features of their respective training data elements. For example, for a training data element corresponding to electric power demand, a training data value could comprise a feature such as the current outdoor temperature. Training data elements can comprise various types of training data values. For example, a training data element can comprise nominal values, such as the names of cities (e.g., the city in which a credit card transaction took place), ordered nominal values, such as “underweight”, “normal weight”, “overweight”, or “obese”, numerical values (including interval values and ratio values), etc.
[0080] There may be correspondence between training data values within pairs of training data elements, e.g., for each first training data value in a first training data element, there may be a corresponding second training data value in a second training data element, e.g., the first training data element may contain a nominal data value corresponding to the name of a city and the second training data element may also contain a nominal data value corresponding to the name of the city. In some embodiments, this correspondence may enable the determination of contrastive loss values by evaluating the difference between training data values (which may comprise features) within each pair of training data elements. The computer system can sample any number of pairs of training data elements, such as 10. 100, 1000, 10,000, 100,000, one million, ten million, one hundred million, one billion, or ten billion pairs of training data elements.
[0081] The computer system can sample a plurality of pairs of training data elements in various ways. For example, the computer system can first sample a batch of training data elements from the plurality of training data elements (e.g., randomly or sequentially), then pair those training data elements (e.g., randomly). For example, if the computer system sampled a batch of forty training data elements, the computer system could randomly assign these forty training data elements into two groups of twenty training data elements, then randomly pair each training data element in one group with a training data element in the other group, thereby sampling a plurality of pairs of training data elements comprising twenty pairs of training data elements.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 C. Generate Training Embeddings
[0082] At step 406, the computer system can generate a corresponding training embedding for each training data element (e.g., in the plurality of pairs of training data elements), thereby generating a plurality of pairs of training embeddings. The computer system can generate these training embeddings using an encoder component of the machine learning model. Such an encoder can be trainable and can be defined by an encoder parameter set. For example, the encoder can comprise a transformer model including one or more neural networks, which may be defined by an encoder parameter set comprising weights of the one or more neural networks.
[0083] Each training embedding of the plurality of pairs of training embeddings can correspond to a training data element of the plurality of training data elements. Likewise, each training embedding can comprise a plurality of embedding values. Each embedding value can correspond to a training data value in a corresponding training data element, e g., the training data element encoded in order to produce the training embedding. Each training data element can comprise any number of training data values, such as 10, 100, 1000, 10,000, 100,000, one million, ten million, one hundred million, one billion, or ten billion training data values. In some embodiments, each pair of training embeddings can comprise a first training embeddings corresponding to a first training data element (which may have been encoded by the encoder to produce the first training embedding) and a second training embedding corresponding to a second training data element (which may have been encoded by the encoder to produce the second training embedding). Each first training embedding can comprise a plurality of first embedding values, which may correspond to a plurality of first training data values in a corresponding first training data element. Likewise, each second training embedding can comprise a plurality of second embedding values, which may correspond to a plurality of second training data values in a corresponding second training data element.
[0084] There are various ways that the computer system can use the encoder to generate the plurality of pairs of training embeddings, which may depend on the nature of the training data elements, their training data values, the particular task or problem addressed by the machine learning model, or various other considerations or conditions. For example, the computer system can use the encoder to implement “feature-by-feature” encoding of the training data elements, i.e., for each training data element, the computer system can generate aPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 corresponding training embedding by encoding each training data value of the plurality of training data values, thereby generating a corresponding embedding value. In this way, the computer system can generate a corresponding training embedding comprising a plurality of corresponding embedding values.
[0085] As an example, if a training data element comprises 100 training data values, the computer system could individually encode each training data value, thereby generating a training embedding comprising 100 training embedding values. As an alternative, the computer system could collectively encode all 100 training data values to generate a training embedding vector of any size, e.g., comprising 50 embedding values. As another alternative, the computer system could perform a feature-by -feature encoding process for some subsets of the training data elements but not for others. For example, training data values corresponding to latitude and longitude could be collectively encoded to produce a “location” embedding, while a training data value corresponding to an access request amount could be encoded individually.
[0086] Further, different ty pes of training data values can be encoded in different ways. For example, in some embodiments, numerical training data values can be “directly” encoded, i.e., the embedding value corresponding to a numerical training data value can comprise the training data value itself, e.g., a number such as “123” can be “encoded” to produce an embedding “123”. As another example, a nominal value (such as the name of a city, e.g., “San Francisco”) can be embedded by mapping that nominal value to a numerical value. As another example, ordered nominal values or categorical nominal values can be embedded to a range of numerical values, e g., nominal values such as “short”, “medium”, and “tall” can be embedded to “1”, “2”, and “3” respectively. Alternatively, such ordered nominal values could be embedded to “one-hot encodings”, such as “001” for “short”, “010” for “medium”, and “100” for tall. Alternatively, such ordered nominal values could be mapped to vectors of arbitrary length, e.g., a value such as “tall” could be encoded to produce a ten-dimensional embedding vector. It should be understood that various other embeddings, encodings, and embedding or encoding methods can be used with embodiments of the present disclosure, and the examples provided are not intended to be limiting.D. Determine Whether Pairs of Training Data Elements are Positive or Negative
[0087] At step 408, for each pair of training data elements, the computer system can determine whether that pair of training data elements comprises a positive pair of trainingPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 data elements or a negative pair of training data elements. The computer system can determine whether each pair of training data elements is positive or negative based on one or more values of each pair of training data elements or each corresponding pair of training embeddings. As an example, the computer system can evaluate and compare five features (e.g., the first five features or five random features) from a first training data element and a second training data element in a given pair of training data elements in order to determine whether that pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements.
[0088] As another example, the computer system can evaluate and compare an embedding value (e.g., the last embedding value or a random embedding value) from a first training embedding and a second training embedding in a given pair of training embeddings in order to determine whether a corresponding pair of training data elements (e.g., the pair of training data elements used to produce that pair of training embeddings) comprises a positive pair of training data elements or a negative pair of training data elements.
[0089] There are various methods by which the computer system can determine whether each pair of training data elements can comprise a positive or negative pair of training data elements, which may depend on the nature of the one or more values of each pair of training data elements or each pair of training embeddings. For example, if the one or more values of each pair of training data elements comprise a first numerical value corresponding to a first training data element and a second numerical value corresponding to a second training data element in the pair, then the computer system may use a different method than if (for example) the one or more values of each pair of training data elements comprise a first nominal value corresponding to the first training data element and a second nominal value corresponding to the second training data element in the pair. Various methods for determining whether a pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements for various configurations of training data values and embedding values are described in more detail below.
[0090] As a general summary however, a pair of training data elements can be considered to be a positive pair of training data elements if the selected features or embedding values on which those two training data elements are being compared (e.g., the one or more values of each pair of training data elements) are “similar’’, as defined, e.g., by a distance metric or other such similarity metric, e.g., cosine similarity, Euclidean distance, etc., as described inPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 more detail below. Likewise, a pair of training data elements can be considered to be a negative pair of training data elements if the selected features or embedding values on which those two training data elements are being compared are “different” (or otherwise “not similar”), as defined, e.g., by a distance metric or other such similarity metric.
[0091] In some embodiments, the one or more values of each pair of training data elements or each pair of training embeddings can be randomly selected from a plurality of first training values (corresponding to a first training data element in a pair of training data elements) and a plurality of second training data values (corresponding to a second training data element in the pair of training data elements), or alternatively to a plurality of first training embedding values (corresponding to a first training embedding, itself corresponding to the first training data element) and a plurality of second training embedding values (corresponding to a second training embedding, itself corresponding to the second training data element).
[0092] If the pairs of training data elements or pairs of training embeddings are organized into a data table, e.g., such that each row of the table corresponds to a different training data element or a different training embedding and each column corresponds to a different training data value (e.g., feature) or a different embedding value, the one or more training data values (or embedding values) can be randomly selected by randomly selecting one or more columns from such a data table. A label (contained in e.g., a label column) does not necessarily need to be used to determine whether each pair of training data elements or each pair of training embeddings comprise a positive pair or negative pair of training embeddings. As a result, it is possible for two training data elements with distinct labels (e.g., one corresponding to a fraudulent access request and another corresponding to a legitimate access request) to comprise a positive pair of training data elements.
[0093] In different rounds of the iterative training process, different training data values or embedding values can be randomly selected. For example, for a machine learning model being trained to predict instances of a certain disease in patients (e.g., type 2 diabetes), in one round of the iterative training process, features such as “height” and “weight” could be used to evaluate whether pairs of training data elements (corresponding to pairs of patients) comprise positive pairs or negative pairs of training data elements, then in a subsequent round of the iterative training process, features such as “gender”, “age”, and “weight” could be used to evaluate whether pairs of training data elements comprise positive pairs or negative pairs of training data elements.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0094] By randomly selecting features or embeddings over the course of the training process, the machine learning model can develop a more general understanding of the feature and / or embedding spaces, thereby improving the model’s overall performance. As described in more detail further below, contrastive loss values can be determined based on the positivity or negativity (generally referred to herein as the “polarity”) of pairs of training data elements. Such contrastive loss values can be used to train the machine learning model to produce embeddings (e.g., by updating the parameters of a trainable encoder used to generate embeddings) such that positive pairs of training data elements result in more similar embeddings and negative pairs of training data elements result in more distinct embeddings, e.g., as described above with reference to the “push-pull” forces of FIG. 2. As a result, the encoder can effectively cluster the training data set in embedding space, making it easier for a prediction model to leam large-scale patterns or distributions in the training data set, thereby enabling the model to gain a multidimensional understanding of the training dataset, thereby improving accuracy.1. Numerical Polarity Determination
[0095] Various methods for determining whether pairs of training data elements are positive or negative for various types of data are described in more detail below. For example, the computer system can determine whether a given pair of training data elements is positive or negative based on a comparison of a pair of numerical value in each pair of training data elements. As such, in some embodiments, the one or more values of each pair of training data elements can comprise a first numerical value corresponding to a first training data element in the pair of training data elements and a second numerical value corresponding to a second training data element in the pair of training data elements, and these first and second numerical values can be used to determine whether a given pair of training data elements is a positive or negative pair. One of these numerical values or training data elements may be referred to as an “anchor value” or “anchor data element” for the purpose of the comparison.
[0096] In order to determine whether a pair of training data elements is positive or negative, the computer system can determine a median value corresponding to the first numerical value and the second numerical value based on the plurality of pairs of training data elements. For example, if the first and second numerical values comprise systolic blood pressure values, the computer system could determine a median systolic blood pressure valuePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 from all pairs of training data elements (e.g., 130 mm Hg). The computer system can then determine whether the pair of training data elements comprise a positive pair or negative pair by comparing the first and second numerical values to this median value.
[0097] In some embodiments, the computer system can determine that the pair of training data elements comprises a positive pair of training data elements when the first numerical value and the second numerical value are both greater than the median value or when the first numerical value and the second numerical value are both less than the median value. For example, if the first numerical value and the second numerical value are 118 mm Hg and 122 mm Hg respectively, the computer system could determine that the pair of training data elements comprises a positive pair of training data elements. Alternatively, the computer system can determine that the pair of training data elements comprises a negative pair of training data elements when the first numerical value is greater than the median value and the second numerical value is less than the median value, or when the first numerical value is less than the median value and the second numerical value is greater than the median value. For example, if the first numerical value is 118 mm Hg and the second numerical value is 140 mm Hg, the computer system could determine that the pair of training data elements comprises a negative pair of training data elements.
[0098] This process is generally illustrated by the flowchart of FIG. 5. If the training data elements are organized into a data table, e.g., in which each row corresponds to a training data element (or e.g., a pair of training data elements) and each column corresponds to a feature, at step 502 (of FIG. 5) the computer system can calculate a median value corresponding to a given feature column. At step 504, the computer system can check if a pair of data elements both correspond to the same side of the median value. If the pair of data elements correspond to the same side of the median value, the computer system can determine that the pair of data elements comprises a positive pair of data elements. If the data elements correspond to opposite sides of the median value, the computer system can determine that the pair of data elements comprises a negative pair of data elements.
[0099] In other embodiments, the computer system can determine whether a given pair of training data elements is positive or negative based on a comparison of multiple numerical values in each pair of training data elements. As such, in some embodiments, the one or more values of each pair of training data elements can comprise one or more first numerical values corresponding to a first training data element in the pair of training data elements andPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 one or more second numerical values corresponding to a second data element in the pair of training data elements. In some embodiments, the one or more values of each pair of training data elements can be randomly selected and used to determine whether each pair of training data elements is a positive or negative pair.
[0100] The computer system can determine a median distance value corresponding to the one or more first numerical values and the one or more second numerical values. For example, the computer system can treat each set of first numerical values corresponding to each first training data element as a first vector, treat each set of second numerical values corresponding to each second training data element as a second vector, determine a distance (e.g., a Euclidean distance or cosine similarity metric) between each first vector and second vector, and then determine the median distances from the distances determined for each pair of vectors. As such, in some embodiments the median distance value can comprise a median Euclidean distance or a median cosine similarity metric.
[0101] The computer system can determine whether each pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements by comparing a distance between a first vector corresponding to the one or more first numerical values (e.g., a vector in which each element of the vector comprises a first numerical value of the one or more first numerical values) and a second vector corresponding to the one or more second numerical values with the median distance value. In some embodiments, the computer system can determine that the pair of training data elements comprises a positive pair of training data elements with a distance between a first vector corresponding to the one or more first numerical values and a second vector corresponding to the one or more second numerical values is less than the median distance value.Alternatively, the computer system can determine that the pair of training data elements comprises a negative pair of training data elements when the distance between the first vector and the second vector is greater than the median distance value. As described above, in some embodiments the median distance value can comprise a median Euclidean distance or a median cosine similarity metric, and likewise the distance between the first vector and the second vector can comprise a Euclidean distance or a cosine similarity metric.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 2. Nominal Polarity Determination
[0102] In some embodiments, the computer system can determine whether a given pair of training data elements is positive or negative based on a comparison of a pair of nominal values in each pair of training data elements. As such, in some embodiments the one or more values of each pair of training data elements can comprise a first nominal value corresponding to a first training data element in the pair of training data elements and a second nominal value corresponding to a second training data element in the pair of training data elements. The computer system can determine that the pair of training data elements comprises a positive pair of training data elements when the first nominal value matches the second nominal value. Alternatively, the computer system can determine that the pair of training data elements comprises a negative pair of training data elements when the first nominal value does not match the second nominal value.
[0103] In other embodiments, the computer sy stem can determine whether a given pair of training data elements is positive or negative based on a comparison of multiple nominal values in each pair of training data elements. As such, in some embodiments, the one or more values of each pair of training data elements can comprise a plurality of first nominal values corresponding to a first training data element in the pair of training data elements and a plurality' of second nominal values corresponding to a second training data element in the pair of training data elements. In such embodiments, each first nominal value in the plurality of first nominal values can be paired with a second nominal value in the plurality of second nominal values, i.e., such that the plurality of first nominal values and the plurality of second nominal values comprise a plurality of pairs of nominal values. For example, for a machine learning model that is used to predict airline travel for the purpose of allocating commercial airplanes or fuel to airports, the plurality of first nominal values could include a “departure’’ nominal value, e.g., the name of a city from which an airline passenger departed, an “arrival” nominal value, e.g., the name of a city to which an airline passenger arrived, and an “airline” nominal value, indicating the airline on which a passenger flew between the departure city and the arrival city. Similarly, the plurality of second nominal values could also include a departure nominal value, an arrival nominal value and an airline nominal value, enabling the computer system to form a pair of departure nominal values, a pair of arrival nominal values, and a pair of airline nominal values corresponding to a given pair of training data elements.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0104] For each pair of nominal values in each pair of training data elements, the computer system can determine whether that pair of nominal values comprises a positive pair of nominal values or a negative pair of nominal values, e.g., using the methods described above. For example, the computer system can determine if a pair of nominal values comprises a positive pair of nominal values if that pair of nominal values matches and can determine it is a negative pair of nominal values if that pair of nominal values does not match.
[0105] Afterwards, the computer system can determine whether each pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements by determining whether a majority of the pairs of nominal values comprise positive nomina values or negative nominal values. For example, the computer system can determine that a pair of training data elements comprises a positive pair of training data elements when a majority of the plurality of pairs of nominal values comprise positive pairs of nominal values and can determine that the pair of training data elements comprises a negative pair of training data elements when a majority of the plurality of pairs of nominal values comprise negative pairs of nominal values. For example, for a pair of training data elements, corresponding to two airline passengers who departed from the same city and arrived at the same city, but used different airlines, two pairs of nominal values match and one pair of nominal values do not match. Hence, there are two positive pairs of nominal values and one negative pair of nominal values. As positive pairs of nominal values are the majority in this case, the computer system can determine that the pair of training data elements comprises a positive pair of training data elements.3. Ordered Nominal Polarity Determination
[0106] In some embodiments, the computer system can determine whether a given pair of training data elements is positive or negative based on a comparison of a pair of ordered nominal values in each pair of training data elements (e.g., sequential days of the week such as “Monday”, “Tuesday”, etc., qualifiers such as “tall”, “medium”, and “short”, etc.). As such, in some embodiments the one or more values of each pair of training data elements can comprise a first ordered nominal value corresponding to a first training data element in the pair of training data elements, and a second ordered nominal value corresponding to a second training data element in the pair of training data elements.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0107] In such cases, the computer system can determine whether a given pair of training data elements are positive or negative using methods similar to those described above with reference to nominal data values. The computer system can determine that the pair of training data elements comprises a positive pair of training data elements when the first ordered nominal value matches the second ordered nominal value. Alternatively, the computer system can determine that the pair of training data elements comprises a negative pair of training data elements when the first ordered nominal value does not match the second ordered nominal value.
[0108] As described in more detail further below, e.g., with reference to step 412 and the pseudocode of FIG. 6, the computer system may calculate contrastive loss values based on the polarity of pairs of training data elements differently if the polarity was determined based on nominal values or ordered nominal values. In general terms, the contrastive losses can be scaled based on the difference between the “order” of each ordered nominal value, such that the contrastive loss is greater for negative pairs of training data elements with “more distinct” ordered nominal values than for negative pairs of training data elements. For example, for a pair of training data elements, if a first nominal value is “tall” and a second nominal value is “medium”, those nominal values are distinct, and therefore the pair of training data elements can comprise a negative pair of training data elements. For a second pair of training data elements, if a first nominal value is “tall” and a second nominal value is “short”, those nominal values are distinct, and therefore the second pair of training data elements can also comprise a negative pair of training data elements. However, the order of the nominal values suggests that “tall” is “more different” than “short” than “tall” is different from “medium”, and hence the second pair of training data elements may result in a greater contrastive loss value than the first pair of training data elements.
[0109] Alternatively, the computer system can determine whether a given pair of training data elements based on a comparison of multiple ordered nominal values in each pair of training data elements. This can be accomplished in various ways, e.g., based on majorities, as described above with reference to non-ordered nominal polarity' determination.4. Embedding-based Polarity Determination
[0110] As mentioned above, the computer system can determine whether a given pair of training data elements is positive or negative based on a comparison of embedding rather thanPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 (or in addition to) training data values. As such, in some embodiments, the one or more values of each pair of training data elements or each pair of training embeddings can comprise one or more first embedding values corresponding to a first training embedding in a corresponding pair of training embeddings (e.g., an embedding generated from a first training data element using the encoder) and one or more second embedding values corresponding to a second training embedding in a corresponding training embedding (e.g., an embedding generated from a second training data element using the encoder). In some embodiments, the one or more first embedding values and the one or more second embedding values can be randomly selected and used to determine whether each pair of training data elements is a positive or negative pair.
[0111] To determine whether pairs of training data elements are positive or negative, the computer system can determine a median embedding distance value corresponding to the one or more first embedding values and the one or more second embedding values. For example, the computer system can treat each set of first embedding values corresponding to each first training embedding as a first vector, treat each set of second embedding values corresponding to each second training embedding as a second vector, determine a distance (e.g.. a Euclidean distance or cosine similarity metric) between each first vector and second vector, and then determine the median distance from the distances determined for each pair of vectors.
[0112] The computer system can determine whether each pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements by comparing a distance between a first vector corresponding to the one or more first embedding values and a second vector corresponding to the one or more second embedding values. In some embodiments, the computer system can determine that a pair of training data elements comprises a positive pair of training data elements when a distance between the first vector corresponding to the one or more first embedding values and a second vector corresponding to the one or more second embedding values is less than the median embedding distance value. Alternatively, the computer system can determine that the pair of training data elements comprises a negative pair of training data elements when the distance between the first vector and the second vector is greater than the median embedding distance value.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 E. Determine Embedding Distance Value
[0113] Referring back to FIG. 4, at step 410, the computer system can determine an embedding distance value for each pair of training embeddings. In this way, the computer system can determine a plurality of embedding distance values. Similar to the distance values and embedding distance values discussed above, the embedding distance values can be based on a cosine similarity' metric, a Euclidean distance, or any other distance or similarity' metric that can be used to compare embeddings. As described with reference to subsequent steps of FIG. 4, the computer system can use these embedding distance values to determine contrastive loss values that can be used to train the machine learning model.F. Calculating Contrastive Loss Values
[0114] At step 412, the computer system can determine a contrastive loss value for each pair of training embeddings, thereby determining a plurality of contrastive loss values. The computer system can determine each contrastive loss value based on a corresponding embedding distance value (determined, e.g., at step 410) and based on whether a corresponding pair of training data elements is a positive pair of training data elements or a negative pair of training data elements (determined, e.g., at step 408). The computer sy stem can determine contrastive loss values in various ways, which may depend in part on the nature of the process, training data values, or embedding values used to determine whether pairs of training data elements are positive or negative pairs.
[0115] However, in general terms, for positive pairs of training data elements, the computer system can determine contrastive loss values that are proportional to corresponding embedding distance values, i.e., as an embedding distance value increases, a corresponding contrastive loss value also increases. In some embodiments, the contrastive loss value corresponding to a positive pair of training data elements can comprise the corresponding embedding distance value itself. By contrast, for negative pairs of training data elements, the computer system can determine a contrastive loss value that is proportional to the negative of the corresponding embedding distance value, i.e., as an embedding distance value increases, a corresponding contrastive loss value decreases. In some embodiments, the contrastive loss value corresponding to a negative pair of training data elements can comprise the difference between a margin and the embedding distance value. As described above, the use of contrastive losses (either alone or in addition to other loss values) can improve a machinePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 learning model’s ability- to holistically understand the features of the training dataset, thereby improving accuracy.
[0116] In more detail, for a positive pair of training data elements and their corresponding training embeddings ra(which may be referred to as an ’‘anchor” embedding) and its corresponding paired embedding rp, a corresponding contrastive loss value Lpair(ra, rp^) can be calculated with the formula Lpair(ra, rp^ = d(ra, rp~), where d(ra, rp) is a corresponding embedding distance value between paired embeddings raand rp. As described above, various distance metrics can be used to determine embedding distance values, including Euclidean distance and cosine similarity. In some embodiments, the distance metric d(ra, Tp) = 1—cosine_similarity(ra, rp), which is bound between 0 and 2. By contrast, for a negative pair of training data elements and their corresponding training embeddings raand its corresponding (negative) paired embedding rn, a corresponding contrastive loss value can be calculated with the formula Lpair(ra, rn) = max(0, m — d(ra, rn), where m is a marginand d(ra, is a corresponding embedding distance value. In some embodiments, the margin can comprise a predefined hyperparameter. Experimental results indicated that a margin m = 1.5 was effective for some learning tasks. The maximum function max can be used to guarantee that each contrastive loss value is non-negative, i.e., if d(ra, rn) > m (indicating large separation between the two embeddings corresponding to the negative pair of training data elements) then the loss value is zero, otherwise, if d(ra, rn) < m, the loss value is equal to the difference.
[0117] As described above, the computer system can calculate contrastive loss values in different ways, which may depend in part on the data values or embeddings used to determine whether each pair of training data values was positive or negative. For example, if ordered nominal values were used to determine whether each pair of training data elements were positive or negative, the order or rank of those nominal values can be used to determine the contrastive loss values. As such, in some embodiments, each contrastive loss value can be based on a first order of a corresponding first ordered nominal value and a second order of a corresponding second ordered nominal value. In such cases, the computer system can determine the corresponding contrastive loss values using the formula Lpair(ra, rn) = max(0, rank ra, rn) * m — d(ra, r„)), where rank(ra, rn) is a rank mapping function.Various rank mapping functions can be used in methods according to embodiments.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0118] In some embodiments, the rank mapping function can be based on a difference between the order of nominal values used to determine the positivity or negativity of corresponding pairs of training data elements. For example, for ordered nominal values such as “malnourished”, “underweight”, “healthy weight”, “overweight”, and “obese”, each ordered nominal value could be mapped to a numerical value (e.g., 1, 2, 3, 4, and 5), and the rank mapping function could involve determining the difference between these numerical values. For example, for a negative pair of training data elements corresponding to the nominal values “underweight” and “obese”, the corresponding rank could be 5 — 2 = 3, while for a negative pair of training data elements corresponding to “overweight” and “healthy weight”, the corresponding rank could be 4 — 3 = 1. Such a rank can be multiplied by the margin m in order to scale the margin, more strictly penalizing the encoder for generating similar embeddings for training data elements that are “more different” (e.g., “underweight” and “obese”) and less strictly penalizing the encoder for generating similar embeddings for training data elements that are more similar (e.g., “overweight” and “healthy weight”).G. Combine Loss Values
[0119] Referring back to FIG. 4, at step 414, the computer system can combine the plurality of contrastive loss values to generate a single contrastive loss value, e.g., according to the formula:^contrastive * ^-‘(.aJ}')Spairs Lpair(Cl,
[0120] In general terms, the computer system can compute a sum of the contrastive loss values S(a,&)epai7-s ^Pair (a> ) corresponding to each pair of training data elements, then divide that sum by the total number of pairs to determine the combined contrastive loss value Lcontrastive, which can effectively comprise an average of the contrastive loss values pair( > -
[0121] In some embodiments, the computer system can further combine the contrastive loss contrastive with other loss values Lgeneral, which can include predictive loss values, including those based on cross-entropy or mean squared error. As described above, a machine learning model according to embodiments can include both an encoder and a prediction model. Embeddings generated using the encoder can comprise the input to thePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 prediction model, which can then produce predictions based on those embeddings. As described above in the general summary of machine learning, predictions produced by a machine learning model can be used as the basis of a loss function, e.g., by comparing predictions made using the machine learning model to labels corresponding to the training dataset. Loss values corresponding to such predictions can then be used to train the machine learning model, e.g., by updating its parameters.
[0122] Similarly, in embodiments of the present disclosure, the computer system can use the prediction model to generate a plurality of prediction model outputs using the plurality of pairs of training embeddings, e.g., by inputting each training embedding of the plurality of pairs of training embeddings into the prediction model. Further, the computer system can determine one or more prediction output loss values based on the plurality’ of prediction model outputs. This plurality of prediction model outputs can be used to determine one or more prediction output loss values (which can be combined into one or more loss values L5e7ie7-a(), which can then be used to train the prediction model, e.g., by updating a prediction model parameter set associated with the prediction model.
[0123] In addition to the prediction model parameter set, the encoder parameter set can also be updated based on one or more prediction output loss values in addition to the plurality of contrastive loss values. For example, in some embodiments, the encoder parameter set can be updated based on a combined loss value ^combined ^general T ^contrastive^ where ^general is generated (e.g., in part) from the one or more prediction output loss values. As such, in some embodiments the computer system can generate a combined loss value comprising a combination of the one or more prediction output loss values and the plurality of contrastive loss values, e.g., by averaging the one or more prediction output loss values to produce general loss value Lgeneral, averaging the plurality of contrastive loss values to produce a combined contrastive loss value Lcontrastive, and then summing these two loss values together. This approach highlights the adaptable nature of some embodiments of the present disclosure, as contrastive loss values can be effectively added to existing or traditional loss values (e.g., those based on mean squared error or cross-entropy between training labels and prediction model outputs) without requiring further changes to machine learning model architectures.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 H. Update Model Parameters
[0124] At step 416, the computer system can update an encoder parameter set based on the plurality of contrastive loss values, thereby training the machine learning model. In some embodiments, the computer system can update the encoder system based on a combined contrastive loss value, e.g., generated by combining the plurality' of contrastive loss values, e.g., as described above with reference to the pseudocode of FIGs. 6 and 7. As described above with reference to step 408 and with reference to FIG. 2. updating the encoder parameter set based on the plurality of contrastive loss values can cause the encoder to generate subsequent training embeddings (e.g., in subsequent rounds of the iterative training process) corresponding to positive pairs of training data values that have a reduced embedding distance value and generate subsequent training embeddings corresponding to negative pairs of training data elements that have an increased embedding distance value. In other words, training the encoder based on the on the plurality of contrastive loss values can cause the encoder to apply the “push-pull” forces (described above with reference to FIG. 2) to the training embeddings, thereby effectively clustering training embeddings based on their polarity. In some embodiments, the computer system can update the encoder parameter set based on a combined loss value or a combined contrastive loss value, e.g., generated during step 414. As such, the encoder parameter set can be updated based on one or more prediction output loss values in addition to the plurality of contrastive losses.
[0125] In some embodiments, the computer system can train the entire machine learning model in a single iterative training process, i.e., train the encoder and the prediction model concurrently. As such, in some embodiments the computer system can additionally update a prediction model parameter set based on the one or more prediction output loss values. In some embodiments, the prediction model can comprise a neural network and the prediction model parameter set can comprise a plurality of weights associated with the neural network. The one or more prediction output loss values can be determined using cross-entropy or a mean squared error calculated between the plurality of prediction model outputs and a plurality of corresponding training labels. In such embodiments, the computer system can update the prediction model parameter set based on the one or more loss values using backpropagation and / or stochastic gradient descent. However, it should be understood that any known machine learning technique can be used to update either the encoder parameter set or the prediction model parameter set. Moreover, it should be understood that the encoderPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 and prediction model can be trained independently, e.g., the training method of FIG. 4 can be used to train the encoder and update the encoder parameter set, then at a later time a different training method can be used to train the prediction model and update the prediction model parameter set, or vis-versa.I. Repeat Iterative Training Process if Necessary
[0126] At step 418, the computer system can determine if a terminating condition has been met. As describe above, in some embodiments the terminating condition can comprise a defined number of training rounds, and the terminating condition can be met if a total number of training rounds performed equals or exceeds the defined number of training rounds. In other embodiments, the terminating condition can comprise a convergence condition. This terminating condition can be met if the set of model parameters converge, e.g., exhibit little to no change in consecutive training rounds. If the terminating condition has not been met. the computer system can return to step 402 and repeat the iterative training process until the terminating condition has been met, e.g., by sampling a new batch of pairs of training data elements. Otherwise at step 420 the computer system can complete the iterative training process. At this point, the encoder parameter set (and optionally the prediction model parameter set) can be fixed for use during inference.IV. EXAMPLE PSEUDOCODE
[0127] Steps 408-412 may be better understood with reference to the pseudocode of FIGs.6 and 7, which show methods for determining contrastive loss values for ordered nominal features and on the basis of embedding values respectively. Referring to FIG. 6, at line 604, a computer system can determine pairwise distances (e.g.. Euclidean distances, cosine similarities, etc.) between pairs of embeddings corresponding to the plurality of pairs of training data elements.
[0128] At line 606 the computer system can initialize a cumulative contrastive loss value. In the “for-loops” of lines 608-620 and 610-620. the computer system can iterate through a vector of these embeddings and compare the nominal values corresponding to each embedding. If the embeddings have the same nominal value (e.g., both embeddings correspond to a city nominal value such as “San Francisco”), the computer system can define the corresponding pair of training data elements as a positive pair (line 612). The computerPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 system can then compute the contrastive loss as the pairwise distance between those embeddings, then add the contrastive loss to the cumulative contrastive loss value (line 614).
[0129] Otherwise, if the embeddings do not have the same nominal value, the computer system can define the corresponding pair of training data elements as a negative pair (line 616). The computer system can determine a “rank” based on the difference between the nominal values of the pair of training data elements (line 618), which can be used to determine the contrastive loss values, e.g.. using a “rank mapping”. There are various ways in which this could be accomplished. For example, nominal values could be mapped to numerical values based on their relative position in the nominal ordering, e.g., a nominal value such as “tall” could be mapped to the value “2”, while a nominal value such as “medium” could be mapped to the value “1”, and a nominal value such as “short” could be mapped to the value zero. In such a case, the rank could be determined by subtracting the respective numerical value mappings from one another, e.g., the rank “difference” between a “tall” nominal value and a “short” nominal value could be 2 — 0 = 2. In such cases, the rank will be greater when the nominal values are “more different” and will be smaller when the nominal values are more similar.
[0130] After determining the rank, the computer system can determine the contrastive loss and add it to the cumulative contrastive loss (line 620). The contrastive loss can be based on the distance between the two embeddings relative to a margin that can be scaled based on the determined rank, such that the distance between embeddings that correspond to “more different” nominal values should be larger than the distance corresponding to more similar nominal values. The maximum between the difference between the scaled margin and the pairwise distance, and zero can be used to guarantee that the loss is a non-negative value, i.e., that the loss is zero if the pairwise distance is greater than or equal to the scaled margin and is greater than zero if the pairwise distance is less than the scaled margin.
[0131] FIG. 7 depicts pseudocode corresponding to a method for computing the contrastive loss based on embeddings corresponding to a randomly selected subset of features. At line 704, a computer system can determine indices corresponding to a random subset of features. Afterwards at line 706, the computer system can determine the corresponding feature-by-feature embeddings using those indices. At line 708, the computer system can compute the pairwise distances between those feature-by-feature embeddings, e.g., using the Euclidean distance. At line 710, the computer system can compute the median pairwise distancePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 between all sets of feature embeddings across all pairs of training data elements. This median distance can be used to determine if each pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements. At line 712, the computer system can initialize a cumulative contrastive loss value. Via the for-loops of lines 714-724 and 716-724, the computer system can determine whether each pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements. The computer system can do so by comparing the pairwise distances between corresponding pairs of training embeddings to the median pairwise distance.
[0132] If the pairwise distance between two embeddings is less than the median pairwise distance, the computer system can determine that the corresponding pair of training data elements is a positive pair of training data elements (line 718). Afterwards, at line 720. the computer system can use that pairwise distance as the contrastive loss value and add it to the cumulative contrastive loss.
[0133] Alternatively, if the pairwise distance between two embeddings is greater than the median pairwise distance, the computer system can determine that the corresponding pair of training data elements is a negative pair of training data elements (line 722). Afterwards, at line 724, the computer system can determine a contrastive loss value based on the difference between the pairwise distance and a margin and add the contrastive loss value to the cumulative contrastive loss value.V. INFERENCE
[0134] After training a machine learning model according to embodiments, a computer system can use the machine learning model to generate predictions during an inference phase, as described herein with reference to the flowchart of FIG. 8.
[0135] At step 802, a computer system can receive a test data element. In some embodiments, the computer system can receive the test data element from a database, data stream, a local memory element such as a hard drive, cloud storage, an I / O interface, or any other appropriate source. In other embodiments, the computer system can comprise a server computer that performs machine learning based analysis as a service for client computers. In such embodiments, the computer system can receive the test data element from the client computer (or from any other appropriate source), e.g., over a communication network such as the Internet, as described above with reference to FIG. 3.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0136] The test data element can comprise a plurality of test data values (e.g., features). Such a test data element can correspond to a particular event, interaction, object, entity, person, etc., which may be the subject of machine learning analysis. Such test data values may comprise quantifiable or qualifiable measurements or observations about the subject of the test data element. For example, for a test data element corresponding to electrical power demand, such test data values could comprise sets of features predictive of electrical power demand (e.g., the time of year, the time of day, outdoor temperature, latitude, longitude, etc.). As another example, if embodiments of the present disclosure are used to generate predictions related to the legitimacy (or fraudulence) of credit card transactions, the test data values could comprise sets of features predictive of credit card fraud (e.g., purchase amounts, purchase locations, purchase time of day, purchase frequency, credit card balance, etc.). As yet another example, if embodiments of the present disclosure are used to provide cybersecurity for computer systems, the test data values could comprise sets of features predictive of system intrusions (e.g., the contents of messages transmitted over a network, calls to the system kernel, etc.)
[0137] At step 804, the computer system can generate a test embedding using an encoder, which may comprise a trainable component of a machine learning model, trained e.g., using the contrastive learning methods described above with reference to FIG. 4. Such an encoder could comprise any appropriate trainable encoding system, including a transformer model, another attention-based machine learning model, or any other machine learning model.
[0138] At step 806, the computer system can generate a test prediction model using a prediction model and based on the test embedding. Such a prediction model can comprise a component of the machine learning model, which could comprise (as an example) a multilayer perceptron, fully connected layer, or other neural network model, or any other machine learning model that can be used for generating predictions (e.g., a random forest, support vector machine, etc.). The test prediction model output can comprise a prediction corresponding to the test embedding. In some embodiments, such a prediction can comprise a binary prediction, indicating e.g., whether some subject of the test data element belongs to a class of subjects or does not belong to that class of subjects. For example, a binary fraud prediction may indicate whether a transaction is likely legitimate or likely fraudulent. As another example, a binary disease prediction may indicate whether a patient likely suffers from a given disease (e.g., type 2 diabetes) or does not suffer from that disease. However, itPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 should be understood that embodiments of the present disclosure can be used to generate test prediction model outputs corresponding to different types of predictions, including nonbinary predictions such as continuous predictions (e.g., indicating a predicted power demand value in megawatts) or trinary, quaternary, etc., predictions (e.g., indicating whether a subject belongs to one of several mutually exclusive classes).
[0139] Optionally, at step 808, if the computer system is performing machine learning based analysis on behalf of a client computer, the computer system can transmit the test prediction model output to the client computer, which could comprise the client computer from which the computer system received the test data element. The computer system can transmit the test prediction to the client computer over a communication network such as the Internet, or via any other appropriate means.
[0140] Optionally, at step 810. various actions, interactions, or further processing can be performed, automatically or otherwise, by either the computer system or a client computer responsive to the test prediction generated at step 806. For example, in the context of credit card fraud detection, the computer system or a client computer could automatically approve or deny a transaction based on the test prediction, e.g.. approving the transaction if it is likely legitimate based on the test prediction and denying the transaction if it is likely fraudulent based on the test prediction. For example, if the test prediction was a binary prediction (with e.g., “TRUE’" corresponding to a legitimate transaction and “FALSE’" corresponding to a fraudulent transaction), the computer system or client computer could approve the transaction if the test prediction is “TRUE” and deny the transaction if the test prediction is " FALSE”. As another example, if the test prediction was a continuous prediction, (e.g., a percentage indicating the likelihood that a transaction was fraudulent), the computer system or the client computer could approve the transaction if the test prediction was under a threshold value (e.g., 50%) and approve the transaction if the test prediction was greater than the threshold value.
[0141] Similarly, in the context of a context moderation system for a social networking website, the computer system or the client computer (or e.g., an operator of either system) could delete a post on the social networking website if a corresponding test prediction indicates that the post is likely malicious or violates community guidelines. As another example, in the context of a power demand forecasting system, the computer system or the client computer associated with a hydroelectric dam could perform some action responsive toPATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 a test prediction that indicates increasing electric power demand. For example, a computer system or a client computer associated with a hydroelectric governor could increase the speed of hydraulic turbines at a hydropower plant, thereby increasing electric power supply to meet the forecasted increased demand. As another example, in the context of a cybersecurity system, the computer system or client computer could issue an alert, responsive to a test prediction that indicates a high likelihood of cyberattack, system intrusion, or the presence of viruses or malware within a computer network. Various other actions, automatic or otherwise, can be performed based on the context or application of machine learning models according to embodiments, and the examples provided herein are intended to be non-limiting.VI. ADVANTAGES
[0142] As described throughout the present disclosure, contrastive learning methods and systems according to embodiments result in trained machine learning models that are more accurate that machine learning models trained with more typical “non-contrastive” learning methods. Machine learning models according to embodiments particularly perform better in “rare but simple” cases, e.g., those that might not be well -represented by the training dataset, but nonetheless embody a comparatively simple or straightforward case within a particular machine learning task. Many machine learning models that achieve generally high performance may still struggle with such cases, as optimization of the loss function resulted in models that favor high performance on common cases at the cost of low performance on rare ones. However, by using contrastive learning methods and including a contrastive loss term, methods according to embodiments can be used to train machine learning models to develop a more holistic understanding of their training datasets and respective tasks, thereby generally improving their accuracy and particularly improving it in “rare but simple” cases. This improvement is further aided by using randomized subsets of features to determine contrastive loss values. Using a constant subset of features could cause a machine learning model to overemphasize the importance of those features when learning the distribution of a training dataset. However, by randomly selecting features, machine learning models according to embodiments are forced to leam holistic patterns in training datasets, e.g., patterns that span the collective features, thereby improving overall model performance.
[0143] There are several other advantages of methods and systems according to embodiments. As one example, experimentation and practical implementation of methods according to embodiments have shown that the inclusion of contrastive learning improves thePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 stability of model training processes. Models that do not use contrastive learning may need to use variable scheduling or learning rates to achieve their highest level of performance. However, training methods according to embodiments can achieve higher levels of performance without needing to use these extra steps. Another advantage of methods according to embodiments is that contrastive learning can be incorporated into existing encoder-based machine learning models to improve those model’s performance, without requiring otherwise significant modification or restructuring of such models. Similarly, embodiments of the present disclosure can be used to improve the generalizability of machine learning models, which can be useful for large organizations that may instantiate and use large numbers of large-scale machine learning models, such as large language models.
[0144] Experimental results empirically demonstrate accuracy advantages of methods and systems according to embodiments. FIG. 9 depicts a table comparing Fl scores corresponding to a naive modeling solution 902, an in-context learning model 904, and machine learning models according to embodiments 906 (e.g., using contrastive losses as described above) on three different machine learning tasks (tasks 1, 2, and 3). each of which involved large amounts of data. Generally, the naive modeling solution 902 involved training a machine learning model in a "‘standard” manner on the data, which generally resulted in the lowest Fl scores. The in-context learning model 904 was trained using in-context learning and a loss function based on cross-entropy, resulting in strong Fl improvements over the naive modeling solution 902.
[0145] Machine learning models according to embodiments 906 were similar to the incontext learning model 904, but additionally used the contrastive loss terms described above during training. Machine learning models achieved the highest Fl scores on all three tasks, and demonstrated sizable improvements over the in-context learning models 904, demonstrating the effectiveness of methods and systems according to embodiments. Such accuracy improvements can result in improved performance in decision-making tasks based on machine learning model predictions. For example, by improving power demand prediction accuracy, a coal-fired power plant can more efficiently allocate coal to power production, leading to less waste. As another example, by improving credit card fraud prediction accuracy, a payment processing network can reduce the number false negative identifications of fraud, improving the customer experience by preventing customers from losing money to fraud.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 VII. EXAMPLE OF AUTHENTICATION FOR ACCESSING A PROTECTED
[0146] As described above, machine learning models according to embodiments can be used to improve the accuracy of access review systems, which can include machine learning models used to dynamically evaluate invalid requests for a resource and e.g., automatically approve or deny access requests based on the output of a prediction model.
[0147] Generally, access requests for a computer resource or account (e.g., transactions over the Internet) go through a fraud detection system to determine whether the transaction is authonzed or rejected as being fraudulent. Thus, a resource security system may receive requests to access a resource. The resource security system may include an access server for determining an outcome for the access request based on access rules. An exemplary resource security system is described in further detail below.
[0148] FIG. 10 shows a resource security system 1000 for authorizing access to resources, in accordance with some embodiments. The resource security system 1000 may be used to provide authorized users (e.g., via authentication) access to a resource while denying access to unauthorized users. In addition, the resource security system 1000 may be used to deny fraudulent access requests that appear to be legitimate access requests of authorized users. The resource security system 1000 may implement access rules to identify fraudulent access requests based on parameters of the access request. Such parameter may correspond to fields (nodes) of a data structure that is used to distinguish fraudulent access requests from authentic access requests.
[0149] The resource security system 1000 includes a resource computer 1010. The resource computer 1010 may control access to a physical resource 1018, such as a building or a lockbox, or an electronic resource 1016, such as a local computer account, digital files or documents, a network database, an email inbox, a payment account, or a website login. In some embodiments, the resource computer may be a webserver, an email server, or a server of an account issuer. The resource computer 1010 may receive an access request from a user 1040 via a user device 1050 (e.g., a computer or a mobile phone) of the user 1040. The resource computer 1010 may also receive the access request from the user 1040 via a request computer 1070 coupled with an access device 1060 (e.g., a keypad or a terminal). In some embodiments, the request computer 1070 may be a resource provider. For example, the request computer 1070 and the resource computer 1010 may be the same, wherein the access request from the user 1040 is generated directly at the resource computer 1010.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0150] The access device 1060 and the user device 1050 may include a user input interface such as a keypad, a keyboard, a finger print reader, a retina scanner, any other type of biometric reader, a magnetic stripe reader, a chip card reader, a radio frequency identification reader, or a wireless or contactless communication interface, for example. The user 1040 may input authentication information into the access device 1060 or the user device 1050 to access the resource. Authentication information may also be provided by the access device 1060 and / or the user device 1050. The authentication information may include, for example, one or more data elements of a user name, an account number, a token, a password, a personal identification number, a signature, a digital certificate, an email address, a phone number, a physical address, and a network address. The data elements may be labeled as corresponding to a particular field, e.g., that a particular data element is an email address. In response to receiving authentication information input by the user 1040, the user device 1050 or the request computer 1070 may send an access request, including authentication information, to the resource computer 1010 along with one or more parameters of the access request.
[0151] In one example, the user 1040 may enter one or more of an account number, a personal identification number, and password into the access device 1060, to request access to a physical resource (e.g., to open a locked security door in order to access a building or a lockbox) and the request computer 1070 may generate and send an access request to the resource computer 1010 to request access to the resource. In another example, the user 1040 may operate the user device 1050 to request that the resource computer 1010 provide access to the electronic resource 1016 (e.g., a website or a file) that is hosted by the resource computer 1010. In another example, the user device 1050 may send an access request (e.g., an email) to the resource computer 1010 (e.g., an email server) in order to provide data to the electronic resource 1016 (e.g., deliver the email to an inbox). In another example, the user 1040 may provide an account number and / or a personal identification number to an access device 1060 in order to request access to a resource (e.g., a payment account) for conducting a transaction.
[0152] In some embodiments, the resource computer 1010 may verify the authentication information of the access request based on information stored at the request computer 1070. In other embodiments, the request computer 1070 may verify the authentication information of the access request based on information stored at the resource computer 1010.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0153] The resource computer 1010 may receive the request substantially in real-time (e.g., account for delays computer processing and electronic communication). Once the access request is received, the resource computer 1010 may determine parameters of the access request. In some embodiments, the parameters may be provided by the user device 1050 or the request computer 1070. For example, the parameters may include one or more of: a time that the access request was received, a day of the week that the access request was received, the source-location of the access request, the amount of resources requested, an identifier of the resource being request, an identifier of the user 1040, the access device 1060, the user device 1050, the request computer 1070, a location of the user 1040, the access device 1060, the user device 1050, the request computer 1070, an indication of when, where, or how the access request is received by the resource computer 1010, an indication of when, where, or how the access request is sent by the user 1040 or the user device 1050, an indication of the requested use of the electronic resource 1016 or the physical resource 1018, and an indication of the ty pe, status, amount, or form of the resource being requested. In other embodiments, the request computer 1070 or the access server 1020 may determine the parameters of the access request.
[0154] The resource computer 1010 or the request computer 1070 may send the parameters of the access request to the access server 1020 in order to determine whether the access request is fraudulent. The access server 1020 may store one or more access rules 1022 for identifying a fraudulent access request. Each of the access rules 1022 may include one or more conditions corresponding to one or more parameters of the access request. The access server 1020 may determine an access request outcome indicating whether the access request should be accepted (e.g., access to the resource granted), rejected (e.g., access to the resource denied), or reviewed by comparing the access rules 1022 to the parameters of the access request as further described below. In some embodiments, instead of determining an access request outcome, the access server 1020 may determine an evaluation score based on outcomes of the access rules. The evaluation score may indicate the risk or likelihood of the access require being fraudulent. If the evaluation score indicates that the access request is likely to be fraudulent, then the access server 1020 may reject the access request.
[0155] The access server 1020 may send the indication of the access request outcome to the resource computer 1010 (e.g., accept, reject, review, accept and review, or reject and review). In some embodiments, the access server 1020 may send the evaluation score to the resourcePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 computer 1010 instead. The resource computer 1010 may then grant or deny access to the resource based on the indication of the access request outcome or based on the evaluation score. The resource computer 1010 may also initiate a review process for the access request.
[0156] In some embodiments, the access server 1020 may be remotely accessed by an administrator for configuration. The access server 1020 may store data in a secure environment and implement user privileges and user role management for accessing different types of stored data. For example, user privileges may be set to enable users to perform one or more of the following operations: view logs of received access request, view logs of access request outcomes, enable or disable the execution of the access rules 1022, update or modify the access rules 1022, change certain access request outcomes. Different privileges may be set for different users.
[0157] The resource computer 1010 may store access request information for each access requests that it receives. The access request information may include authentication information and / or the parameters of each of the access requests. The access request information may also include an indication of the access request outcome for the access request, e.g., whether access request was actually fraudulent or not. The resource computer 1010 may also store validity information corresponding to each access request. The validity information for an access request may be initially based on its access request outcome. The validity information may be updated based on whether the access request is reported to be fraudulent. In some embodiments, the access server 1020 or the request computer 1070 may store the access request information and the validity information.VIII. COMPUTER SYSTEM
[0158] Any of the computer systems mentioned herein may utilize any suitable number of subsystems. Examples of such subsystems are shown in FIG. 11 in computer system 10. In some embodiments, a computer system includes a single computer apparatus, where the subsystems can be the components of the computer apparatus. In other embodiments, a computer system can include multiple computer apparatuses, each being a subsystem, with internal components. A computer system can include desktop and laptop computers, tablets, mobile phones and other mobile devices.
[0159] The subsystems shown in FIG. 11 are interconnected via a system bus 75.Additional subsystems such as a printer 74, keyboard 78, storage device(s) 79, monitor 76PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 (e.g., a display screen, such as an LED), which is coupled to display adapter 82, and others are shown. Peripherals and input / output (I / O) devices, which couple to I / O controller 71, can be connected to the computer system by any number of means known in the art such as input / output (I / O) port 77 (e.g., USB, FireWire®). For example, I / O port 77 or external interface 81 (e.g. Ethernet, Wi-Fi, etc.) can be used to connect computer system 10 to a wide area network such as the Internet, a mouse input device, or a scanner. The interconnection via system bus 75 allows the central processor 73 to communicate with each subsystem and to control the execution of a plurality' of instructions from system memory 72 or the storage device(s) 79 (e.g., a fixed disk, such as a hard drive, or optical disk), as well as the exchange of information between subsystems. The system memory 72 and / or the storage device(s) 79 may embody a computer readable medium. Another subsystem is a data collection device 85, such as a camera, microphone, accelerometer, and the like. Any of the data mentioned herein can be output from one component to another component and can be output to the user.
[0160] A computer system can include a plurality of the same components or subsystems, e.g., connected together by external interface 81, by an internal interface, or via removable storage devices that can be connected and removed from one component to another component. In some embodiments, computer systems, subsystem, or apparatuses can communicate over a network. In such instances, one computer can be considered a client and another computer a server, where each can be part of a same computer system. A client and a server can each include multiple systems, subsystems, or components.
[0161] Aspects of embodiments can be implemented in the form of control logic using hardware circuitry (e g. an application specific integrated circuit or field programmable gate array) and / or using computer software with a generally programmable processor in a modular or integrated manner. As used herein, a processor can include a single-core processor, multicore processor on a same integrated chip, or multiple processing units on a single circuit board or networked, as well as dedicated hardware. Based on the disclosure and teachings provided herein, a person of ordinary' skill in the art will know and appreciate other ways and / or methods to implement embodiments of the present invention using hardware and a combination of hardware and software.
[0162] Any of the software components or functions described in this application may be implemented as software code to be executed by a processor using any suitable computer language such as, for example, Java, C, C++, C#, Objective-C, Swift, or scripting languagePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 such as Perl or Python using, for example, conventional or object-oriented techniques. The software code may be stored as a series of instructions or commands on a computer readable medium for storage and / or transmission. A suitable non-transitory computer readable medium can include random access memory (RAM), a read only memory' (ROM), a magnetic medium such as a hard-drive or a floppy disk, or an optical medium such as a compact disk (CD) or DVD (digital versatile disk) or Blu-ray disk, flash memory, and the like. The computer readable medium may be any combination of such storage or transmission devices.
[0163] Such programs may also be encoded and transmitted using carrier signals adapted for transmission via wired, optical, and / or wireless networks conforming to a variety of protocols, including the Internet. As such, a computer readable medium may be created using a data signal encoded with such programs. Computer readable media encoded with the program code may be packaged with a compatible device or provided separately from other devices (e.g., via Internet download). Any such computer readable medium may reside on or within a single computer product (e.g. a hard drive, a CD, or an entire computer system), and may be present on or within different computer products within a system or network. A computer system may include a monitor, printer, or other suitable display for providing any of the results mentioned herein to a user.
[0164] Any of the methods described herein may be totally or partially performed with a computer system including one or more processors, which can be configured to perform the steps. Thus, embodiments can be directed to computer systems configured to perform the steps of any of the methods described herein, potentially with different components performing a respective step or a respective group of steps. Although presented as numbered steps, steps of methods herein can be performed at a same time or at different times or in a different order. Additionally, portions of these steps may be used with portions of other steps from other methods. Also, all or portions of a step may be optional. Additionally, any of the steps of any of the methods can be performed with modules, units, circuits, or other means of a system for performing these steps.
[0165] The specific details of particular embodiments may be combined in any suitable manner without departing from the spirit and scope of embodiments of the invention.However, other embodiments of the invention may be directed to specific embodiments relating to each individual aspect, or specific combinations of these individual aspects.PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01
[0166] The above description of example embodiments of the present disclosure has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the disclosure to the precise form described, and many modifications and variations are possible in light of the teaching above.
[0167] A recitation of "a", "an" or "the" is intended to mean "one or more" unless specifically indicated to the contrary. The use of “or” is intended to mean an “inclusive or,” and not an “exclusive or” unless specifically indicated to the contrary. Reference to a “first” component does not necessarily require that a second component be provided. Moreover, reference to a “first” or a “second” component does not limit the referenced component to a particular location unless expressly stated. The term “based on” is intended to mean “based at least in part on.”
[0168] All patents, patent applications, publications, and descriptions mentioned herein are incorporated by reference in their entirety for all purposes. None is admitted to be prior art.
Claims
PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 WHAT IS CLAIMED IS:
1. A method for training a machine learning model based on contrastive loss, wherein the machine learning model comprises an encoder and a prediction model, wherein the method is performed by a computer system and comprises performing an iterative training process until a terminating condition has been met, the method comprising:sampling a plurality of pairs of training data elements;generating, for each training data element, a corresponding training embedding using the encoder, thereby generating a plurality of pairs of training embeddings;for each pair of training data elements, determining, based on one or more values of each pair of training data elements or each pair of training embeddings, whether the pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements;determining, for each pair of training embeddings, an embedding distance value, thereby determining a plurality of embedding distance values;determining, for each pair of training embeddings, a contrastive loss value based on a corresponding embedding distance value and based on whether that pair of training embeddings corresponds to the positive pair of training data elements or the negative pair of training data elements, thereby determining a plurality of contrastive loss values;updating an encoder parameter set based on the plurality of contrastive loss values, thereby training the machine learning model; andrepeating the iterative training process until the terminating condition has been met.
2. The method of claim 1, further comprising:determining, using the prediction model, a plurality of prediction model outputs using the plurality of pairs of training embeddings; anddetermining one or more prediction output loss values based on the plurality of prediction model outputs, wherein the encoder parameter set is updated based on the one or more prediction output loss values in addition to the plurality of contrastive loss values.
3. The method of claim 2, wherein updating the encoder parameter set based on the plurality of contrastive loss values comprises:PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 generating a combined loss value comprising a combination of the one or more prediction output loss values and the plurality of contrastive loss values; and updating the encoder parameter set based on the combined loss value.
4. The method of claim 1, wherein the plurality of pairs of training data elements comprise access requests.
5. The method of claim 1, further comprising determining one or more prediction output loss values and updating a prediction model parameter set based on the one or more prediction output loss values, and wherein:the prediction model comprises a neural network;the prediction model parameter set comprises a plurality of weights associated with the neural network;the one or more prediction output loss values are determined using crossentropy or a mean squared error calculated between a plurality of prediction model outputs and a plurality of corresponding training labels; andthe prediction model parameter set is updated based on the one or more prediction output loss values using backpropagation and / or stochastic gradient descent.
6. The method of claim 1, wherein updating the encoder parameter set comprises:generating a combined contrastive loss value based on an average of the plurality of contrastive loss values; andupdating the encoder parameter set based on the combined contrastive loss value.
7. The method of claim 1, wherein updating the encoder parameter set based on the plurality of contrastive loss values causes the encoder to:generating subsequent training embeddings corresponding to positive pairs of training data elements that have a reduced embedding distance value; andgenerate subsequent training embedding corresponding to negative pairs of training data elements that have an increased embedding distance value.
8. The method of claim 1, wherein:PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 the one or more values of each pair of training data elements comprises a first nominal value corresponding to a first training data element in the pair of training data elements and a second nominal value corresponding to a second training data element in the pair of training data elements; anddetermining whether the pair of training data elements comprises a positive pair of training data elements or a negative pair of training data elements comprises:determining that the pair of training data elements comprises the positive pair of training data elements when the first nominal value matches the second nominal value, anddetermining that the pair of training data elements comprises the negative pair of training data elements when the first nominal value does not match the second nominal value.
9. The method of claim 1, wherein:the one or more values of each pair of training data elements comprises a plurality of first nominal values corresponding to a first training data element in the pair of training data elements and a plurality of second nominal values corresponding to a second training data element in the pair of training data elements, wherein the plurality of first nominal values and the plurality of second nominal values comprise a plurality of pairs of nominal values; anddetermining whether the pair of training data elements comprises the positive pair of training data elements or the negative pair of training data elements comprises:determining, for each pair of nominal values, whether that pair of nominal values comprises a positive pair of nominal values or a negative pair of nominal values,determining that the pair of training data elements comprise the positive pair of training data elements when a majority of the plurality of pairs of nominal values comprise positive pairs of nominal values, and determining that the pair of training data elements comprise the negative pair of training data elements when a majority of the plurality of pairs of nominal values comprises negative pairs of nominal values.
10. The method of claim 1, wherein:PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 the one or more values of each pair of training data elements comprises a first ordered nominal value corresponding to a first training data element in the pair of training data elements and a second ordered nominal value corresponding to a second training data element in the pair of training data elements;determining whether the pair of training data elements comprises the positive pair of training data elements or the negative pair of training data elements comprises:determining that the pair of training data elements comprises the positive pair of training data elements when the first ordered nominal value matches the second ordered nominal value,determining that the pair of training data elements comprises the negative pair of training data elements when the first ordered nominal value does not match the second ordered nominal value; andeach contrastive loss value is based on a first order of a corresponding first ordered nominal value and a second order of a corresponding second ordered nominal value.
11. The method of claim 1, wherein:the one or more values of each pair of training data elements comprises a first numerical value corresponding to a first training data element in the pair of training data elements and a second numerical value corresponding to a second training data element in the pair of training data elements;the method further comprises determining, based on the plurality' of pairs of training data elements, a median value corresponding to the first numerical value and the second numerical value; anddetermining whether the pair of training data elements comprises the positive pair of training data elements or a negative pair of training data elements comprises:determining that the pair of training data elements comprises the positive pair of training data elements when the first numerical value and the second numerical value are both greater than the median value or when the first numerical value and the second numerical value are both less than the median value, anddetermining that the pair of training data elements comprises the negative pair of training data elements when the first numerical value is greater than the median value and the second numerical value is less than thePATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 median value, or when the first numerical value is less than the median value and the second numerical value is greater than the median value.
12. The method of claim 1, wherein:the one or more values of each pair of training data elements comprise one or more first numerical values corresponding to a first training data element in the pair of training data elements and one or more second numerical values corresponding to a second training data element in the pair of training data elements;the method further comprises determining, based on the plurality of pairs of training data elements, a median distance value corresponding to the one or more first numerical values and the one or more second numerical values; anddetermining whether the pair of training data elements comprises the positive pair of training data elements or the negative pair of training data elements comprises:determining that the pair of training data elements comprises the positive pair of training data elements when a distance between a first vector corresponding to the one or more first numerical values and a second vector corresponding to the one or more second numerical values is less than the median distance value, anddetermining that the pair of training data elements comprises the negative pair of training data elements when the distance between the first vector and the second vector is greater than the median distance value.
13. The method of claim 12, wherein the median distance value comprises a median Euclidean distance or a median cosine similarity metric, and wherein the distance comprises a Euclidean distance or a cosine similarity metric.
14. The method of claim 1, wherein:the one or more values of each pair of training data elements or each pair of training embeddings comprise one or more first embedding values corresponding to a first training embedding in a corresponding pair of training embeddings, and one or more second embedding values corresponding to a second training embedding in the corresponding pair of training embeddings;PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 the method further comprises determining, based on the plurality of pairs of training embeddings, a median embedding distance value corresponding to the one or more first embedding values and the one or more second embedding values; anddetermining whether the pair of training data elements comprises the positive pair of training data elements or the negative pair of training data elements comprises:determining that the pair of training data elements comprises the positive pair of training data elements when a distance between a first vector corresponding to the one or more first embedding values and a second vector corresponding to the one or more second embedding values is less than the median embedding distance value, anddetermining that the pair of training data elements comprises the negative pair of training data elements when the distance between the first vector and the second vector is greater than the median embedding distance value.
15. The method of claim 1, wherein:each pair of training data elements comprises a first training data element and a second training data element;each pair of training embeddings comprises a first training embedding corresponding to the first training data element and a second training embedding corresponding to the second training data element;each first training data element comprises a plurality of first training values and each second training data element comprises a plurality of second training values;each first training embedding comprises a plurality of first embedding values and each second training embedding comprises a plurality of second embedding values; and the method further comprises randomly selecting the one or more values of each pair of training data elements or each pair of training embeddings from either the plurality of first training values and the plurality of second training values, or the plurality of first embedding values and the plurality of second embedding values.
16. The method of claim 1, wherein:each training data element of the plurality of pairs of training data elements comprises a plurality of training data values;PATENT Attorney Docket No.: 079900-1528466 Client Reference No.: 9597WO01 each training embedding of the plurality of pairs of training embeddings corresponds to a training data element of the plurality of pairs of training data elements;each training embedding comprises a plurality of embedding values; and generating, for each training data element, a corresponding training embedding using the encoder comprises:encoding, using the encoder, each training data value of the plurality of training data values, thereby generating a corresponding embedding value, thereby generating a corresponding training embedding comprising a plurality7of corresponding embedding values.
17. The method of claim 1, wherein the embedding distance value is based on a cosine similarity7metric or a Euclidean distance.
18. The method of claim 1, further comprising:receiving a test data element;generating a test embedding using the encoder and based on the test data element; andgenerating a test prediction model output using the prediction model and based on the test embedding, wherein the test prediction model output comprises a prediction corresponding to the test data element.
19. The method of claim 18, wherein the computer system receives the test data element from a client computer, and wherein the method further comprises:transmitting, to the client computer, the test prediction model output.
20. A computer system comprising:one or more processors; anda non-transitory computer readable medium coupled to the one or more processors, the non-transitory computer readable medium comprising instructions that, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-19.