To simulate one-shot scenarios while keeping embeddings consistent, augment data using semantically similar paraphrasing or contrastive pairs that preserve embedding space proximity.
Here is the code snippet you can refer to:

In the above code we are using the following key points:
-
Uses SynonymAug to retain semantic consistency.
-
Applies SentenceTransformer to check embedding similarity.
-
Maintains embedding proximity via cosine similarity check.
-
Simulates multiple views of one-shot input for robustness.
Hence, this approach enables realistic one-shot data augmentation by generating semantically close variants while ensuring the embeddings stay consistent, ideal for training with limited samples.