Open-weight model selection
Estimate weight storage first
An open-weight model makes learned parameter values available under specified terms; this alone does not establish open-source status, permission for every use, or access to training data and code. Unlike a hosted API, local inference requires a compatible runtime and hardware. A parameter is one learned numerical value. At a uniform precision of b bits, N parameters need at least ceil(N × b / 8) bytes of raw packed weight data. This example estimates one billion parameters: 2,000,000,000 bytes at 16 bits, 1,000,000,000 at 8 bits, and 500,000,000 at 4 bits. These are decimal bytes, not measured RAM, GPU memory, or actual file size. The ceiling rounds partial bytes upward.
def weight_bytes(parameters, bits): if type(parameters) is not int or parameters <= 0: raise ValueError("positive integer parameter count required") if type(bits) is not int or bits not in (4, 8, 16, 32): raise ValueError("unsupported bit width in this estimate") return (parameters * bits + 7) // 8
for bits in (16, 8, 4): print(weight_bytes(1_000_000_000, bits))Read a model card and its related dataset cards
A Hugging Face Hub repository may contain configuration, weights, tokenizer files and a README model card. Inspect intended task, base versus instruction-tuned checkpoint, supported languages, training provenance, evaluation setup, known limitations and license terms. The model card is a claim by the publisher, not independent verification. A dataset card documents provenance, language, size, license, collection and intended use where supplied. The Datasets library provides dataset loading and processing; a dataset being visible does not establish consent or commercial reuse rights. Review each artifact license, upstream restrictions, distribution obligations and your intended use. Missing information is a review blocker, not implicit permission. Do not copy data or download models merely to compare candidates.
Use an evidence gate, not a popularity contest
Suppose a fictional team needs offline English document classification. Alpha has an approved license review, relevant task evaluation, approved revision and a synthetic peak-memory estimate of 3000 MiB; Beta is smaller but license review is missing. A local policy gate allows Alpha with a 4000 MiB budget and rejects Beta regardless of memory. It also rejects Alpha under 2000 MiB. The booleans are normalized results of human review, never trusted directly from a model card. A true return means eligible for further isolated evaluation, not deployment approval. Real gates must also check authorization, security, data policy and measured runtime behavior.
def eligible(card, budget): # Normalized reviewer decisions, not raw Hub metadata. return (card["license_reviewed"] is True and card["task_reviewed"] is True and card["revision_reviewed"] is True and type(card["estimated_peak"]) is int and type(budget) is int and 0 < card["estimated_peak"] <= budget)
alpha = dict(license_reviewed=True, task_reviewed=True, revision_reviewed=True, estimated_peak=3000)beta = dict(alpha, license_reviewed=False, estimated_peak=1000)print(eligible(alpha, 4000))print(eligible(beta, 4000))print(eligible(alpha, 2000))Quantization and runtime choice
Quantization represents weights with fewer bits, often with per-block scales and mixed precision. Lower bit width may reduce storage and memory traffic, but actual memory includes quantization metadata, activations, KV cache, runtime buffers and possibly duplicated weights; context length and batch size matter. The architecture and tokenizer must match the runtime. Compare quality on held-out task fixtures, peak memory, time to first token and throughput under recorded hardware, context length, batch, quantization and software versions. Do not assert that a smaller file is always faster or equally accurate. Hugging Face Transformers, llama.cpp and Ollama are different execution interfaces, not interchangeable file formats. Advanced serving and quantization belong to the LLM Engineering track.
Practice: document why a candidate is excluded
Estimate raw weight bytes for 3 billion parameters at 4 and 16 bits, then explain why neither estimate proves the model fits in 8 GiB. Repeat the policy gate with a missing task evaluation, an unreviewed revision, and a budget exactly equal to the peak estimate. For a multilingual application include held-out examples in each required language, including Persian where relevant; this English-only package supplies no multilingual benchmark. Next, establish immutable artifact identity and safe loader defaults.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Open-weight model selection quiz
Apply model selection and artifact review contracts.
What does open-weight availability establish?
What is the ideal packed size of 1 billion 4-bit parameters?
A smaller model lacks license review. What should the example gate do?
Which measurement is needed for fair latency comparison?
Why consult dataset cards?