mlboydaisuke's picture
Multifunction chunks: SDPA decode + N=512 prefill, 50% weight dedup
d445d15 verified
[
{
"metadataOutputVersion" : "3.0",
"storagePrecision" : "Mixed (Float16, Palettized (10 bits), Palettized (11 bits), Palettized (13 bits), Palettized (17 bits), Palettized (7 bits), UInt4)",
"outputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Int32",
"formattedType" : "MultiArray (Int32 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_id",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_logit",
"type" : "MultiArray"
}
],
"modelParameters" : [
],
"specificationVersion" : 9,
"functions" : [
{
"inputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1536)",
"shortDescription" : "",
"shape" : "[1, 1, 1536]",
"name" : "hidden_states",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 2048)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 2048]",
"name" : "causal_mask_full",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "causal_mask_sliding",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 1)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 1]",
"name" : "update_mask",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 8960)",
"shortDescription" : "",
"shape" : "[1, 1, 8960]",
"name" : "per_layer_combined",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 256]",
"name" : "cos_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 256]",
"name" : "sin_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "cos_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "sin_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_v",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 512]",
"name" : "kv14_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 512]",
"name" : "kv14_v",
"type" : "MultiArray"
}
],
"computePrecision" : "Mixed (Float16, Int32)",
"storagePrecision" : "Mixed (Float16, Palettized (10 bits), Palettized (11 bits), Palettized (13 bits), Palettized (17 bits), Palettized (7 bits), UInt4)",
"stateSchema" : [
],
"outputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Int32",
"formattedType" : "MultiArray (Int32 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_id",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_logit",
"type" : "MultiArray"
}
],
"name" : "decode",
"mlProgramOperationTypeHistogram" : {
"Ios18.constexprLutToDense" : 71,
"Identity" : 1,
"Ios18.scaledDotProductAttention" : 10,
"Ios18.expandDims" : 41,
"Ios18.conv" : 71,
"Ios18.reduceArgmax" : 1,
"Ios18.gelu" : 20,
"Ios18.concat" : 71,
"Ios18.add" : 40,
"Ios18.tanh" : 1,
"Ios18.sliceByIndex" : 10,
"Tile" : 4,
"Ios18.transpose" : 114,
"Ios18.layerNorm" : 61,
"Ios18.squeeze" : 22,
"Ios18.reshape" : 48,
"Split" : 71,
"Ios18.gatherAlongAxis" : 1,
"Ios18.mul" : 184
}
},
{
"inputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 512 × 1536)",
"shortDescription" : "",
"shape" : "[1, 512, 1536]",
"name" : "hidden_states",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 512]",
"name" : "causal_mask",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 512 × 8960)",
"shortDescription" : "",
"shape" : "[1, 512, 8960]",
"name" : "per_layer_combined",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "cos_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "sin_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 512]",
"name" : "cos_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 512]",
"name" : "sin_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_v",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 512]",
"name" : "kv14_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 512]",
"name" : "kv14_v",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 512 × 1)",
"shortDescription" : "",
"shape" : "[1, 512, 1]",
"name" : "last_position_mask",
"type" : "MultiArray"
}
],
"computePrecision" : "Mixed (Float16, Int32)",
"storagePrecision" : "Mixed (Float16, Palettized (10 bits), Palettized (11 bits), Palettized (13 bits), Palettized (17 bits), Palettized (7 bits), UInt4)",
"stateSchema" : [
],
"outputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Int32",
"formattedType" : "MultiArray (Int32 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_id",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1)",
"shortDescription" : "",
"shape" : "[1]",
"name" : "token_logit",
"type" : "MultiArray"
}
],
"name" : "prefill",
"mlProgramOperationTypeHistogram" : {
"Ios18.constexprLutToDense" : 71,
"Ios18.gatherAlongAxis" : 1,
"Ios18.scaledDotProductAttention" : 10,
"Ios18.expandDims" : 41,
"Ios18.conv" : 71,
"Ios18.reduceArgmax" : 1,
"Ios18.gelu" : 20,
"Ios18.concat" : 71,
"Ios18.add" : 40,
"Ios18.tanh" : 1,
"Ios18.sliceByIndex" : 10,
"Tile" : 4,
"Ios18.transpose" : 124,
"Ios18.layerNorm" : 61,
"Ios18.squeeze" : 22,
"Ios18.reshape" : 48,
"Split" : 71,
"Ios16.reduceSum" : 1,
"Ios18.mul" : 185
}
}
],
"mlProgramOperationTypeHistogram" : {
"Ios18.constexprLutToDense" : 71,
"Identity" : 1,
"Ios18.scaledDotProductAttention" : 10,
"Ios18.expandDims" : 41,
"Ios18.conv" : 71,
"Ios18.reduceArgmax" : 1,
"Ios18.gelu" : 20,
"Ios18.concat" : 71,
"Ios18.add" : 40,
"Ios18.tanh" : 1,
"Ios18.sliceByIndex" : 10,
"Tile" : 4,
"Ios18.transpose" : 114,
"Ios18.layerNorm" : 61,
"Ios18.squeeze" : 22,
"Ios18.reshape" : 48,
"Split" : 71,
"Ios18.gatherAlongAxis" : 1,
"Ios18.mul" : 184
},
"isUpdatable" : "0",
"stateSchema" : [
],
"availability" : {
"macOS" : "15.0",
"tvOS" : "18.0",
"visionOS" : "2.0",
"watchOS" : "11.0",
"iOS" : "18.0",
"macCatalyst" : "18.0"
},
"computePrecision" : "Mixed (Float16, Int32)",
"modelType" : {
"name" : "MLModelType_mlProgram"
},
"inputSchema" : [
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1536)",
"shortDescription" : "",
"shape" : "[1, 1, 1536]",
"name" : "hidden_states",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 2048)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 2048]",
"name" : "causal_mask_full",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "causal_mask_sliding",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 1)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 1]",
"name" : "update_mask",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 8960)",
"shortDescription" : "",
"shape" : "[1, 1, 8960]",
"name" : "per_layer_combined",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 256]",
"name" : "cos_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 256]",
"name" : "sin_s",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "cos_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 1 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 1, 512]",
"name" : "sin_f",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 512 × 256)",
"shortDescription" : "",
"shape" : "[1, 1, 512, 256]",
"name" : "kv13_v",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 512]",
"name" : "kv14_k",
"type" : "MultiArray"
},
{
"hasShapeFlexibility" : "0",
"isOptional" : "0",
"dataType" : "Float16",
"formattedType" : "MultiArray (Float16 1 × 1 × 2048 × 512)",
"shortDescription" : "",
"shape" : "[1, 1, 2048, 512]",
"name" : "kv14_v",
"type" : "MultiArray"
}
],
"defaultFunctionName" : "decode",
"generatedClassName" : "chunk4",
"userDefinedMetadata" : {
},
"method" : "predict"
}
]