A product team relies on a large language model to draft new source-code snippets from natural-language requests. Which model category does this system illustrate?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Check this out—if the model is creating new code that wasn't sitting in a label column, you're in generative territory. LLMs that complete functions or write scripts sample tokens to build something new. That's generation, full stop. Exam trap: "discriminative" sounds fancy and technical, so people click it. Discriminative models decide which class something is. Regression spits out numbers. Clustering piles similar items together. None of those draft a REST handler from a sentence. Boss walks in: "Can it write Terraform from a prompt?"—generative LLM. Land the takeaway: create new content → generative; assign labels → discriminative. Keep that contrast cold for the test.
Full explanation below image
Full Explanation
Machine learning models are often grouped by the kind of problem they solve. Generative models learn enough about a data distribution to produce new samples that resemble training data or follow conditional instructions. Large language models used for code synthesis generate token sequences—identifiers, keywords, structure—conditioned on a natural-language or partial-code prompt. That act of synthesizing novel text or code is the hallmark of generative AI in this scenario.
Discriminative models, by contrast, learn decision boundaries or conditional label distributions such as p(y|x). A spam filter, sentiment classifier, or defect detector is discriminative: it maps inputs to categories or scores without needing to invent full programs. Regression estimates continuous quantities (price, temperature, risk score). Clustering partitions unlabeled points into groups by similarity metrics or density, which is unsupervised structure discovery rather than content creation.
Why candidates miss this item: modern LLMs can also be fine-tuned for classification, so the architecture family feels universal. The question, however, hinges on usage—drafting new snippets—which is generative behavior. Likewise, code models may internally score tokens (a discriminative-looking local choice), yet the overall system goal is sequence generation under an autoregressive or related generative factorization.
Practical implications: generative coding assistants require controls for correctness, licensing, security, and hallucination—concerns different from pure classifiers. Evaluation leans on functional tests, pass@k metrics, and human review, not only accuracy on a fixed label set. For exams, apply a simple test: does the system mainly create new artifacts (text, code, images) or mainly decide among predefined outputs? Creating code from prompts clearly selects generative model. Remember the quartet: generative creates, discriminative decides, regression fits numbers, clustering groups—then match the business story to the right bucket every time.