Cloud-Native API Recommendation Using Contrastive Learning

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The challenge of selecting appropriate application programming interfaces (APIs) for service-based applications in a cloud-native environment is exacerbated by the large number of available APIs and their similar functionalities, making it difficult for developers to choose the right ones for mashup services, which traditional methods struggle to address effectively.

Innovation Solution

A cloud-native API recommendation method is developed, utilizing a double-graph structure and graph neural networks to learn service feature representations, incorporating a mutual attention mechanism and contrastive learning to optimize the recommendation model through data augmentation and pair-wise scoring.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional service recommendation methods are used, then the system can handle basic API recommendation tasks, but the recommendation effectiveness deteriorates due to data sparsity and inability to capture complex service function characteristics

Engineering Contradiction:
Improverecommendation effectivenessVSAvoiddata sparsity
Core Design Contradiction:
Measurement precisionVSLoss of information

Solution Approach 1:

The patent applies data augmentation techniques to pre-process the training data by generating synthetic service invocation sequences through contrastive learning. This preliminary action enriches the training dataset before the recommendation model is trained, thereby mitigating data sparsity issues and improving recommendation effectiveness without requiring additional real-world data collection.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces a contrastive learning module as an intermediary between the raw data and the recommendation model. This module learns robust service function representations by comparing augmented data samples, effectively bridging the gap between sparse real data and the requirements of the recommendation system, thereby improving measurement precision while handling data sparsity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If simple graph structures are used to represent service relationships, then the model complexity remains low, but the ability to learn complex service function characteristics deteriorates

Engineering Contradiction:
Improveservice function characteristic learningVSAvoidmodel complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent implements a nested architecture where a contrastive learning module is embedded within the recommendation system. The outer layer is the recommendation model that predicts API suggestions, while the inner nested layer is the contrastive learning module that learns service function representations. This nested structure allows the system to capture complex service characteristics through the inner module while the outer module handles recommendation tasks, balancing learning capability with manageable complexity.

Inventive Principle:
Principle #7Nested doll (Nesting)

Solution Approach 2:

The patent segments the recommendation system into distinct functional modules: a contrastive learning module for representation learning and a recommendation module for prediction. This segmentation allows each module to specialize in specific tasks - the contrastive module handles complex feature extraction while the recommendation module focuses on ranking and selection - thereby improving service function characteristic learning without overwhelming the system with monolithic complexity.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If more candidate APIs are provided to satisfy diverse business requirements, then the service coverage increases, but the difficulty of choosing the appropriate API increases due to functional similarity

Engineering Contradiction:
Improveservice coverageVSAvoidAPI selection difficulty
Core Design Contradiction:
Adaptability or versatilityVSEase of operation

Solution Approach 1:

The patent replaces manual API selection processes with an automated neural network-based recommendation system. Instead of relying on developers to manually evaluate and select APIs from large candidate sets (mechanical/manual process), the system uses learned service function representations and contrastive learning to automatically rank and recommend appropriate APIs, thereby maintaining high service coverage while significantly easing the selection process for developers.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS12632323B2Cloud-native application programming interface (API) recommendation method fusing data augmentation and contrastive learning
Publication Date: 2026.05.19 CHINA JILIANG UNIV
  • US12632323B2 patent drawing
  • US12632323B2 patent drawing
  • US12632323B2 patent drawing

AI summary

Disclosed is a cloud-native application programming interface (API) recommendation method fusing data augmentation and contrastive learning. Service information is included on the basis of a service information double-graph structure, and a mutual attention mechanism is designed to compute an importance degree of each layer of information. A data optimization method for sequence information based on functional similarity and a computation method for similarity between services based on two parts of information are provided; on this basis, data of a service invocation sequence is augmented with the idea of contrastive learning to form an augmented sequence pair; a computational contrastive loss function is combined with a pair-wise recommendation loss function to optimize an overall model, thereby improving the effect of a service recommendation model; and according to a feature embedding representation result of a service, pair-wise recommendation scores are computed to complete service recommendation.