Extended Quantum Computing Patterns
Pre-Trained Feature Extractor
Aliases: –
Tags:
© F. Truger et al.: Warm-Starting Patterns for Quantum Algorithms. The Sixteenth International Conference on Pervasive Patterns and Applications (PATTERNS), 2024 [in press]
Intent
How to process large data items through quantum neural networks (QNNs) when the number of available qubits is lower than the size of a data item?
Context
A QNN shall be trained for a specific task, that requires the processing of large data items, e.g., images or multi-dimensional data. However, the number of qubits required to load such data items into the QNN is larger than the number of qubits of the available quantum devices.
Forces
The width of circuits implementing QNNs is limited by the number of available qubits. In addition, quantum devices are scarce resources that should be utilized as efficiently as possible. However, naively reducing the original data items may result in the loss of information relevant for the computation. Large pre-trained classical models for various general tasks, such as object recognition for images, are widely available or can be created at low cost.
Solution
Use a pre-trained classical model to reduce the dimensions of the data items and train the QNN based on the reduced data. As shown in the solution sketch below, a pre-trained classical model for a wide range purpose, such as a neural network trained for object recognition, can be utilized for a hybrid QNN to be trained for a related special purpose task. Intermediate values of inputs processed through such models, e.g., those present at a condensed next-to-last neural network layer, can be seen as a compressed representation of the original data exhibiting its most significant features. Thus, the pre-trained model serves as a feature extractor. These features can be encoded into a quantum state to train the QNN for the target task.
Result
Due to the compressed representation obtained from the pre-trained feature extractor, fewer qubits are required to process data in the QNN. Furthermore, the compressed nature of the data may reduce the QNN's training time, as irrelevant information has already been omitted from the training data.
Examples
–
Related Patterns
This pattern refines the Warm-Start pattern and is related to the State Preparation patterns, e.g., Angle Encoding, [Weigold et al. 2021a] [Weigold et al. 2021b]. Different encodings may be applied to encode the extracted features into a quantum state. It is typically applied in conjunction with QNNs, a form of VQA [Cerezo et al. 2021]. Furthermore, the Circuit Cutting pattern solves a similar problem by partitioning the computation of a large quantum circuit into computations of multiple smaller circuits [Bechtold et al. 2023].
Known Uses
Pre-Trained Feature Extractor is frequently used when image processing, particularly image classification, shall be enhanced with QNNs [Mari et al. 2020] [Mittal and Dana 2020] [Gokhale et al. 2020] [Azevedo et al. 2022] [Umer et al. 2022] [Kanimozhi et al. 2022] [Furutanpey et al. 2023]. It was also applied for text classification [Yang et al. 2022]. Moreover, autoencoders [Kramer 1991] can be considered a special case of Pre-Trained Feature Extractor, that are designed and trained specifically for the purpose of data compression.