openpond-sdk 0.12.23 → 0.12.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TRAINING_WORKFLOWS.md +16 -0
- package/dist/{chunk-LEVXD73U.js → chunk-KEG5QS7W.js} +8 -1
- package/dist/chunk-KEG5QS7W.js.map +1 -0
- package/dist/training-bundle.js +1 -1
- package/dist/training.js +112 -17
- package/dist/training.js.map +1 -1
- package/dist/types/packages/sdk/src/experiment-draft-storage.d.ts +96 -6
- package/dist/types/packages/sdk/src/experiment-draft-storage.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/managed-neuron-training-executions.d.ts +242 -21
- package/dist/types/packages/sdk/src/managed-neuron-training-executions.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/neuron-training-artifact.d.ts +42 -3
- package/dist/types/packages/sdk/src/neuron-training-artifact.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/neuron-training-experiment-draft.d.ts +16 -1
- package/dist/types/packages/sdk/src/neuron-training-experiment-draft.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/neuron-training-model-serving.d.ts +168 -16
- package/dist/types/packages/sdk/src/neuron-training-model-serving.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/neuron-training-result.d.ts +42 -3
- package/dist/types/packages/sdk/src/neuron-training-result.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/neuron-training.d.ts +23 -2
- package/dist/types/packages/sdk/src/neuron-training.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/steering-model-serving.d.ts +42 -4
- package/dist/types/packages/sdk/src/steering-model-serving.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/steering-profile-publication.d.ts +84 -8
- package/dist/types/packages/sdk/src/steering-profile-publication.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-experiment-setup.d.ts +42 -2
- package/dist/types/packages/sdk/src/training-experiment-setup.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-preparations.d.ts +1770 -485
- package/dist/types/packages/sdk/src/training-preparations.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-usage-funding.d.ts +23 -0
- package/dist/types/packages/sdk/src/training-usage-funding.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training.d.ts +792 -74
- package/dist/types/packages/sdk/src/training.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/weight-experiment-authoring.d.ts +5 -2
- package/dist/types/packages/sdk/src/weight-experiment-authoring.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/weight-model-versions.d.ts +168 -16
- package/dist/types/packages/sdk/src/weight-model-versions.d.ts.map +1 -1
- package/fixtures/python-foundation/schemas.json +8701 -8344
- package/package.json +1 -1
- package/dist/chunk-LEVXD73U.js.map +0 -1
package/TRAINING_WORKFLOWS.md
CHANGED
|
@@ -653,3 +653,19 @@ evaluation remains an independent candidate check. A nightly schedule uses the
|
|
|
653
653
|
authored time and timezone, waits for approved unused examples, and respects the
|
|
654
654
|
saved task threshold and spend limits. It does not itself enable conversation
|
|
655
655
|
collection, automatic data approval, or automatic serving.
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
Selective neuron continuation uses an exact compatible saved neuron version.
|
|
659
|
+
`neuronTrainingFormFromModelVersion` retains that version and its cumulative
|
|
660
|
+
patch, copies the parent's selection configuration, clears the target choice,
|
|
661
|
+
and requires reviewed new target data. `background=[]` retains the original
|
|
662
|
+
selection as inherited evidence; it does not report selection on the new data.
|
|
663
|
+
The explicit mode is `frozen_parent_fresh_residual_adam_v1`: the parent stays
|
|
664
|
+
frozen, fresh zero column parameters use the original dense base as their
|
|
665
|
+
anchors, and a fresh Adam optimizer learns a residual. No optimizer or RNG
|
|
666
|
+
checkpoint is resumed. Optional preservation compares against the starting
|
|
667
|
+
base plus parent patch. The worker verifies the exact parent bytes before
|
|
668
|
+
optimizer creation and exports a cumulative patch with parent, initial and
|
|
669
|
+
final state hashes. A runtime must explicitly advertise this mode before
|
|
670
|
+
admission; source packaging alone does not establish native qualification or
|
|
671
|
+
old/new held-out retention.
|
|
@@ -112,6 +112,11 @@ var TrainingUsageFundingRequestSchema = z2.object({
|
|
|
112
112
|
billingMode: z2.literal("actual_usage"),
|
|
113
113
|
customerCapUsd: Cap
|
|
114
114
|
}).strict();
|
|
115
|
+
var TrainingUsageQualificationRefSchema = z2.object({
|
|
116
|
+
authorizationId: z2.uuid(),
|
|
117
|
+
operationId: Id,
|
|
118
|
+
authorizationSha256: Hash2
|
|
119
|
+
}).strict();
|
|
115
120
|
var TrainingUsageQuoteContentSchema = z2.object({
|
|
116
121
|
schemaVersion: z2.literal("openpond.trainingUsageQuote.v1"),
|
|
117
122
|
teamId: Id,
|
|
@@ -122,6 +127,7 @@ var TrainingUsageQuoteContentSchema = z2.object({
|
|
|
122
127
|
customerCapUsd: Cap,
|
|
123
128
|
maximumWallSeconds: z2.number().int().positive(),
|
|
124
129
|
retentionDays: z2.number().int().nonnegative(),
|
|
130
|
+
qualification: TrainingUsageQualificationRefSchema.optional(),
|
|
125
131
|
gpu: Price,
|
|
126
132
|
guests: Guests,
|
|
127
133
|
judges: Judges,
|
|
@@ -818,6 +824,7 @@ export {
|
|
|
818
824
|
managedModificationPriceApprovalMatches,
|
|
819
825
|
TrainingBillingModesSchema,
|
|
820
826
|
TrainingUsageFundingRequestSchema,
|
|
827
|
+
TrainingUsageQualificationRefSchema,
|
|
821
828
|
TrainingUsageQuoteContentSchema,
|
|
822
829
|
TrainingUsageQuoteSchema,
|
|
823
830
|
verifyTrainingUsageQuote,
|
|
@@ -865,4 +872,4 @@ export {
|
|
|
865
872
|
assertTrainingEvaluationIsolation,
|
|
866
873
|
trainingEvaluationSourceRef
|
|
867
874
|
};
|
|
868
|
-
//# sourceMappingURL=chunk-
|
|
875
|
+
//# sourceMappingURL=chunk-KEG5QS7W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/managed-compute-price.ts","../src/training-usage-funding.ts","../src/training-recovery.ts","../src/training-physical-placement.ts","../src/training-queue.ts","../src/training-usage-status.ts","../src/training-job-contracts.ts","../src/training-grading-plan.ts","../src/training-evaluation-source.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { canonicalSha256, OpenPondProtocolError } from \"./protocol.js\";\n\nconst Hash = z.string().regex(/^[a-f0-9]{64}$/);\nconst Money = z.string().regex(/^(0|[1-9]\\d*)(\\.\\d{1,6})?$/).max(24);\nconst micros = (value:string) => {\n const [whole,fraction=\"\"] = Money.parse(value).split(\".\");\n return BigInt(whole!)*1_000_000n+BigInt(fraction.padEnd(6,\"0\"));\n};\n\n/** Accepted customer price only. Supplier accounts, hardware costs and\n * infrastructure identities are not part of this public contract. */\nexport const ComputeAppliedPriceSchema = z.object({\n schemaVersion:z.literal(\"openpond.computeAppliedPrice.v1\"),\n version:z.string().min(1).max(500),\n service:z.enum([\"managed_rl\",\"model_modification\",\"model_serving\",\"sandbox\"]),\n profileHash:Hash,currency:z.literal(\"USD\"),unit:z.literal(\"resource_hour\"),\n hourlyUsd:Money.refine(value=>{\n if(!Money.safeParse(value).success) return false;\n const amount=micros(value);\n return amount>0n && amount<=BigInt(Number.MAX_SAFE_INTEGER);\n }),\n}).strict();\nexport type ComputeAppliedPrice = z.infer<typeof ComputeAppliedPriceSchema>;\n\nexport const ManagedModificationPriceSchema = z.object({\n schemaVersion:z.literal(\"openpond.modificationPrice.v1\"),\n appliedPrice:ComputeAppliedPriceSchema.extend({service:z.literal(\"model_modification\")}),\n billingBoundary:z.literal(\"active_allocation_until_verified_cleanup\"),\n startupBillable:z.literal(true),\n postCompletionIdleBillable:z.literal(false),\n minimumBillableSeconds:z.literal(0),\n warmReuseSeconds:z.literal(300),\n}).strict();\nexport type ManagedModificationPrice = z.infer<typeof ManagedModificationPriceSchema>;\n\n/** Null means use available credits, with native finite execution bounds.\n * Empty form fields have the same meaning; wire-level schemas reject blanks. */\nexport function canonicalComputeSpendCap(value:string|null|undefined):string|null {\n if(value==null || value.trim()===\"\") return null;\n const amount=micros(value);\n if(amount<=0n || amount>1_000_000_000_000n)\n throw new OpenPondProtocolError(\"managed_modification_cap_invalid\",\"Choose a positive spending limit of at most 1,000,000 USD, or use available credits.\");\n return `${amount/1_000_000n}.${(amount%1_000_000n).toString().padStart(6,\"0\")}`;\n}\n\nexport function assertManagedModificationPricing(plan:{maximumSpendUsd:string|null;runtimeHash:string;computePrice?:ManagedModificationPrice}) {\n if(plan.maximumSpendUsd!==canonicalComputeSpendCap(plan.maximumSpendUsd) ||\n plan.maximumSpendUsd===null && !plan.computePrice ||\n plan.computePrice && plan.computePrice.appliedPrice.profileHash!==plan.runtimeHash)\n throw new OpenPondProtocolError(\"managed_modification_price_mismatch\",\"Retain the exact reviewed rate, runtime and optional spending limit.\");\n}\n\nexport async function managedModificationPriceApprovalMatches(plan:{computePrice?:ManagedModificationPrice},\n command:{approvedPriceHash?:string}) {\n return plan.computePrice ? command.approvedPriceHash===await canonicalSha256(plan.computePrice)\n : command.approvedPriceHash===undefined;\n}\n","import { z } from \"zod\";\nimport { ComputeAppliedPriceSchema } from \"./managed-compute-price.js\";\nimport { canonicalSha256, OpenPondProtocolError } from \"./protocol.js\";\n\nconst Id = z.string().min(1).max(500), Hash = z.string().regex(/^[a-f0-9]{64}$/);\nconst Price = ComputeAppliedPriceSchema.extend({ service: z.literal(\"managed_rl\") });\nconst Cap = z.string().regex(/^(0|[1-9]\\d*)\\.\\d{6}$/).max(24).refine(value => {\n if (!/^(0|[1-9]\\d*)\\.\\d{6}$/.test(value) || value.length > 24) return false;\n const micros = BigInt(value.replace(\".\", \"\"));\n return micros > 0n && micros <= BigInt(Number.MAX_SAFE_INTEGER);\n}).nullable();\nconst Guests = z.array(z.object({\n profileHash: Hash, price: Price,\n resources: z.object({ cpu: z.number().positive(), memoryGb: z.number().positive(), diskGb: z.number().nonnegative() }).strict(),\n}).strict()).max(32);\nconst Rate = z.string().regex(/^(0|[1-9]\\d*)\\.\\d{6}$/).max(24).refine(value =>\n /^(0|[1-9]\\d*)\\.\\d{6}$/.test(value) && value.length <= 24 &&\n BigInt(value.replace(\".\", \"\")) <= BigInt(Number.MAX_SAFE_INTEGER));\nconst Judges = z.object({\n billing: z.literal(\"existing_retail_child_captures\"), acceptedPricingHashes: z.array(Hash).max(64),\n prices: z.array(z.object({\n modelId: Id, displayName: Id, acceptedPricingHash: Hash,\n inputUsdPerMillionTokens: Rate, cachedInputUsdPerMillionTokens: Rate, outputUsdPerMillionTokens: Rate,\n cacheWriteUsdPerMillionTokens: Rate.nullable(), cacheWriteOneHourUsdPerMillionTokens: Rate.nullable(),\n longContextThresholdTokens: z.number().int().positive().nullable(),\n longContext: z.object({ inputUsdPerMillionTokens: Rate, cachedInputUsdPerMillionTokens: Rate,\n outputUsdPerMillionTokens: Rate, cacheWriteUsdPerMillionTokens: Rate.nullable() }).strict().nullable(),\n }).strict()).max(64),\n}).strict();\n\nexport const TrainingBillingModesSchema = z.tuple([\n z.object({ mode: z.literal(\"prepaid_only\"), availability: z.literal(\"available\"), reason: z.null() }).strict(),\n z.object({ mode: z.literal(\"actual_usage\"), availability: z.enum([\"unavailable\", \"requires_preparation\"]),\n reason: z.string().min(1).max(500).nullable() }).strict(),\n]);\nexport type TrainingBillingModes = z.infer<typeof TrainingBillingModesSchema>;\n\n/** The optional customer limit covers all priced components of this Job.\n * An omitted limit uses eligible credits; it never permits customer debt. */\nexport const TrainingUsageFundingRequestSchema = z.object({\n schemaVersion: z.literal(\"openpond.trainingUsageFundingRequest.v1\"),\n billingMode: z.literal(\"actual_usage\"), customerCapUsd: Cap,\n}).strict();\nexport type TrainingUsageFundingRequest = z.infer<typeof TrainingUsageFundingRequestSchema>;\n\n/** A server-signed reference to a bounded operator qualification. This pointer\n * confers no authority and does not advertise ordinary image support. */\nexport const TrainingUsageQualificationRefSchema = z.object({\n authorizationId: z.uuid(), operationId: Id, authorizationSha256: Hash,\n}).strict();\nexport type TrainingUsageQualificationRef = z.infer<typeof TrainingUsageQualificationRefSchema>;\n\nexport const TrainingUsageQuoteContentSchema = z.object({\n schemaVersion: z.literal(\"openpond.trainingUsageQuote.v1\"), teamId: Id, actorUserId: Id,\n preparationId: Id, submissionHash: Hash, workerImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n customerCapUsd: Cap, maximumWallSeconds: z.number().int().positive(), retentionDays: z.number().int().nonnegative(),\n qualification: TrainingUsageQualificationRefSchema.optional(),\n gpu: Price, guests: Guests, judges: Judges,\n storage: z.object({ price: Price, storageClass: z.literal(\"STANDARD\"), quantityBasis: z.literal(\"gib_milliseconds\"),\n onCreditExhaustion: z.literal(\"retain_objects_and_stop_new_storage\") }).strict(),\n gpuBillingBoundary: z.literal(\"active_allocation_until_verified_cleanup\"),\n storageBillingBoundary: z.literal(\"accepted_retention_window\"),\n startupBillable: z.literal(true), postCompletionIdleBillable: z.literal(false), minimumBillableSeconds: z.literal(0),\n issuedAt: z.iso.datetime(), expiresAt: z.iso.datetime(),\n}).strict();\nexport const TrainingUsageQuoteSchema = TrainingUsageQuoteContentSchema.extend({ contentHash: Hash, signature: Id }).strict();\nexport type TrainingUsageQuote = z.infer<typeof TrainingUsageQuoteSchema>;\n\n/** The server verifies its private signature before dispatch. Clients verify\n * the quote's hash and exact reviewed preparation without possessing that key. */\nexport async function verifyTrainingUsageQuote(raw: TrainingUsageQuote, expected: {\n teamId: string; actorUserId: string; preparationId: string; submissionHash: string; customerCapUsd: string | null;\n}) {\n const quote = TrainingUsageQuoteSchema.parse(raw), { contentHash, signature: _signature, ...content } = quote;\n if (contentHash !== await canonicalSha256(content) || quote.teamId !== expected.teamId ||\n quote.actorUserId !== expected.actorUserId || quote.preparationId !== expected.preparationId ||\n quote.submissionHash !== expected.submissionHash || quote.customerCapUsd !== expected.customerCapUsd ||\n Date.parse(quote.expiresAt) <= Date.parse(quote.issuedAt) ||\n new Set(quote.guests.map(guest => guest.profileHash)).size !== quote.guests.length ||\n quote.guests.some(guest => guest.profileHash !== guest.price.profileHash) ||\n new Set(quote.judges.acceptedPricingHashes).size !== quote.judges.acceptedPricingHashes.length ||\n new Set(quote.judges.prices.map(price => price.acceptedPricingHash)).size !== quote.judges.prices.length ||\n quote.judges.prices.length !== quote.judges.acceptedPricingHashes.length ||\n quote.judges.prices.some(price => !quote.judges.acceptedPricingHashes.includes(price.acceptedPricingHash)))\n throw new OpenPondProtocolError(\"training_usage_quote_mismatch\", \"Training prices differ from the reviewed preparation, actor or spending limit.\");\n return quote;\n}\n","import { z } from \"zod\";\nimport { canonicalSha256 } from \"./protocol.js\";\n\nconst id = z.string().trim().min(1).max(191);\nconst hash = z.string().regex(/^[a-f0-9]{64}$/);\nconst ApprovalBodySchema = z\n .object({\n schemaVersion: z.literal(\"openpond.checkpointRecoveryResourceApproval.v1\"),\n ownerUserId: id,\n teamId: id,\n sourceJobId: id,\n sourceJobVersion: z.number().int().positive(),\n sourceInputManifestSha256: hash,\n checkpointId: id,\n adapterSha256: hash,\n resumeSha256: hash,\n idempotencyKey: z.string().trim().min(16).max(191),\n approvedAt: z.iso.datetime({ offset: true }),\n maximumSpendUsd: z\n .number()\n .positive()\n .finite()\n .max(30)\n .refine(\n (value) => Number(value.toFixed(6)) === value,\n \"Recovery spend must use whole microdollars\",\n ),\n maximumGpuSeconds: z.number().int().positive().max(21_600),\n maximumWallSeconds: z.number().int().positive().max(21_600),\n })\n .strict();\n\nexport const TrainingCheckpointRecoveryResourceApprovalSchema = ApprovalBodySchema.extend({\n approvalHash: hash,\n})\n .strict()\n .superRefine((value, context) => {\n if (value.maximumGpuSeconds > value.maximumWallSeconds)\n context.addIssue({\n code: \"custom\",\n path: [\"maximumGpuSeconds\"],\n message: \"Recovery GPU duration exceeds its wall\",\n });\n });\n\n/** The authenticated source owner's funded request is consent; this hash binds its exact scope. */\nexport async function createTrainingCheckpointRecoveryResourceApproval(\n input: z.input<typeof ApprovalBodySchema>,\n) {\n const body = ApprovalBodySchema.parse(input);\n return TrainingCheckpointRecoveryResourceApprovalSchema.parse({\n ...body,\n approvalHash: await canonicalSha256(body),\n });\n}\n\n/** Exact execution recovery; a continual-training optimizer reset is separate. */\nexport const TrainingCheckpointRecoveryRequestSchema = z\n .object({\n resourceApproval: TrainingCheckpointRecoveryResourceApprovalSchema.optional(),\n mode: z.literal(\"evaluation_only\").optional(),\n evaluationGpuType: z\n .enum([\"NVIDIA A100 80GB PCIe\", \"NVIDIA A100-SXM4-80GB\", \"NVIDIA H100 80GB HBM3\"])\n .optional(),\n expectedVersion: z.number().int().positive(),\n checkpointId: id,\n idempotencyKey: z.string().trim().min(16).max(191),\n maximumSpendUsd: z.number().positive().finite(),\n maximumWallSeconds: z.number().int().positive().max(21_600),\n })\n .strict()\n .superRefine((value, context) => {\n if (value.evaluationGpuType && value.mode !== \"evaluation_only\")\n context.addIssue({\n code: \"custom\",\n path: [\"evaluationGpuType\"],\n message: \"GPU substitution requires explicit evaluation-only recovery\",\n });\n const a = value.resourceApproval;\n if (\n a &&\n (a.sourceJobVersion !== value.expectedVersion ||\n a.checkpointId !== value.checkpointId ||\n a.idempotencyKey !== value.idempotencyKey ||\n a.maximumSpendUsd !== value.maximumSpendUsd ||\n a.maximumWallSeconds !== value.maximumWallSeconds)\n )\n context.addIssue({\n code: \"custom\",\n path: [\"resourceApproval\"],\n message: \"Recovery resource approval does not match its request\",\n });\n });\n","import { z } from \"zod\";\n\n/** Placement authority only: a fresh learner never inherits the source Policy. */\nexport const TrainingPhysicalPlacementSchema = z.object({\n mode: z.literal(\"reuse_only\"),\n physicalWorkerId: z.string().trim().min(1).max(191),\n providerPodId: z.string().trim().min(1).max(191),\n workerImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n baseProfileSha256: z.string().regex(/^[a-f0-9]{64}$/),\n gpuType: z.string().trim().min(1).max(200),\n sourceJobId: z.string().trim().min(1).max(191),\n sourceInputManifestSha256: z.string().regex(/^[a-f0-9]{64}$/),\n ownerTeamId: z.string().trim().min(1).max(191),\n deadlineAt: z.string().datetime({ offset: true }),\n}).strict();\n\nexport type TrainingPhysicalPlacement = z.infer<typeof TrainingPhysicalPlacementSchema>;\n","import { z } from \"zod\";\n\nconst Timestamp = z.string().datetime({ offset: true });\n\n/** Customer status deliberately omits provider/internal capacity reasons. A\n * stable ticket identifies the request; current fair-queue position may change. */\nexport const TrainingQueueStatusSchema = z.object({\n ticketId: z.string().trim().min(1).max(191),\n ticketNumber: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),\n label: z.literal(\"Waiting for resources\"),\n position: z.number().int().positive().nullable(),\n positionScope: z.literal(\"compatible_fair_queue\"),\n enqueuedAt: Timestamp,\n asOf: Timestamp,\n estimate: z.object({\n revision: z.number().int().nonnegative(),\n estimatedStartAt: Timestamp,\n expiresAt: Timestamp,\n evidence: z.enum([\"observed_capacity\", \"measured_bootstrap\", \"scheduled_release\"]),\n }).strict().nullable(),\n}).strict().superRefine((value, context) => {\n if (value.estimate && Date.parse(value.estimate.expiresAt) <= Date.parse(value.asOf))\n context.addIssue({ code: \"custom\", path: [\"estimate\"], message: \"An expired queue forecast must be returned as unavailable\" });\n});\n\nexport type TrainingQueueStatus = z.infer<typeof TrainingQueueStatusSchema>;\n","import { z } from \"zod\";\n\nconst Money = z.string().regex(/^(0|[1-9]\\d*)\\.\\d{6}$/).max(24).refine(value =>\n /^(0|[1-9]\\d*)\\.\\d{6}$/.test(value) && value.length <= 24 &&\n BigInt(value.replace(\".\", \"\")) <= BigInt(Number.MAX_SAFE_INTEGER));\n\n/** Read-only account-locked totals. Available credit never grants execution authority. */\nexport const TrainingUsageSnapshotSchema = z.object({\n schemaVersion: z.literal(\"openpond.trainingUsageSnapshot.v1\"), asOf: z.iso.datetime(),\n customerCapUsd: Money.nullable(), chargedUsd: Money, committedUsd: Money, outstandingUsd: Money,\n remainingCapUsd: Money.nullable(), availableCreditUsd: Money, complete: z.boolean(),\n components: z.array(z.object({ component: z.enum([\"gpu\", \"guest\", \"storage\", \"judge\"]),\n chargedUsd: Money, committedUsd: Money, outstandingUsd: Money, openOwners: z.number().int().nonnegative(),\n }).strict()).length(4).refine(values => values.every((value, index) =>\n value.component === [\"gpu\", \"guest\", \"storage\", \"judge\"][index])),\n}).strict();\nexport type TrainingUsageSnapshot = z.infer<typeof TrainingUsageSnapshotSchema>;\n","/** Credential-free training wire contracts. Schema owners import this leaf;\n * the public training client barrel composes owners and re-exports these values. */\nimport { z } from \"zod\";\nimport { TrainingHandoffOriginSchema } from \"@openpond/evals/learning\";\nimport { ModelProjectBaseModelSchema, ModelProjectImmutableRefSchema,\n ModelProjectRecipeDocumentSchema, ModelProjectVersionedRefSchema } from \"./model-projects.js\";\nimport { SftRecipeSchema, TrainingSftImageCapabilitiesSchema } from \"./training-supervised.js\";\nimport { TrainingCheckpointRecoveryResourceApprovalSchema } from \"./training-recovery.js\";\nimport { TrainingPhysicalPlacementSchema } from \"./training-physical-placement.js\";\nimport { TrainingGpuSelectionSchema } from \"./training-compute-selection.js\";\nimport { TrainingQueueStatusSchema } from \"./training-queue.js\";\nimport { TrainingUsageSnapshotSchema } from \"./training-usage-status.js\";\nimport { TrainingBillingModesSchema } from \"./training-usage-funding.js\";\nimport { TRAINING_INPUT_ARTIFACT_MAX_BYTES, TRAINING_JOB_SUBMISSION_MAX_BYTES,\n OpenPondProtocolError, assertCanonicalPayloadSize, canonicalSha256 } from \"./protocol.js\";\n\nconst IdSchema = z.string().trim().min(1).max(500);\nconst HashSchema = z.string().regex(/^[a-f0-9]{64}$/);\nconst TimestampSchema = z.string().datetime({ offset: true });\n\n/**\n * Stages a content-addressed immutable input before Job admission. The payload\n * is deliberately opaque to the transport contract: its declared kind owns\n * the executable schema, while the envelope provides bounded bytes,\n * idempotency, and a stable manifest lookup key.\n */\nexport const TrainingInputArtifactUploadSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingInputArtifactUpload.v2\"),\n kind: z.enum([\"portable_training_bundle\", \"reward_model_dataset\"]),\n idempotencyKey: z.string().trim().min(1).max(500),\n sourceManifest: ModelProjectImmutableRefSchema,\n payload: z.unknown(),\n contentHash: HashSchema,\n })\n .strict();\n\nexport const TrainingInputArtifactSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingInputArtifact.v2\"),\n kind: z.enum([\"portable_training_bundle\", \"reward_model_dataset\"]),\n sourceManifest: ModelProjectImmutableRefSchema,\n artifactRef: z.string().trim().min(1).max(2_000),\n contentHash: HashSchema,\n sizeBytes: z.number().int().positive(),\n createdAt: TimestampSchema,\n })\n .strict();\n\nexport async function trainingInputArtifactUploadHash(\n upload: Omit<TrainingInputArtifactUpload, \"contentHash\"> | TrainingInputArtifactUpload,\n): Promise<string> {\n const { contentHash: _contentHash, ...content } = upload as TrainingInputArtifactUpload;\n return canonicalSha256(content);\n}\n\nexport async function parseAndVerifyTrainingInputArtifactUpload(\n value: unknown,\n): Promise<TrainingInputArtifactUpload> {\n assertCanonicalPayloadSize(value, TRAINING_INPUT_ARTIFACT_MAX_BYTES, \"Training input artifact\");\n const parsed = TrainingInputArtifactUploadSchema.parse(value);\n const expectedHash = await trainingInputArtifactUploadHash(parsed);\n if (parsed.contentHash !== expectedHash) {\n throw new OpenPondProtocolError(\n \"content_hash_mismatch\",\n `Training input artifact contentHash ${parsed.contentHash} does not match ${expectedHash}.`,\n );\n }\n return parsed;\n}\n\nexport const TrainingJobKindSchema = z.enum([\"reward_model_train\", \"policy_optimize\"]);\n\nexport const TrainingJobStateSchema = z.enum([\n \"queued\",\n \"admitting\",\n \"provisioning\",\n \"running\",\n \"stopping\",\n \"cancelling\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n]);\n\nexport const TrainingCapabilityRequirementSchema = z\n .object({\n id: IdSchema,\n version: z.string().trim().min(1).max(200).nullable().default(null),\n required: z.boolean().default(true),\n })\n .strict();\n\nexport const TrainingJobSourceSchema = z\n .object({\n origin: TrainingHandoffOriginSchema.optional(),\n modelProject: z\n .object({\n id: IdSchema,\n portableProjectId: IdSchema,\n revision: z.number().int().positive(),\n contentHash: HashSchema,\n })\n .strict(),\n harnessRunManifest: ModelProjectImmutableRefSchema,\n harnessRelease: ModelProjectImmutableRefSchema,\n taskset: ModelProjectVersionedRefSchema,\n tasksetRelease: ModelProjectImmutableRefSchema,\n evaluation: z\n .object({\n taskset: ModelProjectVersionedRefSchema,\n dataset: ModelProjectImmutableRefSchema,\n })\n .strict()\n .nullable()\n .optional(),\n dataset: ModelProjectImmutableRefSchema,\n evidenceSets: z.array(ModelProjectImmutableRefSchema).max(10_000),\n })\n .strict();\n\nexport const RewardModelTrainingRequestSchema = z\n .object({\n kind: z.literal(\"reward_model_train\"),\n baseModel: ModelProjectBaseModelSchema,\n preferenceDatasetRelease: ModelProjectImmutableRefSchema,\n processorRelease: ModelProjectImmutableRefSchema,\n recipe: z\n .object({\n schemaVersion: z.literal(\"openpond.rewardModelRecipe.v1\"),\n method: z.literal(\"reward_model\"),\n parameterization: z.literal(\"lora_with_scalar_head\"),\n })\n .catchall(z.unknown()),\n })\n .strict();\n\nconst DeterministicRewardSourceSchema = z\n .object({\n kind: z.literal(\"deterministic\"),\n grader: ModelProjectImmutableRefSchema,\n composer: ModelProjectImmutableRefSchema.nullable().default(null),\n })\n .strict();\n\nconst LearnedRewardSourceSchema = z\n .object({\n kind: z.literal(\"learned_reward\"),\n rewardModelVersion: ModelProjectImmutableRefSchema,\n qualificationReport: ModelProjectImmutableRefSchema.nullable().default(null),\n evaluationReferences: z.array(ModelProjectImmutableRefSchema).max(1_000).default([]),\n scorerArtifact: z\n .object({\n artifactRef: z.string().trim().min(1).max(2_000),\n contentHash: HashSchema,\n executionReceipt: ModelProjectImmutableRefSchema,\n })\n .strict(),\n processorRelease: ModelProjectImmutableRefSchema,\n rewardComposerRelease: ModelProjectImmutableRefSchema,\n })\n .strict();\n\nexport const TrainingQualificationBaseModelSchema = ModelProjectBaseModelSchema.extend({\n revision: z.string().regex(/^[a-f0-9]{40,64}$/),\n tokenizerRevision: z.string().regex(/^[a-f0-9]{40,64}$/),\n chatTemplateHash: HashSchema,\n}).strict();\n\nexport const PolicyOptimizationRequestSchema = z\n .object({\n kind: z.literal(\"policy_optimize\"),\n /** Collect and grade one original-learner group without optimizer work. */\n executionMode: z.literal(\"qualification\").optional(),\n baseModel: ModelProjectBaseModelSchema,\n recipe: ModelProjectRecipeDocumentSchema,\n rewardSource: z.discriminatedUnion(\"kind\", [\n DeterministicRewardSourceSchema,\n LearnedRewardSourceSchema,\n ]),\n resumeFrom: ModelProjectImmutableRefSchema.nullable().default(null),\n })\n .strict()\n .superRefine((job, context) => {\n if (job.recipe.method !== \"sft\") return;\n const recipe = SftRecipeSchema.safeParse(job.recipe);\n if (!recipe.success) {\n context.addIssue({\n code: \"custom\",\n path: [\"recipe\"],\n message: \"The SFT recipe is incomplete or invalid.\",\n });\n return;\n }\n if (job.executionMode || job.resumeFrom || \"continuation\" in job.recipe)\n context.addIssue({\n code: \"custom\",\n message:\n \"Initial managed SFT requires a fresh supervised run without rollout qualification or continuation.\",\n });\n if (\n recipe.data.baseModel.id !== job.baseModel.modelId ||\n recipe.data.baseModel.revision !== job.baseModel.revision ||\n recipe.data.baseModel.tokenizerRevision !== job.baseModel.tokenizerRevision ||\n recipe.data.baseModel.chatTemplateHash !== job.baseModel.chatTemplateHash\n )\n context.addIssue({\n code: \"custom\",\n path: [\"baseModel\"],\n message: \"The SFT recipe must pin the exact submitted base and tokenizer.\",\n });\n });\n\nexport const TrainingJobRequestSchema = z.discriminatedUnion(\"kind\", [\n RewardModelTrainingRequestSchema,\n PolicyOptimizationRequestSchema,\n]);\n\nexport const TrainingJobApprovalSchema = z\n .object({\n approvalHash: HashSchema,\n approvedAt: TimestampSchema,\n exportApproved: z.boolean(),\n maximumSpendUsd: z.number().nonnegative(),\n retentionDays: z.number().int().nonnegative().nullable(),\n region: z.string().trim().min(1).max(200).nullable().default(null),\n })\n .strict();\n\nexport const TrainingJobSubmissionSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobSubmission.v2\"),\n idempotencyKey: z.string().trim().min(1).max(500),\n name: z.string().trim().min(1).max(200),\n source: TrainingJobSourceSchema,\n job: TrainingJobRequestSchema,\n requestedCapabilities: z.array(TrainingCapabilityRequirementSchema).max(1_000),\n placementObjective: z.enum([\"fast\", \"balanced\", \"economical\"]),\n gpuSelection: TrainingGpuSelectionSchema.optional(),\n physicalPlacement: TrainingPhysicalPlacementSchema.optional(),\n budget: z\n .object({\n maximumSpendUsd: z.number().nonnegative(),\n maximumWallSeconds: z.number().int().positive(),\n })\n .strict(),\n approval: TrainingJobApprovalSchema,\n contentHash: HashSchema,\n })\n .strict()\n .superRefine((submission, context) => {\n const distributed = (submission.gpuSelection?.gpuCount ?? 1) === 2;\n const distributedRequirement = submission.requestedCapabilities.some(requirement =>\n requirement.id === \"managed_rl.policy.data_parallel\" && requirement.version === \"1\" && requirement.required);\n if (distributed !== distributedRequirement) {\n context.addIssue({ code: \"custom\", path: [\"requestedCapabilities\"], message: \"Two-GPU training must require managed_rl.policy.data_parallel@1 and bind gpuSelection.gpuCount to 2.\" });\n }\n if (distributed && (submission.job.kind !== \"policy_optimize\" || submission.job.executionMode ||\n submission.job.recipe.method !== \"grpo\" || submission.physicalPlacement)) {\n context.addIssue({ code: \"custom\", path: [\"gpuSelection\"], message: \"Two-GPU execution requires exclusive GRPO policy training.\" });\n }\n if (submission.physicalPlacement && (submission.job.kind !== \"policy_optimize\" ||\n submission.job.resumeFrom || submission.job.executionMode || submission.job.recipe.continuation !== undefined)) {\n context.addIssue({ code: \"custom\", path: [\"physicalPlacement\"], message: \"Reuse-only placement requires fresh-base policy training without continuation.\" });\n }\n if (submission.job.kind === \"policy_optimize\" && submission.job.executionMode === \"qualification\") {\n const job = submission.job;\n if (!TrainingQualificationBaseModelSchema.safeParse(job.baseModel).success) {\n context.addIssue({ code: \"custom\", path: [\"job\", \"baseModel\"], message: \"Qualification requires immutable model and tokenizer revisions and a SHA-256 chat-template pin.\" });\n }\n if (job.resumeFrom || job.recipe.continuation !== undefined || job.rewardSource.kind !== \"deterministic\" || job.recipe.method !== \"grpo\") {\n context.addIssue({\n code: \"custom\", path: [\"job\"],\n message: \"Qualification requires the original GRPO learner, deterministic reward, and no resume or continuation.\",\n });\n }\n if (!submission.requestedCapabilities.some(requirement => requirement.required && requirement.id === \"managed_rl.policy.qualification\" && requirement.version === \"1\")) {\n context.addIssue({\n code: \"custom\", path: [\"requestedCapabilities\"],\n message: \"Qualification must require managed_rl.policy.qualification@1.\",\n });\n }\n }\n if (submission.approval.maximumSpendUsd !== submission.budget.maximumSpendUsd) {\n context.addIssue({\n code: \"custom\",\n path: [\"approval\", \"maximumSpendUsd\"],\n message: \"Approved spend must equal the immutable Job budget.\",\n });\n }\n });\n\nexport async function trainingJobSubmissionHash(\n submission: Omit<TrainingJobSubmission, \"contentHash\"> | TrainingJobSubmission,\n): Promise<string> {\n const { contentHash: _contentHash, ...content } = submission as TrainingJobSubmission;\n return canonicalSha256(content);\n}\n\nexport async function parseAndVerifyTrainingJobSubmission(\n value: unknown,\n): Promise<TrainingJobSubmission> {\n assertCanonicalPayloadSize(value, TRAINING_JOB_SUBMISSION_MAX_BYTES, \"Training Job submission\");\n const parsed = TrainingJobSubmissionSchema.parse(value);\n const expectedHash = await trainingJobSubmissionHash(parsed);\n if (parsed.contentHash !== expectedHash) {\n throw new OpenPondProtocolError(\n \"content_hash_mismatch\",\n `Training Job contentHash ${parsed.contentHash} does not match ${expectedHash}.`,\n );\n }\n return parsed;\n}\n\nexport const TrainingJobRecoverySchema = z.object({\n resourceApproval: TrainingCheckpointRecoveryResourceApprovalSchema.optional(),\n mode: z.literal(\"evaluation_only\").optional(),\n trainingWorkloadComplete: z.boolean().optional(),\n sourceJobId: IdSchema,\n checkpointId: IdSchema,\n policyVersion: z.number().int().positive(),\n completedGroups: z.number().int().positive(),\n optimizerMode: z.literal(\"continue\"),\n}).strict();\n\nexport const TrainingJobSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJob.v2\"),\n id: IdSchema,\n teamId: IdSchema,\n kind: TrainingJobKindSchema,\n executionMode: z.literal(\"qualification\").optional(),\n recovery: TrainingJobRecoverySchema.optional(),\n modelProjectId: IdSchema,\n portableProjectId: IdSchema,\n sourceProjectRevision: z.number().int().positive(),\n submissionHash: HashSchema,\n state: TrainingJobStateSchema,\n queue: TrainingQueueStatusSchema.optional(),\n phase: z.string().trim().min(1).max(200),\n version: z.number().int().nonnegative(),\n progress: z.number().min(0).max(1),\n rolloutProgress: z\n .object({\n groupsCompleted: z.number().int().nonnegative(),\n groupsTarget: z.number().int().nonnegative(),\n optimizerUpdatesApplied: z.number().int().nonnegative(),\n optimizerUpdatesSkipped: z.number().int().nonnegative(),\n })\n .strict(),\n accruedSpendUsd: z.number().nonnegative(),\n usage: TrainingUsageSnapshotSchema.optional(),\n terminalReason: z.string().trim().min(1).max(5_000).nullable(),\n createdAt: TimestampSchema,\n updatedAt: TimestampSchema,\n completedAt: TimestampSchema.nullable(),\n })\n .strict();\n\nexport const TrainingJobPageSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobPage.v2\"),\n jobs: z.array(TrainingJobSchema).max(1_000),\n nextCursor: z.string().trim().min(1).max(2_000).nullable(),\n })\n .strict();\n\nexport const TrainingJobEventSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobEvent.v2\"),\n id: IdSchema,\n jobId: IdSchema,\n sequence: z.number().int().nonnegative(),\n type: IdSchema,\n phase: z.string().trim().min(1).max(200),\n message: z.string().trim().min(1).max(5_000).nullable(),\n data: z.record(z.string(), z.unknown()).default({}),\n createdAt: TimestampSchema,\n })\n .strict();\n\nexport const TrainingJobLogSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobLog.v2\"),\n jobId: IdSchema,\n sequence: z.number().int().nonnegative(),\n level: z.enum([\"debug\", \"info\", \"warning\", \"error\"]),\n message: z.string().max(20_000),\n createdAt: TimestampSchema,\n })\n .strict();\n\nexport const TrainingJobControlRequestSchema = z\n .object({ expectedVersion: z.number().int().nonnegative() })\n .strict();\n\nexport const TrainingJobOutputSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobOutput.v2\"),\n id: IdSchema,\n jobId: IdSchema,\n kind: z.enum([\"checkpoint\", \"adapter\", \"scorer\", \"metrics\", \"evaluation\", \"trace\", \"receipt\"]),\n artifactRef: z.string().trim().min(1).max(2_000),\n contentHash: HashSchema,\n sizeBytes: z.number().int().nonnegative(),\n metadata: z.record(z.string(), z.unknown()).default({}),\n createdAt: TimestampSchema,\n })\n .strict();\n\n/** Evidence that collection used the pinned original learner and never updated it. */\nexport const TrainingQualificationEvidenceSchema = z.object({\n schemaVersion: z.literal(\"openpond.trainingQualificationEvidence.v1\"),\n baseModel: TrainingQualificationBaseModelSchema,\n group: ModelProjectImmutableRefSchema,\n rolloutReceipts: z.array(ModelProjectImmutableRefSchema).min(1).max(1_000),\n rewardEvidenceHash: HashSchema,\n groupsCompleted: z.literal(1),\n optimizerUpdatesApplied: z.literal(0),\n optimizerUpdatesSkipped: z.literal(0),\n trainingStepsCreated: z.literal(0),\n checkpointsCreated: z.literal(0),\n artifactsCreated: z.literal(0),\n}).strict().superRefine((evidence, context) => {\n if (new Set(evidence.rolloutReceipts.map(receipt => receipt.id)).size !== evidence.rolloutReceipts.length) {\n context.addIssue({ code: \"custom\", path: [\"rolloutReceipts\"], message: \"Qualification rollout receipt identities must be unique.\" });\n }\n});\n\nexport const TrainingExecutionReceiptSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingExecutionReceipt.v2\"),\n id: IdSchema,\n teamId: IdSchema,\n jobId: IdSchema,\n submissionHash: HashSchema,\n manifestHash: HashSchema,\n recipeHash: HashSchema,\n capabilityHash: HashSchema,\n runtimeRelease: ModelProjectImmutableRefSchema,\n inputs: z.array(ModelProjectImmutableRefSchema).max(10_000),\n outputs: z.array(ModelProjectImmutableRefSchema).max(10_000),\n spendUsd: z.number().nonnegative(),\n durationSeconds: z.number().nonnegative(),\n cleanupComplete: z.boolean(),\n qualification: TrainingQualificationEvidenceSchema.optional(),\n issuer: IdSchema,\n issuedAt: TimestampSchema,\n signature: z.string().trim().min(1).max(10_000).nullable(),\n })\n .strict();\n\nexport async function trainingExecutionReceiptHash(\n receipt: TrainingExecutionReceipt,\n): Promise<string> {\n return canonicalSha256(TrainingExecutionReceiptSchema.parse(receipt));\n}\n\nexport async function parseAndVerifyTrainingExecutionReceipt(\n value: unknown,\n expected: {\n id: string;\n contentHash: string;\n teamId?: string;\n jobId?: string;\n requireCleanup?: boolean;\n qualificationSubmission?: TrainingJobSubmission;\n outputs?: TrainingJobOutput[];\n },\n): Promise<TrainingExecutionReceipt> {\n const receipt = TrainingExecutionReceiptSchema.parse(value);\n const expectedId = IdSchema.parse(expected.id);\n const expectedHash = HashSchema.parse(expected.contentHash);\n const actualHash = await trainingExecutionReceiptHash(receipt);\n if (receipt.id !== expectedId || actualHash !== expectedHash) {\n throw new OpenPondProtocolError(\n \"execution_receipt_mismatch\",\n \"The execution receipt identity or canonical content hash did not match.\",\n );\n }\n if (expected.teamId !== undefined && receipt.teamId !== IdSchema.parse(expected.teamId)) {\n throw new OpenPondProtocolError(\n \"execution_receipt_team_mismatch\",\n \"The execution receipt belongs to a different team.\",\n );\n }\n if (expected.jobId !== undefined && receipt.jobId !== IdSchema.parse(expected.jobId)) {\n throw new OpenPondProtocolError(\n \"execution_receipt_job_mismatch\",\n \"The execution receipt belongs to a different Training Job.\",\n );\n }\n if ((expected.requireCleanup ?? true) && !receipt.cleanupComplete) {\n throw new OpenPondProtocolError(\n \"execution_cleanup_incomplete\",\n \"The execution receipt does not attest complete terminal cleanup.\",\n );\n }\n if (expected.qualificationSubmission) {\n const submission = await parseAndVerifyTrainingJobSubmission(expected.qualificationSubmission);\n if (submission.job.kind !== \"policy_optimize\" || submission.job.executionMode !== \"qualification\") {\n throw new OpenPondProtocolError(\"qualification_submission_required\", \"Expected an immutable qualification submission.\");\n }\n await assertTrainingQualificationReceipt(receipt, { submissionHash: submission.contentHash, baseModel: submission.job.baseModel, outputs: expected.outputs });\n }\n return receipt;\n}\n\nexport async function assertTrainingQualificationReceipt(\n receipt: TrainingExecutionReceipt,\n expected: { submissionHash: string; baseModel?: z.infer<typeof ModelProjectBaseModelSchema>; outputs?: TrainingJobOutput[] },\n): Promise<void> {\n const evidence = TrainingQualificationEvidenceSchema.parse(receipt.qualification);\n if (receipt.submissionHash !== expected.submissionHash || !receipt.cleanupComplete) {\n throw new OpenPondProtocolError(\"qualification_receipt_mismatch\", \"Qualification must attest the expected submission and complete cleanup.\");\n }\n if (expected.baseModel && await canonicalSha256(evidence.baseModel) !== await canonicalSha256(expected.baseModel)) {\n throw new OpenPondProtocolError(\"qualification_learner_mismatch\", \"Qualification used a different original learner or tokenizer.\");\n }\n if (expected.outputs?.some(output => [\"checkpoint\", \"adapter\", \"scorer\"].includes(output.kind))) {\n throw new OpenPondProtocolError(\"qualification_updated_artifact\", \"Qualification must not publish trained artifacts or checkpoints.\");\n }\n}\n\nexport const TrainingJobOutputsSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingJobOutputs.v2\"),\n outputs: z.array(TrainingJobOutputSchema).max(10_000),\n receipt: TrainingExecutionReceiptSchema.nullable(),\n })\n .strict();\n\nexport const TrainingPolicyLoraCapabilitiesSchema = z.object({\n workerImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n envelopeRank: z.number().int().positive().max(256),\n supportedRanks: z.array(z.number().int().positive().max(256)).max(256),\n qualification: z.object({ evidenceRef: z.string().min(1), evidenceSha256: HashSchema }).strict().nullable(),\n continuation: z.object({\n sharedRequiresSameRank: z.literal(true),\n mergedRequiresSameRank: z.literal(true),\n residualAppendRequiresFreeCapacity: z.literal(true),\n stageOptimizer: z.literal(\"reset\"),\n interruptedRecoveryOptimizer: z.literal(\"restore\"),\n }).strict(),\n}).strict().superRefine((value, context) => {\n if (new Set(value.supportedRanks).size !== value.supportedRanks.length || value.supportedRanks.some(rank => rank > value.envelopeRank))\n context.addIssue({ code: \"custom\", path: [\"supportedRanks\"], message: \"Supported ranks must be unique and fit the physical adapter envelope.\" });\n if (value.supportedRanks.length && !value.qualification)\n context.addIssue({ code: \"custom\", path: [\"qualification\"], message: \"Advertised ranks require immutable image qualification evidence.\" });\n});\nexport type TrainingPolicyLoraCapabilities = z.infer<typeof TrainingPolicyLoraCapabilitiesSchema>;\n\nexport function supportsTrainingPolicyLoraRank(capabilities: TrainingPolicyLoraCapabilities, rank: number,\n continuation?: { mode: \"shared\" | \"sequential_merge\" | \"residual_append\"; parentEnabledRank: number }): boolean {\n if (!capabilities.supportedRanks.includes(rank)) return false;\n if (!continuation) return true;\n return continuation.mode === \"residual_append\"\n ? continuation.parentEnabledRank + rank <= capabilities.envelopeRank\n : continuation.parentEnabledRank === rank;\n}\n\nexport const TrainingCapabilitiesSchema = z\n .object({\n schemaVersion: z.literal(\"openpond.trainingCapabilities.v2\"),\n capabilityHash: HashSchema,\n jobKinds: z.array(TrainingJobKindSchema),\n methods: z.array(z.string().trim().min(1).max(200)),\n billingModes: TrainingBillingModesSchema.optional(),\n executionModes: z.array(z.enum([\"training\", \"qualification\"])).optional(),\n policyLora: TrainingPolicyLoraCapabilitiesSchema.optional(),\n supervisedTraining: z.array(TrainingSftImageCapabilitiesSchema).min(1).max(100).optional(),\n policyDataParallel: z.object({\n capability: z.literal(\"managed_rl.policy.data_parallel\"),\n version: z.literal(\"1\"),\n gpuCount: z.literal(2),\n worldSize: z.literal(2),\n backend: z.literal(\"nccl\"),\n allocationMode: z.literal(\"exclusive\"),\n workerImageDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n }).strict().optional(),\n structuredOutputs: z.object({\n capability: z.literal(\"work.structured-output.v1\"),\n harnessRuntimeHash: HashSchema,\n workHarnessHash: HashSchema,\n schemaHash: HashSchema,\n artifactHash: HashSchema,\n invalidDataRejected: z.literal(true),\n invalidBytesRejected: z.literal(true),\n }).strict().optional(),\n placements: z.array(z.enum([\"local\", \"remote\", \"colocated\", \"provider_native\"])),\n controls: z\n .object({\n cancel: z.boolean(),\n stopAfterGroup: z.boolean(),\n resumeFromCheckpoint: z.boolean(),\n })\n .strict(),\n estimates: z.object({ schemaVersion: z.literal(\"openpond.trainingEstimate.v1\") }).strict().optional(),\n limits: z\n .object({\n maximumSpendUsd: z.number().nonnegative(),\n maximumWallSeconds: z.number().int().positive(),\n maximumArtifactBytes: z.number().int().positive(),\n })\n .strict(),\n checkedAt: TimestampSchema,\n expiresAt: TimestampSchema,\n })\n .strict();\n\nexport type TrainingJobSubmission = z.infer<typeof TrainingJobSubmissionSchema>;\nexport type TrainingQualificationEvidence = z.infer<typeof TrainingQualificationEvidenceSchema>;\nexport type TrainingInputArtifactUpload = z.infer<typeof TrainingInputArtifactUploadSchema>;\nexport type TrainingInputArtifact = z.infer<typeof TrainingInputArtifactSchema>;\nexport type TrainingJob = z.infer<typeof TrainingJobSchema>;\nexport type TrainingJobPage = z.infer<typeof TrainingJobPageSchema>;\nexport type TrainingJobEvent = z.infer<typeof TrainingJobEventSchema>;\nexport type TrainingJobLog = z.infer<typeof TrainingJobLogSchema>;\nexport type TrainingJobOutput = z.infer<typeof TrainingJobOutputSchema>;\nexport type TrainingJobOutputs = z.infer<typeof TrainingJobOutputsSchema>;\nexport type TrainingExecutionReceipt = z.infer<typeof TrainingExecutionReceiptSchema>;\nexport type TrainingCapabilities = z.infer<typeof TrainingCapabilitiesSchema>;\n","import { z } from \"zod\";\nimport { compileBoundGraders, RewardBindingSchema, RewardReleaseSchema } from \"@openpond/evals/rewards\";\nimport { canonicalSha256 } from \"./protocol.js\";\n\nconst GradersSchema = z.array(z.object({ id: z.string().trim().min(1) }).catchall(z.unknown())).min(1).max(1_000);\nconst RewardExecutionSchema = z.object({\n binding: RewardBindingSchema,\n rewards: z.array(RewardReleaseSchema).min(1).max(100),\n}).strict();\n\n/**\n * The grader reference identifies the entire executed set, including order and\n * configuration. A bound plan additionally identifies its immutable composer,\n * whose sources pin roles, normalization, gates and required-score semantics.\n * Callers must obtain these inputs from their verified immutable bundle.\n */\nexport async function deterministicTrainingRewardSource(input: {\n graders: unknown;\n rewardExecution?: unknown;\n}) {\n const execution = input.rewardExecution ? RewardExecutionSchema.parse(input.rewardExecution) : null;\n const graders = GradersSchema.parse(execution\n ? compileBoundGraders(execution.binding, execution.rewards)\n : input.graders);\n if (new Set(graders.map(grader => grader.id)).size !== graders.length) {\n throw new Error(\"Training grader identities must be unique.\");\n }\n const hash = await canonicalSha256({ schemaVersion: \"openpond.trainingGraderSet.v1\", graders });\n return {\n kind: \"deterministic\" as const,\n grader: { id: `training-graders-${hash.slice(0, 32)}`, contentHash: hash },\n composer: execution ? { id: execution.binding.id, contentHash: execution.binding.contentHash } : null,\n };\n}\n","import { z } from \"zod\";\nimport { ModelProjectVersionedRefSchema } from \"./model-projects.js\";\nimport { canonicalSha256 } from \"./protocol.js\";\n\nexport const TRAINING_EVALUATION_SOURCE_PATH = \"evaluation-source.json\";\n\nconst TaskIdentitySchema = z.object({\n id: z.string().trim().min(1),\n clusterKey: z.string().trim().min(1),\n split: z.enum([\"train\", \"validation\", \"frozen_eval\"]),\n}).passthrough();\n\n/** Evaluator-only payload. The enclosing resolved bundle pins every byte. */\nexport const TrainingEvaluationSourceSchema = z.object({\n schemaVersion: z.literal(\"openpond.trainingEvaluationSource.v1\"),\n taskset: ModelProjectVersionedRefSchema,\n tasks: z.array(TaskIdentitySchema).min(1).max(10_000),\n assets: z.array(z.object({\n path: z.string().trim().min(1).max(2_000),\n sha256: z.string().regex(/^[a-f0-9]{64}$/),\n sizeBytes: z.number().int().nonnegative(),\n encoding: z.literal(\"base64\"),\n content: z.string().max(32 * 1024 * 1024),\n }).strict()).max(10_000),\n}).strict().superRefine((source, context) => {\n const ids = new Set<string>();\n source.tasks.forEach((task, index) => {\n if (task.split === \"train\") context.addIssue({ code: \"custom\", path: [\"tasks\", index, \"split\"], message: \"Evaluation sources require held-out tasks.\" });\n if (ids.has(task.id)) context.addIssue({ code: \"custom\", path: [\"tasks\", index, \"id\"], message: \"Evaluation task identities must be unique.\" });\n ids.add(task.id);\n });\n});\n\nexport type TrainingEvaluationSource = z.infer<typeof TrainingEvaluationSourceSchema>;\n\nexport function assertTrainingEvaluationIsolation(trainingTasks: unknown, evaluationTasks: unknown): void {\n const training = z.array(TaskIdentitySchema).min(1).max(10_000).parse(trainingTasks);\n const evaluation = z.array(TaskIdentitySchema).min(1).max(10_000).parse(evaluationTasks);\n const trainIds = new Set<string>();\n const trainFamilies = new Set<string>();\n for (const task of training) {\n if (task.split !== \"train\") throw new Error(\"The training population contains a held-out task.\");\n if (trainIds.has(task.id)) throw new Error(\"Training task identities must be unique.\");\n trainIds.add(task.id);\n trainFamilies.add(task.clusterKey);\n }\n const evaluationIds = new Set<string>();\n for (const task of evaluation) {\n if (task.split === \"train\") throw new Error(\"The evaluation population contains a training task.\");\n if (evaluationIds.has(task.id)) throw new Error(\"Evaluation task identities must be unique.\");\n if (trainIds.has(task.id) || trainFamilies.has(task.clusterKey)) {\n throw new Error(\"Training and evaluation tasks or families overlap.\");\n }\n evaluationIds.add(task.id);\n }\n}\n\nexport async function trainingEvaluationSourceRef(input: unknown) {\n const source = TrainingEvaluationSourceSchema.parse(input);\n const hash = await canonicalSha256(source);\n return { taskset: source.taskset, dataset: { id: `training-evaluation-${hash.slice(0, 32)}`, contentHash: hash } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAGlB,IAAM,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB;AAC9C,IAAM,QAAQ,EAAE,OAAO,EAAE,MAAM,4BAA4B,EAAE,IAAI,EAAE;AACnE,IAAM,SAAS,CAAC,UAAiB;AAC/B,QAAM,CAAC,OAAM,WAAS,EAAE,IAAI,MAAM,MAAM,KAAK,EAAE,MAAM,GAAG;AACxD,SAAO,OAAO,KAAM,IAAE,WAAW,OAAO,SAAS,OAAO,GAAE,GAAG,CAAC;AAChE;AAIO,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,eAAc,EAAE,QAAQ,iCAAiC;AAAA,EACzD,SAAQ,EAAE,OAAO,EAAE,IA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QAAMC,QAAO,MAAM,gBAAgB,MAAM;AACzC,SAAO,EAAE,SAAS,OAAO,SAAS,SAAS,EAAE,IAAI,uBAAuBA,MAAK,MAAM,GAAG,EAAE,CAAC,IAAI,aAAaA,MAAK,EAAE;AACnH;","names":["z","z","Hash","micros","z","z","z","z","z","Money","z","z","z","z","hash","z","z","hash"]}
|
package/dist/training-bundle.js
CHANGED
package/dist/training.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
TrainingQualificationEvidenceSchema,
|
|
46
46
|
TrainingQueueStatusSchema,
|
|
47
47
|
TrainingUsageFundingRequestSchema,
|
|
48
|
+
TrainingUsageQualificationRefSchema,
|
|
48
49
|
TrainingUsageQuoteContentSchema,
|
|
49
50
|
TrainingUsageQuoteSchema,
|
|
50
51
|
TrainingUsageSnapshotSchema,
|
|
@@ -64,7 +65,7 @@ import {
|
|
|
64
65
|
trainingInputArtifactUploadHash,
|
|
65
66
|
trainingJobSubmissionHash,
|
|
66
67
|
verifyTrainingUsageQuote
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-KEG5QS7W.js";
|
|
68
69
|
import {
|
|
69
70
|
ManagedSftRecipeSchema,
|
|
70
71
|
SftRecipeSchema,
|
|
@@ -2053,6 +2054,13 @@ import { assertBoundedTaskJson as assertBoundedTaskJson4 } from "@openpond/evals
|
|
|
2053
2054
|
var NEURON_TRAINING_MAX_BYTES = 16777216;
|
|
2054
2055
|
var NEURON_TRAINING_UPSTREAM_REVISION = "8a55f3159f735eb0823d7a894f67f632bf568bb3";
|
|
2055
2056
|
var Hash16 = z20.string().regex(/^[a-f0-9]{64}$/);
|
|
2057
|
+
var NeuronTrainingParentArtifactReferenceSchema = z20.object({
|
|
2058
|
+
id: z20.string().trim().min(1).max(500),
|
|
2059
|
+
contentHash: Hash16,
|
|
2060
|
+
selectionHash: Hash16,
|
|
2061
|
+
payloadSha256: Hash16,
|
|
2062
|
+
mode: z20.literal("frozen_parent_fresh_residual_adam_v1")
|
|
2063
|
+
}).strict();
|
|
2056
2064
|
var NeuronTrainingCoordinateSchema = z20.object({
|
|
2057
2065
|
layer: z20.number().int().min(0).max(35),
|
|
2058
2066
|
neuron: z20.number().int().min(0).max(12287)
|
|
@@ -2075,7 +2083,7 @@ var NeuronTrainingDataReferenceSchema = z20.object({
|
|
|
2075
2083
|
}).strict();
|
|
2076
2084
|
var NeuronTrainingDataSchema = z20.object({
|
|
2077
2085
|
target: NeuronTrainingDataReferenceSchema,
|
|
2078
|
-
background: z20.array(NeuronTrainingDataReferenceSchema.extend({ domain: z20.string().trim().min(1).max(100) }).strict()).
|
|
2086
|
+
background: z20.array(NeuronTrainingDataReferenceSchema.extend({ domain: z20.string().trim().min(1).max(100) }).strict()).max(8),
|
|
2079
2087
|
preservation: NeuronTrainingDataReferenceSchema.nullable()
|
|
2080
2088
|
}).strict().superRefine((value, context) => {
|
|
2081
2089
|
if (new Set(value.background.map((row) => row.domain)).size !== value.background.length)
|
|
@@ -2099,14 +2107,15 @@ var NeuronTrainingRequestSchema = z20.object({
|
|
|
2099
2107
|
data: NeuronTrainingDataSchema,
|
|
2100
2108
|
selection: NeuronTrainingSelectionSchema,
|
|
2101
2109
|
training: NeuronTrainingSettingsSchema,
|
|
2102
|
-
|
|
2103
|
-
parentArtifact: z20.null()
|
|
2110
|
+
parentArtifact: NeuronTrainingParentArtifactReferenceSchema.nullable()
|
|
2104
2111
|
}).strict().superRefine((value, context) => {
|
|
2105
|
-
if (value.model.modelId !== "Qwen/Qwen3-8B" || value.model.revision !== "b968826d9c46dd6066d109eabc6255188de91218" || value.model.dtype !== "bfloat16" || value.model.hiddenSize !== 4096 || value.model.intermediateSizes.length !== 36 || value.model.intermediateSizes.some((size) => size !== 12288))
|
|
2112
|
+
if (value.model.modelId !== "Qwen/Qwen3-8B" || value.model.revision !== "b968826d9c46dd6066d109eabc6255188de91218" || value.model.dtype !== "bfloat16" || value.model.hiddenSize !== 4096 || value.model.intermediateSizes.length !== 36 || value.model.intermediateSizes.some((size) => size !== 12288) || value.model.adapter !== null)
|
|
2106
2113
|
context.addIssue({ code: "custom", path: ["model"], message: "Use the exact supported dense BF16 Qwen3-8B source identity." });
|
|
2107
2114
|
const preserve = value.training.preservationWeight > 0;
|
|
2108
2115
|
if (preserve !== (value.data.preservation !== null) || preserve !== value.training.preservationExamplesPerStep > 0)
|
|
2109
2116
|
context.addIssue({ code: "custom", path: ["training", "preservationWeight"], message: "Preservation data, weight and per-step work must be present together." });
|
|
2117
|
+
if (value.parentArtifact ? value.data.background.length !== 0 : value.data.background.length === 0)
|
|
2118
|
+
context.addIssue({ code: "custom", path: ["data", "background"], message: "Fresh selection requires reviewed background domains; inherited selection retains its parent observations without new selection data." });
|
|
2110
2119
|
});
|
|
2111
2120
|
var NeuronTrainingEncodingSchema = z20.object({
|
|
2112
2121
|
schemaVersion: z20.literal("openpond.neuronTrainingEncoding.v1"),
|
|
@@ -2219,13 +2228,13 @@ var close = (a, b) => Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.ab
|
|
|
2219
2228
|
async function parseAndVerifyNeuronTrainingSelection(raw, request) {
|
|
2220
2229
|
const value = NeuronTrainingSelectionResultSchema.parse(raw), { contentHash: contentHash2, ...content } = value;
|
|
2221
2230
|
const coordinates = value.entries.map(({ layer, neuron }) => ({ layer, neuron }));
|
|
2222
|
-
if (contentHash2 !== await canonicalSha256(content) || value.modelHash !== await canonicalSha256(request.model) || value.dataHash !== await canonicalSha256(request.data) || value.selectionConfigHash !== await canonicalSha256(request.selection) || value.entries.length !== request.selection.count || value.eligibleCount < value.entries.length || new Set(value.entries.map((row) => `${row.layer}:${row.neuron}`)).size !== value.entries.length || new Set(value.targetExampleIds).size !== value.targetExampleIds.length || value.targetExampleIds.length > request.selection.gradientExamples || value.source !== (request.selection.explicitCoordinates ? "explicit" : "automatic") || request.selection.explicitCoordinates && canonicalJson(coordinates) !== canonicalJson(request.selection.explicitCoordinates)) fail();
|
|
2231
|
+
if (contentHash2 !== await canonicalSha256(content) || value.modelHash !== await canonicalSha256(request.model) || (request.parentArtifact ? value.contentHash !== request.parentArtifact.selectionHash : value.dataHash !== await canonicalSha256(request.data)) || value.selectionConfigHash !== await canonicalSha256(request.selection) || value.entries.length !== request.selection.count || value.eligibleCount < value.entries.length || new Set(value.entries.map((row) => `${row.layer}:${row.neuron}`)).size !== value.entries.length || new Set(value.targetExampleIds).size !== value.targetExampleIds.length || value.targetExampleIds.length > request.selection.gradientExamples || value.source !== (request.selection.explicitCoordinates ? "explicit" : "automatic") || request.selection.explicitCoordinates && canonicalJson(coordinates) !== canonicalJson(request.selection.explicitCoordinates)) fail();
|
|
2223
2232
|
if (value.source === "automatic" && value.entries.some((row, index) => {
|
|
2224
2233
|
const previous = value.entries[index - 1];
|
|
2225
2234
|
return previous && (row.score > previous.score || row.score === previous.score && (row.layer < previous.layer || row.layer === previous.layer && row.neuron < previous.neuron));
|
|
2226
2235
|
})) fail();
|
|
2227
2236
|
for (const row of value.entries) {
|
|
2228
|
-
if (row.targetMeanAbsolute < row.targetActivityThreshold || row.backgroundTargetRatio > request.selection.maximumBackgroundTargetRatio + 1e-6 || !close(row.backgroundTargetRatio, row.backgroundMeanAbsolute / row.targetMeanAbsolute) || !close(row.score, row.gradientNorm / Math.max(row.backgroundMeanAbsolute, 1e-6)) || canonicalJson(row.backgroundByDomain.map((item) => item.domainIndex)) !== canonicalJson(request.data.background.
|
|
2237
|
+
if (row.targetMeanAbsolute < row.targetActivityThreshold || row.backgroundTargetRatio > request.selection.maximumBackgroundTargetRatio + 1e-6 || !close(row.backgroundTargetRatio, row.backgroundMeanAbsolute / row.targetMeanAbsolute) || !close(row.score, row.gradientNorm / Math.max(row.backgroundMeanAbsolute, 1e-6)) || canonicalJson(row.backgroundByDomain.map((item) => item.domainIndex)) !== canonicalJson(Array.from({ length: request.parentArtifact ? value.entries[0].backgroundByDomain.length : request.data.background.length }, (_item, index) => index))) fail();
|
|
2229
2238
|
const background = request.selection.backgroundStatistic === "max_domains" ? Math.max(...row.backgroundByDomain.map((item) => item.meanAbsolute)) : row.backgroundByDomain.reduce((sum, item) => sum + item.meanAbsolute, 0) / row.backgroundByDomain.length;
|
|
2230
2239
|
if (!close(background, row.backgroundMeanAbsolute)) fail();
|
|
2231
2240
|
}
|
|
@@ -2256,9 +2265,22 @@ var NeuronTrainingArtifactContentSchema = z21.object({
|
|
|
2256
2265
|
selectionConfigHash: Hash17,
|
|
2257
2266
|
trainingConfigHash: Hash17,
|
|
2258
2267
|
runtimeHash: Hash17,
|
|
2259
|
-
parentArtifactHash:
|
|
2268
|
+
parentArtifactHash: Hash17.nullable()
|
|
2260
2269
|
}).strict(),
|
|
2261
2270
|
selection: NeuronTrainingSelectionResultSchema,
|
|
2271
|
+
continuation: z21.object({
|
|
2272
|
+
mode: z21.literal("frozen_parent_fresh_residual_adam_v1"),
|
|
2273
|
+
selectionProvenance: z21.literal("inherited_parent_observations"),
|
|
2274
|
+
parameterAnchor: z21.literal("original_dense_base_columns_v1"),
|
|
2275
|
+
parentArtifactHash: Hash17,
|
|
2276
|
+
parentSelectionHash: Hash17,
|
|
2277
|
+
parentPayloadSha256: Hash17,
|
|
2278
|
+
parentPatchStateSha256: Hash17,
|
|
2279
|
+
initialPatchStateSha256: Hash17,
|
|
2280
|
+
finalPatchStateSha256: Hash17,
|
|
2281
|
+
installedBeforeOptimizer: z21.literal(true),
|
|
2282
|
+
optimizerState: z21.literal("fresh")
|
|
2283
|
+
}).strict().optional(),
|
|
2262
2284
|
payload: z21.object({
|
|
2263
2285
|
path: z21.literal("patch.safetensors"),
|
|
2264
2286
|
sha256: Hash17,
|
|
@@ -2272,7 +2294,9 @@ async function parseAndVerifyNeuronTrainingArtifact(raw, expected) {
|
|
|
2272
2294
|
const value = NeuronTrainingArtifactSchema.parse(raw), { contentHash: contentHash2, ...content } = value;
|
|
2273
2295
|
const request = await parseAndVerifyNeuronTrainingRequest(expected.request);
|
|
2274
2296
|
await parseAndVerifyNeuronTrainingSelection(value.selection, request);
|
|
2275
|
-
if (contentHash2 !== await canonicalSha256(content) || canonicalJson(value.pins.baseModel) !== canonicalJson(request.model) || canonicalJson(value.pins.data) !== canonicalJson(request.data) || value.pins.inputHash !== await canonicalSha256(request) || value.pins.dataHash !== await canonicalSha256(request.data) || value.pins.selectionConfigHash !== await canonicalSha256(request.selection) || value.pins.trainingConfigHash !== await canonicalSha256(request.training) || value.pins.runtimeHash !== expected.runtimeHash || canonicalJson(value.payload.tensors) !== canonicalJson(neuronTrainingPatchTensorInventory(value.selection)) || value.payload.sizeBytes > request.training.maxCheckpointBytes) fail();
|
|
2297
|
+
if (contentHash2 !== await canonicalSha256(content) || canonicalJson(value.pins.baseModel) !== canonicalJson(request.model) || canonicalJson(value.pins.data) !== canonicalJson(request.data) || value.pins.inputHash !== await canonicalSha256(request) || value.pins.dataHash !== await canonicalSha256(request.data) || value.pins.selectionConfigHash !== await canonicalSha256(request.selection) || value.pins.trainingConfigHash !== await canonicalSha256(request.training) || value.pins.runtimeHash !== expected.runtimeHash || value.pins.parentArtifactHash !== (request.parentArtifact?.contentHash ?? null) || canonicalJson(value.payload.tensors) !== canonicalJson(neuronTrainingPatchTensorInventory(value.selection)) || value.payload.sizeBytes > request.training.maxCheckpointBytes) fail();
|
|
2298
|
+
const continuation = value.continuation, parent = request.parentArtifact;
|
|
2299
|
+
if (parent ? !continuation || continuation.parentArtifactHash !== parent.contentHash || continuation.parentSelectionHash !== parent.selectionHash || continuation.parentPayloadSha256 !== parent.payloadSha256 || continuation.parentPatchStateSha256 !== continuation.initialPatchStateSha256 || continuation.finalPatchStateSha256 === continuation.initialPatchStateSha256 : continuation !== void 0) fail();
|
|
2276
2300
|
return value;
|
|
2277
2301
|
}
|
|
2278
2302
|
|
|
@@ -2332,7 +2356,7 @@ async function parseAndVerifyNeuronTrainingResult(raw, expected) {
|
|
|
2332
2356
|
const value = NeuronTrainingResultSchema.parse(raw), { contentHash: contentHash2, ...content } = value;
|
|
2333
2357
|
const manifest = await parseAndVerifyNeuronTrainingArtifact(value.artifact.manifest, { request, runtimeHash: expected.runtimeHash });
|
|
2334
2358
|
const tensor = value.artifact.files.find((row) => row.path === "patch.safetensors"), metadata = value.artifact.files.find((row) => row.path === "manifest.json");
|
|
2335
|
-
if (contentHash2 !== await canonicalSha256(content) || value.inputHash !== await canonicalSha256(request) || value.modelHash !== await canonicalSha256(request.model) || value.dataHash !== await canonicalSha256(request.data) || value.runtimeHash !== expected.runtimeHash || value.preparedRowsHash !== value.selection.preparedRowsHash || canonicalJson(value.selection) !== canonicalJson(manifest.selection) || value.artifact.contentHash !== manifest.contentHash || value.baseWeightsHashBefore !== request.model.weightsHash || value.baseWeightsHashAfter !== value.baseWeightsHashBefore || value.trainableParameterCount !== request.selection.count * (request.model.hiddenSize + 1) || value.optimizerSteps !== request.training.maxSteps || value.examplesProcessed !== value.optimizerSteps * request.training.gradientAccumulationSteps || value.durationMs > request.training.maxDurationSeconds * 1e3 || value.forwardTokenWork > request.training.maximumForwardTokenWork || value.forwardTokenWork !== Object.values(value.work).reduce((sum, work) => sum + work, 0) || value.backwardTokenWork !== value.work.selectionGradient + value.work.training + value.work.preservationEdited || value.targetTokens > value.work.training || value.work.selectionTarget <= 0 || value.work.selectionBackground <= 0 || value.work.selectionGradient !== value.work.selectionTarget || value.work.verification <= 0 || request.training.preservationWeight > 0 !== (value.meanPreservationKl !== null) || value.work.preservationOriginal !== value.work.preservationEdited || request.training.preservationWeight === 0 && (value.preservationTokens !== 0 || value.work.preservationOriginal !== 0) || request.training.preservationWeight > 0 && (value.preservationTokens <= 0 || value.work.preservationOriginal <= 0) || !tensor || !metadata || tensor.sha256 !== manifest.payload.sha256 || tensor.sizeBytes !== manifest.payload.sizeBytes || metadata.sha256 !== await canonicalSha256(manifest) || metadata.sizeBytes !== new TextEncoder().encode(canonicalJson(manifest)).byteLength || value.artifact.files.some((row) => row.artifactId !== value.artifact.id) || value.artifact.files.reduce((sum, row) => sum + row.sizeBytes, 0) > request.training.maxCheckpointBytes)
|
|
2359
|
+
if (contentHash2 !== await canonicalSha256(content) || value.inputHash !== await canonicalSha256(request) || value.modelHash !== await canonicalSha256(request.model) || value.dataHash !== await canonicalSha256(request.data) || value.runtimeHash !== expected.runtimeHash || !request.parentArtifact && value.preparedRowsHash !== value.selection.preparedRowsHash || canonicalJson(value.selection) !== canonicalJson(manifest.selection) || value.artifact.contentHash !== manifest.contentHash || value.baseWeightsHashBefore !== request.model.weightsHash || value.baseWeightsHashAfter !== value.baseWeightsHashBefore || value.trainableParameterCount !== request.selection.count * (request.model.hiddenSize + 1) || value.optimizerSteps !== request.training.maxSteps || value.examplesProcessed !== value.optimizerSteps * request.training.gradientAccumulationSteps || value.durationMs > request.training.maxDurationSeconds * 1e3 || value.forwardTokenWork > request.training.maximumForwardTokenWork || value.forwardTokenWork !== Object.values(value.work).reduce((sum, work) => sum + work, 0) || value.backwardTokenWork !== value.work.selectionGradient + value.work.training + value.work.preservationEdited || value.targetTokens > value.work.training || (request.parentArtifact ? value.work.selectionTarget !== 0 || value.work.selectionBackground !== 0 || value.work.selectionGradient !== 0 : value.work.selectionTarget <= 0 || value.work.selectionBackground <= 0) || value.work.selectionGradient !== value.work.selectionTarget || value.work.verification <= 0 || request.training.preservationWeight > 0 !== (value.meanPreservationKl !== null) || value.work.preservationOriginal !== value.work.preservationEdited || request.training.preservationWeight === 0 && (value.preservationTokens !== 0 || value.work.preservationOriginal !== 0) || request.training.preservationWeight > 0 && (value.preservationTokens <= 0 || value.work.preservationOriginal <= 0) || !tensor || !metadata || tensor.sha256 !== manifest.payload.sha256 || tensor.sizeBytes !== manifest.payload.sizeBytes || metadata.sha256 !== await canonicalSha256(manifest) || metadata.sizeBytes !== new TextEncoder().encode(canonicalJson(manifest)).byteLength || value.artifact.files.some((row) => row.artifactId !== value.artifact.id) || value.artifact.files.reduce((sum, row) => sum + row.sizeBytes, 0) > request.training.maxCheckpointBytes)
|
|
2336
2360
|
throw new OpenPondProtocolError("neuron_training_result_mismatch", "The selective neuron result differs from its exact run, measured work, frozen base or committed learned patch.");
|
|
2337
2361
|
return value;
|
|
2338
2362
|
}
|
|
@@ -2678,7 +2702,8 @@ var NeuronTrainingExperimentFormDraftSchema = z26.object({
|
|
|
2678
2702
|
maximumSpendUsd: Field3,
|
|
2679
2703
|
selection: NeuronTrainingSelectionFormDraftSchema,
|
|
2680
2704
|
training: NeuronTrainingSettingsFormDraftSchema,
|
|
2681
|
-
parentArtifact:
|
|
2705
|
+
parentArtifact: NeuronTrainingParentArtifactReferenceSchema.nullable(),
|
|
2706
|
+
startingModule: SavedNeuronTrainingExperimentSourceSchema.optional(),
|
|
2682
2707
|
inspectionSource: NeuronTrainingInspectionSourceSchema.optional()
|
|
2683
2708
|
}).strict();
|
|
2684
2709
|
function newNeuronTrainingExperimentForm(baseModel = null) {
|
|
@@ -3090,6 +3115,17 @@ var TrainingPreparationPageSchema = z29.object({
|
|
|
3090
3115
|
items: z29.array(TrainingPreparationReceiptSchema).max(100),
|
|
3091
3116
|
nextCursor: Id19.nullable()
|
|
3092
3117
|
}).strict();
|
|
3118
|
+
var TrainingSftQualificationPreparationImportSchema = z29.object({
|
|
3119
|
+
schemaVersion: z29.literal("openpond.trainingSftQualificationPreparationImport.v1"),
|
|
3120
|
+
preparationId: Id19,
|
|
3121
|
+
qualification: TrainingUsageQualificationRefSchema,
|
|
3122
|
+
request: TrainingPreparationRequestSchema,
|
|
3123
|
+
submission: TrainingJobSubmissionSchema
|
|
3124
|
+
}).strict().superRefine((value, context) => {
|
|
3125
|
+
const { request, submission } = value;
|
|
3126
|
+
if (submission.job.kind !== "policy_optimize" || submission.job.recipe.method !== "sft" || submission.job.executionMode !== void 0 || submission.job.resumeFrom || request.parent || request.physicalPlacement || submission.physicalPlacement || (request.gpuSelection?.gpuCount ?? 1) !== 1 || (submission.gpuSelection?.gpuCount ?? 1) !== 1 || !request.usageFunding || request.usageFunding.customerCapUsd === null || submission.idempotencyKey !== `manual:${value.preparationId}` || submission.source.modelProject.id !== request.configuration.id || submission.name !== request.name || submission.budget.maximumSpendUsd !== request.maximumSpendUsd)
|
|
3127
|
+
context.addIssue({ code: "custom", message: "Qualification import requires an exact fresh single-GPU SFT preparation with finite whole-job pricing." });
|
|
3128
|
+
});
|
|
3093
3129
|
async function parseAndVerifyTrainingPreparationReceipt(value) {
|
|
3094
3130
|
const receipt2 = TrainingPreparationReceiptSchema.parse(value);
|
|
3095
3131
|
const { contentHash: contentHash2, ...plan } = receipt2.plan;
|
|
@@ -3123,6 +3159,22 @@ function createTrainingPreparationClient(request) {
|
|
|
3123
3159
|
return receipt2;
|
|
3124
3160
|
}
|
|
3125
3161
|
return {
|
|
3162
|
+
/** Preparation only: retains the original source and accepted usage quote;
|
|
3163
|
+
* starting paid compute still requires startPreparation separately. */
|
|
3164
|
+
async importSftQualificationPreparation(input) {
|
|
3165
|
+
const parsed = TrainingSftQualificationPreparationImportSchema.parse(input);
|
|
3166
|
+
await parseAndVerifyTrainingJobSubmission(parsed.submission);
|
|
3167
|
+
const receipt2 = await read(await request("/v1/training/preparations/import-sft-qualification", {
|
|
3168
|
+
method: "POST",
|
|
3169
|
+
body: JSON.stringify(parsed)
|
|
3170
|
+
}), parsed.request.teamId, parsed.preparationId);
|
|
3171
|
+
if (receipt2.plan.requestHash !== await canonicalSha256(parsed.request) || receipt2.plan.submissionHash !== parsed.submission.contentHash || await canonicalSha256(receipt2.plan.source) !== await canonicalSha256(parsed.submission.source) || receipt2.plan.usageQuote?.maximumWallSeconds !== parsed.submission.budget.maximumWallSeconds || receipt2.plan.usageQuote?.retentionDays !== parsed.submission.approval.retentionDays || await canonicalSha256(receipt2.plan.usageQuote?.qualification ?? null) !== await canonicalSha256(parsed.qualification))
|
|
3172
|
+
throw new OpenPondProtocolError(
|
|
3173
|
+
"training_qualification_preparation_mismatch",
|
|
3174
|
+
"The imported preparation differs from the reviewed source or qualification authority."
|
|
3175
|
+
);
|
|
3176
|
+
return receipt2;
|
|
3177
|
+
},
|
|
3126
3178
|
/** Discover the authenticated user's retained preparations without creating jobs. */
|
|
3127
3179
|
async listPreparations(teamId, input = {}) {
|
|
3128
3180
|
const scope2 = Id19.parse(teamId);
|
|
@@ -3645,13 +3697,18 @@ var ExperimentDraftSchema = z36.object({
|
|
|
3645
3697
|
context.addIssue({ code: "custom", path: ["startingModel"], message: "Retain the saved AlphaEdit Model rather than substituting its original base." });
|
|
3646
3698
|
}
|
|
3647
3699
|
if (draft.operationType === "selective_neuron_training" && source) {
|
|
3648
|
-
if (source.source !== "managed")
|
|
3649
|
-
context.addIssue({ code: "custom", path: ["startingModel"], message: "Neuron training
|
|
3700
|
+
if (source.source !== "managed" && source.source !== "neuron_training")
|
|
3701
|
+
context.addIssue({ code: "custom", path: ["startingModel"], message: "Neuron training requires its exact dense base or compatible saved neuron patch." });
|
|
3650
3702
|
else if (draft.neuronTrainingForm?.baseModel && canonicalJson(source.baseModel) !== canonicalJson(draft.neuronTrainingForm.baseModel))
|
|
3651
3703
|
context.addIssue({ code: "custom", path: ["neuronTrainingForm", "baseModel"], message: "Retain the selected exact neuron-training base." });
|
|
3652
3704
|
}
|
|
3653
|
-
if (source?.source === "neuron_training")
|
|
3654
|
-
|
|
3705
|
+
if (source?.source === "neuron_training") {
|
|
3706
|
+
const form = draft.neuronTrainingForm;
|
|
3707
|
+
if (draft.operationType !== "selective_neuron_training" || !form || canonicalJson(form.baseModel) !== canonicalJson(source.baseModel) || canonicalJson(form.startingModule ?? null) !== canonicalJson(source.neuronTraining) || form.parentArtifact?.id !== source.neuronTraining.artifact.id || form.parentArtifact?.contentHash !== source.neuronTraining.artifact.contentHash)
|
|
3708
|
+
context.addIssue({ code: "custom", path: ["neuronTrainingForm"], message: "Retain the exact saved neuron Model and cumulative patch for continuation." });
|
|
3709
|
+
} else if (draft.neuronTrainingForm?.startingModule) {
|
|
3710
|
+
context.addIssue({ code: "custom", path: ["startingModel"], message: "Retain the saved neuron Model rather than substituting its ancestor base." });
|
|
3711
|
+
}
|
|
3655
3712
|
if (draft.decisionForm && draft.operationType !== "decision_model")
|
|
3656
3713
|
context.addIssue({ code: "custom", path: ["decisionForm"], message: "Decision settings require a decision-model experiment." });
|
|
3657
3714
|
if (draft.operationType === "decision_model" && source) {
|
|
@@ -4965,6 +5022,7 @@ var NeuronTrainingExecutionCapabilityContentSchema = z43.object({
|
|
|
4965
5022
|
z43.object({
|
|
4966
5023
|
state: z43.literal("ready"),
|
|
4967
5024
|
model: NeuronSteeringModelSchema,
|
|
5025
|
+
continuation: z43.literal("frozen_parent_fresh_residual_adam_v1").optional(),
|
|
4968
5026
|
runtime: z43.object({
|
|
4969
5027
|
id: Id27,
|
|
4970
5028
|
releaseHash: Hash32,
|
|
@@ -5083,8 +5141,9 @@ function parseNeuronTrainingFormSelection(form) {
|
|
|
5083
5141
|
});
|
|
5084
5142
|
}
|
|
5085
5143
|
async function checkForm4(form, request) {
|
|
5086
|
-
if (!form.baseModel || form.baseModel.modelId !== request.model.modelId || form.baseModel.revision !== request.model.revision || canonicalJson(form.targetBatch) !== canonicalJson(request.data.target.batch) || canonicalJson(form.background.map((row) => ({ domain: row.domain.trim(), batch: row.batch }))) !== canonicalJson(request.data.background.map((row) => ({ domain: row.domain, batch: row.batch }))) || canonicalJson(form.preservationBatch) !== canonicalJson(request.data.preservation?.batch ?? null) || canonicalJson(parseNeuronTrainingFormSelection(form.selection)) !== canonicalJson(request.selection) || canonicalJson(parseNeuronTrainingFormTraining(form.training)) !== canonicalJson(request.training)) fail6();
|
|
5087
|
-
if (form.
|
|
5144
|
+
if (!form.baseModel || form.baseModel.modelId !== request.model.modelId || form.baseModel.revision !== request.model.revision || canonicalJson(form.targetBatch) !== canonicalJson(request.data.target.batch) || canonicalJson(form.background.map((row) => ({ domain: row.domain.trim(), batch: row.batch }))) !== canonicalJson(request.data.background.map((row) => ({ domain: row.domain, batch: row.batch }))) || canonicalJson(form.preservationBatch) !== canonicalJson(request.data.preservation?.batch ?? null) || canonicalJson(form.parentArtifact) !== canonicalJson(request.parentArtifact) || canonicalJson(parseNeuronTrainingFormSelection(form.selection)) !== canonicalJson(request.selection) || canonicalJson(parseNeuronTrainingFormTraining(form.training)) !== canonicalJson(request.training)) fail6();
|
|
5145
|
+
if (form.startingModule && (!request.parentArtifact || canonicalJson(form.startingModule.artifact) !== canonicalJson({ id: request.parentArtifact.id, contentHash: request.parentArtifact.contentHash }) || form.startingModule.modelHash !== await canonicalSha256(request.model))) fail6();
|
|
5146
|
+
if (form.inspectionSource && (request.parentArtifact !== null || !request.selection.explicitCoordinates || form.inspectionSource.modelHash !== await canonicalSha256(request.model))) fail6();
|
|
5088
5147
|
}
|
|
5089
5148
|
function checkFormQuery3(form, query) {
|
|
5090
5149
|
const base = {
|
|
@@ -5874,6 +5933,38 @@ async function experimentStartingModelFromNeuronTrainingVersion(raw, expected) {
|
|
|
5874
5933
|
if (source.source !== "neuron_training") throw new OpenPondProtocolError("neuron_training_experiment_source_mismatch", "Retain the exact saved neuron weights.");
|
|
5875
5934
|
return source;
|
|
5876
5935
|
}
|
|
5936
|
+
async function neuronTrainingFormFromModelVersion(form, raw, expected = {}) {
|
|
5937
|
+
const current = NeuronTrainingExperimentFormDraftSchema.parse(form);
|
|
5938
|
+
const { inspectionSource: _inspectionSource, ...draft } = current;
|
|
5939
|
+
const version = await parseAndVerifyNeuronTrainingModelVersion(raw, expected), selection = version.request.selection;
|
|
5940
|
+
return NeuronTrainingExperimentFormDraftSchema.parse({
|
|
5941
|
+
...draft,
|
|
5942
|
+
baseModel: version.baseModel,
|
|
5943
|
+
targetBatch: null,
|
|
5944
|
+
background: [],
|
|
5945
|
+
selection: {
|
|
5946
|
+
count: String(selection.count),
|
|
5947
|
+
span: selection.span,
|
|
5948
|
+
backgroundStatistic: selection.backgroundStatistic,
|
|
5949
|
+
maximumBackgroundTargetRatio: String(selection.maximumBackgroundTargetRatio),
|
|
5950
|
+
gradientExamples: String(selection.gradientExamples),
|
|
5951
|
+
coordinates: selection.explicitCoordinates?.map((row) => `${row.layer}:${row.neuron}`).join("\n") ?? ""
|
|
5952
|
+
},
|
|
5953
|
+
parentArtifact: {
|
|
5954
|
+
id: version.artifact.id,
|
|
5955
|
+
contentHash: version.artifact.contentHash,
|
|
5956
|
+
selectionHash: version.artifact.manifest.selection.contentHash,
|
|
5957
|
+
payloadSha256: version.artifact.manifest.payload.sha256,
|
|
5958
|
+
mode: "frozen_parent_fresh_residual_adam_v1"
|
|
5959
|
+
},
|
|
5960
|
+
startingModule: {
|
|
5961
|
+
modelProjectId: version.modelProjectId,
|
|
5962
|
+
versionHash: version.contentHash,
|
|
5963
|
+
artifact: { id: version.artifact.id, contentHash: version.artifact.contentHash },
|
|
5964
|
+
modelHash: await canonicalSha256(version.request.model)
|
|
5965
|
+
}
|
|
5966
|
+
});
|
|
5967
|
+
}
|
|
5877
5968
|
|
|
5878
5969
|
// src/engram-experiment-authoring.ts
|
|
5879
5970
|
async function experimentStartingModelFromEngramVersion(raw, expected) {
|
|
@@ -8368,6 +8459,7 @@ export {
|
|
|
8368
8459
|
NeuronTrainingModelServingSchema,
|
|
8369
8460
|
NeuronTrainingModelVersionContentSchema,
|
|
8370
8461
|
NeuronTrainingModelVersionSchema,
|
|
8462
|
+
NeuronTrainingParentArtifactReferenceSchema,
|
|
8371
8463
|
NeuronTrainingPatchTensorSchema,
|
|
8372
8464
|
NeuronTrainingRequestSchema,
|
|
8373
8465
|
NeuronTrainingResultContentSchema,
|
|
@@ -8551,7 +8643,9 @@ export {
|
|
|
8551
8643
|
TrainingServingRegistrySchema,
|
|
8552
8644
|
TrainingServingVersionSchema,
|
|
8553
8645
|
TrainingSftImageCapabilitiesSchema,
|
|
8646
|
+
TrainingSftQualificationPreparationImportSchema,
|
|
8554
8647
|
TrainingUsageFundingRequestSchema,
|
|
8648
|
+
TrainingUsageQualificationRefSchema,
|
|
8555
8649
|
TrainingUsageQuoteContentSchema,
|
|
8556
8650
|
TrainingUsageQuoteSchema,
|
|
8557
8651
|
TrainingUsageSnapshotSchema,
|
|
@@ -8633,6 +8727,7 @@ export {
|
|
|
8633
8727
|
managedServingUsageApprovalMatches,
|
|
8634
8728
|
neuronTrainingAlgorithm,
|
|
8635
8729
|
neuronTrainingEncoding,
|
|
8730
|
+
neuronTrainingFormFromModelVersion,
|
|
8636
8731
|
neuronTrainingModelServingState,
|
|
8637
8732
|
neuronTrainingPatchTensorInventory,
|
|
8638
8733
|
newAlphaEditExperimentForm,
|