Skip to content
academia.sh

Lesson 26 / 26

Model Repositories and Terms of Use

Counting how many distribution options four license condition classes close in a use scenario: of sixteen options built from four asset types and four channels, the usage limit alone closes 6, the redistribution right 3, the derivative-work condition 2 and the commercial-use record 2, a total of 13; together they close 10, because three options are closed by more than one condition. Four of the six options left open are in a single channel. Removing the usage limit opens three options, not six. When the monthly request volume triples, the open options fall from six to four, and at ten times they fall to one. This lesson is the close of the Building Applications with Model APIs course.

Published Updated

In this lesson

  • Defines the four license condition classes as filters over the distribution options.
  • Computes separately the number of options each condition closes on its own and the number it opens when removed.
  • Shows how the number of options left open changes when the threshold and the volume change.
  • Collects the without-scaffolding and with-scaffolding numbers of the twenty-six lessons of the course in a single table.
Contents

In the previous lesson the small model was born from the output of the large model. In the lesson before that, adaptation differences were left in hand. Both are objects of the same kind: piles of numbers derived from someone else’s model, with no meaning on their own. Running these objects on your own server, putting them in a shared environment you rent, giving them to subscribers inside a package or leaving them open to everyone are not the same thing.

What this lesson measures is not what a text says, but how many options close. Distribution options are a countable set; license conditions are filters over this set. When the filters are applied, how many options are left, how much each filter closes on its own and how much it opens back when removed can be counted separately. The count is entirely determined; there is no seed-dependent draw, so the measure is independent of the run.

  • LA42. The asset types, channels, volumes and condition classes are fictional and are defined inside the lesson. No repository, license, organization, country or regulation name appears; the conditions are referred to only by their classes.
  • LA43. Four asset types can be distributed: output only, adaptation difference, full weight copy and distilled small model. The adaptation difference and the distilled small model are the objects produced by the previous two lessons.
  • LA44. There are four channels: in-house, rented shared environment, paid subscriber package and open release. For each channel the monthly request volume, whether it goes beyond the organization boundary, whether it is commercial and whether its recipient is known are written.
  • LA45. The usage limit says that in an option where the base model runs, the monthly request threshold cannot be exceeded. The redistribution right says that a copy of the base weight cannot leave the organization boundary. The derivative-work condition says that a derived asset can be given only in a channel where the conditions can be carried together with the recipient. The commercial-use record asks that, in a commercial channel, the base the use rests on be put into the record, and this record is produced from the call log of the base model.
  • LA46. This is not a law lesson. What is counted is not the meaning of texts but the number of options closed by particular condition predicates; the predicates are written above and appear in the code word for word.

Four Condition Classes and Sixteen Options

All of the conditions are applied at the same time, and an option closes if it is caught by at least one condition. So the condition that closes the most on its own does not have to be the condition that opens the most when removed.

# FICTIONAL. Asset types, channels, volumes and four condition classes are defined inside
# the lesson; no repository, license, organization or regulation name appears.
ASSETS = [  # name, does the base model run, is it a copy of the base weight, is it derived
    ("output only", True, False, False),
    ("adaptation difference", True, False, True),
    ("full weight copy", True, True, False),
    ("distilled small model", False, False, True)]
CHANNELS = [   # name, monthly requests, leaves the organization, commercial, recipient known
    ("in-house", 40000, False, False, True),
    ("rented shared environment", 120000, True, True, True),
    ("paid subscriber package", 900000, True, True, True),
    ("open release", 3000000, True, False, False)]
OPTIONS = [(v, k) for v in ASSETS for k in CHANNELS]


def c1(v, k, threshold):
    """Usage limit: in an option where the base model runs, the monthly request threshold cannot be exceeded."""
    return v[1] and k[1] > threshold


def c2(v, k, threshold):
    """Redistribution right: a copy of the base weight cannot leave the organization boundary."""
    return v[2] and k[2]


def c3(v, k, threshold):
    """Derivative-work condition: a derived asset can be given only in a channel where
    the conditions can be carried together with the recipient."""
    return v[3] and not k[4]


def c4(v, k, threshold):
    """Commercial-use record: in a commercial channel, the base the use rests on goes into
    the record; the record is produced from the call log of the base model."""
    return k[3] and not v[1]


CONDITIONS = [("usage limit", c1), ("redistribution right", c2),
              ("derivative-work condition", c3), ("commercial-use record", c4)]


def closed_by(option, conditions, threshold):
    return [name for name, f in conditions if f(*option, threshold)]


def count_closed(conditions, threshold, volume=1):
    channels = [(a, h * volume, d, t, b) for a, h, d, t, b in CHANNELS]
    options = [(v, k) for v in ASSETS for k in channels]
    return sum(1 for s in options if closed_by(s, conditions, threshold)), len(options)


THRESHOLD = 250000
print(f"options {len(OPTIONS)} = {len(ASSETS)} assets x {len(CHANNELS)} channels ,"
      f" monthly request threshold {THRESHOLD}")
print("\ncondition                  on its own  opened on removal")
closed_total = 0
for name, f in CONDITIONS:
    alone = sum(1 for s in OPTIONS if f(*s, THRESHOLD))
    without = count_closed([x for x in CONDITIONS if x[0] != name], THRESHOLD)[0]
    total_closed = count_closed(CONDITIONS, THRESHOLD)[0]
    closed_total += alone
    print(f"{name:<26} {alone:>10}  {total_closed - without:>17}")
total_closed = count_closed(CONDITIONS, THRESHOLD)[0]
print(f"{'total':<26} {closed_total:>10}  {'':>17}")
print(f"\nthe four conditions together close {total_closed} options , remaining open {len(OPTIONS) - total_closed}")
print("\nasset                   open channels")
for v in ASSETS:
    open_channels = [k[0] for k in CHANNELS if not closed_by((v, k), CONDITIONS, THRESHOLD)]
    print(f"{v[0]:<23} {' , '.join(open_channels) if open_channels else 'none'}")
options 16 = 4 assets x 4 channels , monthly request threshold 250000

condition                  on its own  opened on removal
usage limit                         6                  3
redistribution right                3                  1
derivative-work condition           2                  1
commercial-use record               2                  2
total                              13                   

the four conditions together close 10 options , remaining open 6

asset                   open channels
output only             in-house , rented shared environment
adaptation difference   in-house , rented shared environment
full weight copy        in-house
distilled small model   in-house

The four conditions close 6, 3, 2 and 2 options on their own; the total is 13. Together, though, they close 10. The three options in between are caught by more than one condition, that is, they have been counted twice. Adding up the closing counts exaggerates the effect of the conditions by thirty percent.

The opened-on-removal column is the counterpart of this. The usage limit closes six options on its own, but when removed it opens only three; the other three were already caught by the redistribution right or the derivative-work condition. The commercial-use record closes only two options on its own and when removed opens both back; it overlaps with no condition. The weight of a condition lies not in the number it closes but in the number it closes on its own.

The last table shows which options are left standing. For the full weight copy and the distilled small model a single channel is left: in-house. The two objects this course produced are the adaptation difference and the distilled small model, and they do not close the same number of options: the adaptation difference is caught by the usage limit because it runs the base model, and the distilled model cannot produce the commercial-use record because it does not. Both narrow, but from separate conditions.

When the Threshold and Volume Change

The same conditions do not give a fixed number; the number depends on the size of the scenario.

multi = sum(1 for s in OPTIONS if len(closed_by(s, CONDITIONS, THRESHOLD)) > 1)
print(f"options closed by more than one condition {multi} ; closed by one"
      f" condition {total_closed - multi} ; total closed {total_closed}")
print("\nthreshold and volume sensitivity (count independent of the run):")
print(f"{'threshold':>10}  {'volume':>6}  {'closed':>7}  {'open':>4}  closed by the usage limit alone")
for threshold, h in ((100000, 1), (250000, 1), (1000000, 1), (5000000, 1),
                     (250000, 3), (250000, 10)):
    closed, total = count_closed(CONDITIONS, threshold, h)
    alone = sum(1 for v in ASSETS for k in CHANNELS if c1(v, (k[0], k[1] * h), threshold))
    print(f"{threshold:>10}  {str(h) + 'x':>6}  {closed:>7}  {total - closed:>4}  {alone:>31}")
options closed by more than one condition 3 ; closed by one condition 7 ; total closed 10

threshold and volume sensitivity (count independent of the run):
 threshold  volume   closed  open  closed by the usage limit alone
    100000      1x       12     4                                9
    250000      1x       10     6                                6
   1000000      1x        8     8                                3
   5000000      1x        7     9                                0
    250000      3x       12     4                                9
    250000     10x       15     1                               12

When the threshold rises fourfold the open options go from six to eight, and when the threshold is fully relaxed to nine. In the opposite direction the change is sharper: when the monthly volume triples the open options fall to four, and when it rises tenfold they fall to one. At ten times the volume even the in-house channel exceeds the threshold, and all that remains is running the distilled model in-house. The conditions did not change; what grew was the workload. A distribution decision closes not on the day the condition text is read, but on the day the volume crosses the threshold.

Summary

  • Sixteen distribution options are built from four asset types and four channels; the conditions are predicates over this set, and the count is independent of the run.
  • The four conditions close a total of 13 on their own and 10 together; three options are caught by more than one condition.
  • The usage limit closes 6 options on its own but opens 3 when removed; the commercial-use record closes 2 and opens 2, that is, it overlaps with no condition.
  • For the full weight copy and the distilled small model a single channel is left, but one narrows from the redistribution right and the other from the commercial-use record.
  • When the monthly volume triples the open options fall from 6 to 4, and at ten times to 1: what closes the decision is not the condition text but the day the threshold is crossed.

Course Wrap-Up

Lesson Without scaffolding With scaffolding Cost
api-usage/01 — conversation state state not sent 0.2000 full transcript 0.8250 (+0.6250) input tokens 8346 → 31160
api-usage/02 — first token non-streaming, label at the end 16.03 steps streaming + label first 4.96 steps (−11.07) tokens the same; truncated responses recovered 0 → 31
api-usage/03 — valid call rate no catalog 0.0500 name + parameter 0.6917 (+0.6417) input 3694 → 11614; residue 14 wrong tools
api-usage/04 — schema conformance schema written in the prompt 0.7583 interface field 0.9000 (+0.1417) input tokens 7654 → 4294; per correct record 125.8 → 65.7
api-usage/05 — usable record share fine grid 0.8167 (183 tokens) cropped grid 0.7000 (−0.1167) per record 224.1 → 60.0 tokens
api-usage/06 — share of three neighbors from the same topic 144 dimensions 0.9259 72 dimensions 0.9028 (−0.0231) stored numbers 10368 → half
api-usage/07 — number of fields carried the provider’s own interface 12 common interface 8 (−4) output tokens 773 → 1638; readable truncation 0
api-usage/08 — number of calls / affected requests batch size 1: 120 calls, 1 request batch size 12: 10 calls (−110), 12 requests input 5854 → 1784; accuracy 0.0667 at size 18
ai-production-quality/01 — completion share under heavy load without scaffolding 0.8562 retry with backoff 0.8750 (+0.0188) run difference also 0.0188; neighboring stream 0.9500 → 0.8667
ai-production-quality/02 — correct response share no cache 0.9333 long-lived response cache 0.5542 (−0.3791) calls 240 → 29; stale share 0.0208 → 0.4417
ai-production-quality/03 — wait step / accuracy large context 3.0000 steps, 0.9292 two-stage 1.7500 steps (−1.2500), −0.0125 input tokens 19716
ai-production-quality/04 — tokens per request without abbreviation 81.6 three abbreviation policies 50.5 (−31.1) read per correct label, the gap narrows
ai-production-quality/05 — total accuracy without fallback 0.8450 with fallback 0.8850 (+0.0400) against the uninterrupted base 0.8975 → 0.8850; fallback tier 0.6667
ai-production-quality/06 — accuracy / share of drifting responses items fixed 0.9125 format word free 0.5525 (−0.3600) when three items at the provider drift, share 0.1150
ai-assisted-development/01 — accepted task (24) no context 7 whole codebase 18 (+11) 1104 → 4224 tokens; acceptance per thousand tokens 6.34 → 4.26
ai-assisted-development/02 — expected acceptance all files 0.6921 selected files 0.8233 (+0.1312) 4224 → 2274 tokens; 120 → 45 files
ai-assisted-development/03 — correct step (480) stopping once in eight steps 355 stopping at every step 478 (+123) stops 60 → 479; missed errors 21 → 1
ai-assisted-development/04 — caught defect (28) no review 0 three reviews 26 (+26) missed 2; one gets in without receiving any warning
ai-assisted-development/05 — distinguished broken version (6) generated test set 3 single manual alignment item 4 (+1) 2 of 14 tests fail on clean code, 9 distinguish nothing
ai-assisted-development/06 — secret class coverage without filter 0.0000 domain name filter 0.9333 (+0.9333) 12 traces remain in free text; false share among those accepted 0.5263
local-models-and-adaptation/01 — label accuracy / concurrent request small scale 0.6333, 248 requests large scale 0.8667 (+0.2334), 5 requests accuracy times concurrent requests 157.1 → 4.3
local-models-and-adaptation/02 — five-label topic accuracy 16 digits 0.8667 4 digits 0.8000 (−0.0667) memory 34.3 → 8.6 billion digits; concurrent requests 5 → 62
local-models-and-adaptation/03 — accuracy (60 records) base 0.6000 prompt with 60 examples 0.9667, fine-tuning 0.9500 (−0.0167) context per request 28.48 → 623.48 tokens; 180 steps, 0.2992 of the weights
local-models-and-adaptation/04 — field accuracy no adaptation 0.2500 low-rank update 0.9583 (+0.7083) updated share 0.2094; in eight fields 18336 → 6132 numbers
local-models-and-adaptation/05 — topic accuracy six human labels 0.5000 240 teacher labels 0.6333 (+0.1333) 240 calls, 3256 tokens; counting task 0.5833 → 0.3667
local-models-and-adaptation/06 — open distribution option (16) without reading the conditions 16 four license condition classes 6 (−10) when the volume rises tenfold 1

The rule of the course is written in the table row by row: a model call is not a function call but a network operation; a call whose failure is not written down is counted as unmeasured. None of the numbers in the without-scaffolding column is low because of bad code. All of them are low because it was not taken into account that the call will be delayed, will be queued, will be cut off midway, will be rejected or will use up someone else’s limit.

The second claim is read from the same table too: the resilience work added can make things worse. The rows that say so by name are these. In ai-production-quality/01, fixed-interval retry lowers completion under heavy load below that without scaffolding and drops the interactive stream sharing the same limit from 0.9500 to 0.8667. In ai-production-quality/02, the response cache cuts the calls from 240 to 29 while taking the correct response share from 0.9333 to 0.5542. In ai-production-quality/05, the fallback tier makes total accuracy look higher, but when read against the uninterrupted base there is a drop, and the accuracy of the requests that fall to the fallback is 0.6667. In ai-assisted-development/02, enlarging the context lowers the expected acceptance from 0.8233 to 0.6921. In api-usage/07, the common interface doubles the output tokens and makes none of the 117 truncations readable. In api-usage/08, raising the batch size cuts the calls from 120 to 10 while dropping accuracy to 0.0667 at the point of overrunning the context window. In local-models-and-adaptation/03, fine-tuning with sixty examples does not beat the prompt scaffolding. In local-models-and-adaptation/05, distillation takes the counting task from 0.5833 to 0.3667. In eight separate places the scaffolding paid for being added.

In twenty-six lessons the call was treated as a network operation and the cost of every piece of scaffolding was written down. One thing was never asked: the information given to the model was always put into the prompt by hand. The document corpus existed as fiction, but which three of a corpus of a thousand documents would go into that prompt, against which base that selection would be measured and what the cost of choosing the wrong three was were not counted even once. The next course turns this selection into an object of measurement.

To keep your progress and take notes, Log in

My notes

Log in to take notes.

Start typing to search.

↑↓ ↵ Esc navigate · open · close