An autoencoder is a type of artificial neural network used for unsupervised learning of efficient codings or representations of data, typically for the purpose of dimensionality reduction or feature extraction.
An autoencoder consists of two main parts:
- Encoder: This part of the network compresses the input into a latent-space representation. It encodes the input image as an internal fixed-size representation in reduced dimensionality.
- Decoder: The decoder works to reconstruct the input data from this internal representation. It maps the encoded data back to the original data space.
How Autoencoders Work
We can distinguish between two phases: training and usage phase.
- The autoencoder is trained to copy its input to its output. This might sound trivial, but since the internal layers of the network are of smaller dimensions than the input data, the network is forced to learn a compressed representation of the data.
- To be more specific, during training, the input data is passed through the encoder, which encodes it into a lower-dimensional latent space.
- The decoder then tries to reconstruct the original data from this encoding.
- The purpose of an autoencoder is to learn a representation (encoding) for a set of data, typically for the purpose of dimensionality reduction or denoising.
- The difference between the original input and the reconstructed output (called the reconstruction error) is measured using a loss function, typically Mean Squared Error (MSE).
- The network adjusts its weights using an optimization algorithm to minimize this reconstruction error.
- Once the autoencoder is trained, you might use just the encoder part to transform input data into a reduced-dimensionality space, which is its latent representation. This is useful for dimensionality reduction tasks.
- For denoising tasks, the entire autoencoder might be used. The input data, with some induced noise, is fed into the network, and the output should ideally be the denoised version of that data.
Download this guide to delve into the most common LLM security risks and ways to mitigate them.
Lakera Guard protects your LLM applications from cybersecurity risks with a single line of code. Get started in minutes. Become stronger every day.
Several people are typing about AI/ML security. Come join us and 1000+ others in a chat that’s thoroughly SFW.