LLY-DML is part of the LILY Project and focuses on optimization parameter-based quantum circuits. It enhances the efficiency of quantum algorithms by fine-tuning parameters of quantum gates. DML stands for Differentiable Machine Learning, emphasizing the use of gradient-based optimization techniques to improve the performance of quantum circuits.
LLY-DML is available on the LILY QML platform, making it accessible for researchers and developers.
For inquiries or further information, please contact: info@lilyqml.de.
Role | Name | Links |
---|---|---|
Project Lead | Leon Kaiser | ORCID, GitHub |
Inquiries and Management | Raul Nieli | |
Supporting Contributors | Eileen Kühn | GitHub, KIT Profile |
Supporting Contributors | Max Kühn | GitHub |
The L-Gate is a pivotal component in quantum machine learning circuits, designed to meet specific requirements for effective parameter optimization. It integrates input parameters with optimization parameters, allowing for a seamless flow of data and control. Here are the key properties and design aspects of the L-Gate:
Parameter Optimization:
The L-Gate must enable the optimization of parameters, allowing for fine-tuning that enhances the performance of quantum algorithms. This optimization is achieved by merging input parameters with optimization parameters to create a dynamic and responsive system.
Full Bloch Sphere Utilization:
The design of the L-Gate ensures that the entire Bloch sphere is accessible. This feature allows for a complete range of quantum state manipulations, providing flexibility and precision in quantum operations.
Integration of Input and Optimization Parameters:
The L-Gate represents a machine learning gate that combines input parameters with optimization parameters. This integration is crucial for adapting to various quantum learning tasks and achieving desired outcomes.
The structure of the L-Gate is represented as follows:
TP0 | IP0 | H | TP1 | IP1 | H | TP2 | IP2 |
---|
The sequence of tunable parameters (TP) and input parameters (IP), interspersed with Hadamard gates (H), facilitates the desired operations, ensuring that the L-Gate functions effectively as a machine learning gate.
Tunable Parameters (TP): These are adjustable parameters that allow the quantum circuit to adapt to specific needs and optimize performance dynamically.
Input Parameters (IP): Parameters that represent the input data, feeding the quantum circuit with the necessary information for processing.
Hadamard Gate (H): The Hadamard gate plays a crucial role in creating superpositions, enabling quantum parallelism and interaction between different states.
In this system, a multi-qubit system is always used when training these gates. In this case, each qubit has multiple L-Gates. The gates are trained so that, for a given input, combined with the tuning phases, they produce a well-defined state. Thus, the system learns to associate a specific input with a fixed state of the system.
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
q_0: | TP₀,₀ | --- | IP₀,₀ | --- | H₀ | --- | TP₀,₁ | --- | IP₀,₁ |
└───────┘ └───────┘ └───────┘ └───────┘ └───────┘
┌───────┐ ┌───────┐ ┌───────┐
| H₀ | --- | TP₀,₂ | --- | IP₀,₂ |
└───────┘ └───────┘ └───────┘
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
q_1: | TP₁,₀ | --- | IP₁,₀ | --- | H₁ | --- | TP₁,₁ | --- | IP₁,₁ |
└───────┘ └───────┘ └───────┘ └───────┘ └───────┘
┌───────┐ ┌───────┐ ┌───────┐
| H₁ | --- | TP₁,₂ | --- | IP₁,₂ |
└───────┘ └───────┘ └───────┘
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
q_2: | TP₂,₀ | --- | IP₂,₀ | --- | H₂ | --- | TP₂,₁ | --- | IP₂,₁ |
└───────┘ └───────┘ └───────┘ └───────┘ └───────┘
┌───────┐ ┌───────┐ ┌───────┐
| H₂ | --- | TP₂,₂ | --- | IP₂,₂ |
└───────┘ └───────┘ └───────┘
q_0
, q_1
, q_2
): Each line represents a qubit in the multi-qubit system.TP₀,₀
, TP₁,₀
, etc.): These are the tunable parameter gates, where the first subscript denotes the qubit, and the second subscript denotes the phase index.IP₀,₀
, IP₁,₀
, etc.): Input parameter gates, where the data matrices are inputted. The subscripts indicate the qubit and phase.H₀, H₁, H₂
): Used for creating superpositions and facilitating quantum parallelism.TP0,0 | TP0,1 | TP0,2 |
TP1,0 | TP1,1 | TP1,2 |
TP2,0 | TP2,1 | TP2,2 |
IP0,0 | IP0,1 | IP0,2 |
IP1,0 | IP1,1 | IP1,2 |
IP2,0 | IP2,1 | IP2,2 |
During the training of these gates, data in the form of matrices is applied to the IP gates. The TP gates are then optimized to achieve the desired state transformation. The input matrix feeds specific values into the IP gates, which correspond to the data that the system processes. The training matrix allows the TP gates to adjust their parameters to align with the desired outcomes, effectively learning how to map inputs to specific quantum states.
Optimizer
loss_function(self, counts)
:
Calculates the loss based on the probability of reaching the target state.
optimize(self)
:
Optimizes the training phases to minimize the loss by iterating over several attempts.
update_phases(self, current_phases)
:
Updates the phases by adding random changes to the current training phases.
get_distribution(self, counts)
:
Retrieves a sorted probability distribution from the counts obtained from the circuit.
plot_distribution(self, counts, title)
:
Plots a histogram of the state distribution using matplotlib.
OptimizerWithMomentum
Optimizer
class by incorporating momentum to improve convergence speed and stability during phase updates.update_phases(self, current_phases)
:AdamOptimizer
beta1
and beta2
: Control the decay rates of the moving averages.epsilon
: A small constant to prevent division by zero.update_phases(self, current_phases)
:GeneticOptimizer
population_size
: Number of individuals in the population.mutation_rate
: Probability of mutation in each individual._initialize_population(self)
:
Initializes the population with random variations of the training phases.
optimize(self)
:
Performs optimization using the genetic algorithm, involving selection, crossover, and mutation.
_crossover_and_mutate(self, parents)
:
Creates the next generation through crossover and mutation.
_crossover(self, parent1, parent2)
:
Performs single-point crossover between two parent solutions.
_mutate(self, individual)
:
Applies random mutations to an individual.
PSOOptimizer
num_particles
: Number of particles in the swarm.inertia
, cognitive
, social
: Weights for the respective components._initialize_particles(self)
:
Initializes particles with random variations around the training phases.
optimize(self)
:
Performs the optimization by updating particle velocities and positions iteratively.
BayesianOptimizer
gp_minimize()
: Executes Bayesian optimization over the defined bounds.optimize(self)
:SimulatedAnnealingOptimizer
optimize(self)
:QuantumNaturalGradientOptimizer
update_phases(self, current_phases)
:We welcome and encourage public collaboration on this GitHub project. If you're interested in contributing, there are several ways you can get involved:
If you have questions or suggestions, feel free to reach out to our team at any time. We're eager to hear your thoughts and are open to discussions about potential improvements or new ideas for the project.
Dive into the repository to understand the current state of the project. You'll find detailed documentation and examples that will help you get up to speed quickly. We recommend checking out the following resources:
Identify tasks or features that interest you and feel free to take them on. You can find a list of tasks or features in our issue tracker, where we regularly update the project's current needs and priorities. Here’s how you can proceed:
Engage with other contributors in the project's discussions. This is a great way to exchange ideas, ask questions, and collaborate on solutions. You can:
We have a set of guidelines to help you contribute effectively:
By contributing, you become a part of our community, helping us improve and expand the project. We value every contribution and look forward to collaborating with you!
If you're ready to start, head over to our contributing guide for detailed instructions. Together, we can make this project even better!