AI Intermediate · 17% of the exam

Hugging Face & Open Source Models: free practice questions

5 sample questions from our 205-question bank for this domain — answers and explanations included. These are the same scenario-based style as the real DataCertPrep exam.

1. A developer is exploring the Hugging Face Hub and wants to find a suitable embedding model for a multilingual semantic search application. They filter by task type and notice that some models are listed under 'feature-extraction' while others are listed under 'sentence-similarity'. They select `intfloat/multilingual-e5-large` and call `model.encode()` on a batch of queries and documents. Which statement BEST describes the correct usage pattern for this model when computing similarity scores?

  • A. Pass raw query and document strings directly to `model.encode()` and compute cosine similarity between the resulting embeddings — no special prefixes are needed.
  • B. Prepend `'query: '` to each query string and `'passage: '` to each document string before encoding, then compute cosine similarity between the resulting embeddings.✓ Correct
  • C. Use the model's `predict()` method with query-document pairs as input, because E5 models are cross-encoders that score pairs jointly rather than encoding them independently.
  • D. Encode queries and documents separately, then use dot product (not cosine similarity) as the similarity metric, because E5 embeddings are not L2-normalized.
Explanation

**Correct: B.** The `multilingual-e5-large` model (and E5 models in general) are trained with task-specific instruction prefixes. Queries must be prefixed with `'query: '` and documents/passages with `'passage: '` before encoding. Omitting these prefixes degrades retrieval quality significantly because the model was fine-tuned to expect them. Cosine similarity is then computed between the resulting embeddings. **A is wrong** because E5 models require the `query:` and `passage:` prefixes — using raw strings without prefixes is a common mistake that leads to suboptimal results. **C is wrong** because `multilingual-e5-large` is a bi-encoder (it encodes queries and documents independently), not a cross-encoder; it has no `predict()` method for pairs. **D is wrong** because E5 embeddings *are* L2-normalized by default, making cosine similarity equivalent to dot product — but more importantly, the claim that cosine similarity should not be used is incorrect.

2. A developer is comparing AWQ and GPTQ quantization for serving a 13B model on a GPU. Which of the following statements ACCURATELY describe the trade-offs between AWQ and GPTQ? (Select TWO)

  • A. AWQ selectively preserves 'salient' weights (top ~1% by magnitude) at higher precision, reducing accuracy loss compared to naive uniform quantization✓ Correct
  • B. GPTQ uses a layer-wise second-order optimization approach (based on the Optimal Brain Quantization framework) to determine quantization errors✓ Correct
  • C. AWQ requires significantly more GPU VRAM than GPTQ at the same bit-width because AWQ stores additional lookup tables
  • D. GPTQ models cannot be used with the Hugging Face transformers library and require a separate inference server
  • E. Both AWQ and GPTQ are lossless quantization methods that perfectly preserve model accuracy
  • F. AWQ quantization is performed without needing a calibration dataset, making it faster to quantize a new model
Explanation

AWQ (Activation-aware Weight Quantization) identifies the ~1% of weights that most significantly affect activation magnitude and keeps them at higher precision or scales them to minimize quantization error — this is its key innovation. GPTQ is based on the OBQ (Optimal Brain Quantization) framework, using approximate second-order (Hessian) information to minimize layer-wise quantization error. Both are accurate descriptions of their respective methods. Option C is incorrect — AWQ is generally comparable or slightly more memory-efficient than GPTQ at the same bit-width; it does not require large lookup tables. Option D is incorrect — GPTQ models are well-supported via the `auto-gptq` integration in transformers. Option E is incorrect — both are lossy quantization methods that incur some accuracy degradation. Option F is incorrect — AWQ does use a small calibration dataset to identify salient weights.

3. A developer visits the Hugging Face Hub and finds a model card for a newly released 7B language model. The card prominently displays a badge labeled **'RAIL'** under the license section. What is the PRIMARY implication of this license for a developer who wants to integrate the model into a commercial application?

  • A. The model is completely free for any use, including commercial deployment, with no restrictions whatsoever.
  • B. The model may be used commercially, but certain downstream use cases (such as generating harmful content or surveillance applications) are explicitly prohibited by the license.✓ Correct
  • C. The model cannot be used commercially under any circumstances and is restricted to academic research only.
  • D. The model requires the developer to open-source their entire application code if it incorporates the model.
Explanation

RAIL (Responsible AI License) is designed to allow broad use, including commercial use, while explicitly restricting specific harmful or unethical applications (e.g., generating disinformation, enabling mass surveillance). It is not a blanket ban on commercial use (eliminating option A's 'no restrictions' framing), nor does it categorically forbid commercial use like option C states. Option D describes a copyleft requirement (similar to GPL), which is not part of the RAIL framework.

4. A team is building a private internal tool and hosts their proprietary fine-tuned models in a **Hugging Face Organization** rather than under individual user accounts. Which of the following are valid benefits of using a Hugging Face Organization for this purpose? (Select TWO)

  • A. Organization repositories can be set to private, restricting access to approved members only.✓ Correct
  • B. Models stored in an organization automatically receive a commercial-use license upgrade from Hugging Face.
  • C. Multiple team members can be granted access and collaborate on the same model repositories under a shared namespace.✓ Correct
  • D. Organization accounts eliminate all API rate limits for the Inference API by default.
  • E. Hugging Face guarantees SLA-backed uptime for models hosted in organization accounts.
Explanation

(A) Correct — Organizations support private repositories, so only members with the appropriate role can access the models. (C) Correct — Organizations provide a shared namespace where multiple collaborators can push, pull, and manage model files, making team collaboration straightforward. (B) Incorrect — Hugging Face does not change or upgrade the license of a model based on where it is hosted; licenses are determined by the model creator. (D) Incorrect — Rate limits on the Inference API are tied to account tier/subscription, not simply whether a model is in an organization. (E) Incorrect — Hugging Face does not offer SLA-backed uptime guarantees for standard Hub hosting; that is a feature of their enterprise/dedicated offerings.

5. An NLP team is building a pipeline to classify customer support tickets into categories. They want to use a Hugging Face model but need the solution to handle ticket categories that were NOT seen during the model's original training — without any additional fine-tuning. Which approach and model type best fits this requirement?

  • A. Use `pipeline('zero-shot-classification')` with a model such as `facebook/bart-large-mnli`, providing the target category labels at inference time.✓ Correct
  • B. Use `pipeline('text-classification')` with a model fine-tuned on a standard sentiment dataset such as `distilbert-base-uncased-finetuned-sst-2-english`.
  • C. Use `AutoModelForSequenceClassification.from_pretrained()` with a BERT model fine-tuned on the original support ticket categories, then map the output logits to new labels.
  • D. Use `pipeline('feature-extraction')` to generate embeddings for each ticket, then apply a k-nearest-neighbors classifier trained on the original categories.
Explanation

Option A is correct. Zero-shot classification models (like `facebook/bart-large-mnli`) use natural language inference to score candidate labels provided at inference time, so they can classify into arbitrary categories never seen during training — no fine-tuning required. Option B is wrong because a sentiment classification model (SST-2) outputs only positive/negative labels; it cannot generalize to unseen support ticket categories and would require retraining or fine-tuning. Option C is wrong because a model fine-tuned on the original support ticket categories has a fixed output head — remapping logits to new labels does not give meaningful predictions for categories outside the training distribution without additional fine-tuning. Option D (feature extraction + k-NN) could support new categories at query time, but the k-NN classifier still requires labeled examples from the original categories to compute neighbors — it does not handle truly unseen categories without any training data, making it inferior to zero-shot classification in this scenario.

200 more questions in this domain

Practice the full bank with instant grading, flashcards, and a timed mock exam.

Start practicing free