Query Set

The query set in few-shot learning contains the test examples used to evaluate model performance after the model has been given the labeled support set. It serves as the episode's internal test set — measuring how well the model learned from the few provided examples.

Role in a Few-Shot Episode

  • Support Set: The K labeled examples per class that the model uses to "learn" the task. Analogous to training data.
  • Query Set: Additional examples from the same N classes that the model must classify. Analogous to test data.
  • Evaluation: Predictions on query examples are compared against true labels to compute episode accuracy.

Example: 5-Way 5-Shot Episode

ComponentContentPurpose
Support Set5 classes × 5 examples = 25 labeled images"Learn" these classes
Query Set5 classes × 15 examples = 75 unlabeled imagesClassify using support knowledge
OutputAccuracy on query predictionsEvaluate few-shot performance

Query Set in Meta-Training vs. Meta-Testing

  • During Meta-Training: Query set loss drives model parameter updates. The model learns to perform well on queries after seeing only the support set. Gradients flow through both support processing and query classification.
  • During Meta-Testing: Query set provides the final evaluation metric. No parameter updates — this is the true test of few-shot generalization.

Key Properties

  • Disjoint from Support: Query and support sets must be completely non-overlapping — the same example cannot appear in both. This ensures unbiased evaluation of generalization.
  • Same Classes: Query examples come from the same N classes as the support set — the model must classify queries into one of the N support classes.
  • Typical Size: Usually 10–20 query examples per class, though this varies by benchmark. More queries provide more stable accuracy estimates.

Query Set in Different Methods

  • Prototypical Networks: Compute class prototypes from support set, then classify each query by nearest prototype using Euclidean distance.
  • MAML: Adapt model parameters using support set gradients, then evaluate adapted model on queries.
  • Matching Networks: Each query attends to all support examples via learned similarity, producing a weighted classification.

Inductive vs. Transductive Processing

  • Inductive: Each query example is classified independently — no information flows between query examples.
  • Transductive: All query examples are processed jointly — the model can use the distribution and structure of the query set to improve predictions. Typically improves accuracy by 2–5%.

Impact on Evaluation

  • Episode Accuracy: Fraction of correctly classified query examples within a single episode.
  • Reported Accuracy: Average accuracy across hundreds or thousands of test episodes, typically reported with 95% confidence intervals.
  • Query Count Sensitivity: More query examples per class provide more stable accuracy estimates but increase computational cost per episode.

The query set is the measurement instrument of few-shot learning — it reveals how effectively the model has learned to generalize from the few support examples to new instances of the same classes.

Take query set further

Ask the copilot about this term, or have our engineers assess it against your process.