79 lines
4.1 KiB
Go
79 lines
4.1 KiB
Go
package domain
|
|
|
|
// Qwen3-Embedding-0.6B at the pinned revision with the service prompt recipe
|
|
// (the model's own query prompt, last-token pooling); the ML service reports
|
|
// the same identity.
|
|
const (
|
|
Qwen3EmbeddingModelID = "Qwen/Qwen3-Embedding-0.6B"
|
|
Qwen3EmbeddingModelRevision = "97b0c614be4d77ee51c0cef4e5f07c00f9eb65b3"
|
|
Qwen3EmbeddingPromptVersion = "qwen3-card-last-v1"
|
|
)
|
|
|
|
// DemoMatchingSemanticsEnsemblePolicy returns the semantic section of the
|
|
// two-model ensemble S5-DE of the LincodexMatch research: Sem is the
|
|
// calibrated fused score 0.4 * z(Giga) + 0.6 * z(Qwen3-Embedding) of the
|
|
// cosines of the need view and the card view.
|
|
//
|
|
// - Weights: the research step 5 choice, made by 5-fold CV over the DEV
|
|
// needs on the research views (w_giga = 0.4 in four folds of five).
|
|
// - Mean and standard deviation: the research profiles and needs rendered
|
|
// with the product view builder (needs exactly as the research; a card
|
|
// with the catalog roles and declared grades, the card stack codes, and
|
|
// one published project per research experience entry), encoded by the
|
|
// ML service in float16 on CUDA. The mean is over all DEV need-profile
|
|
// pairs; the deviation is the pooled within-need deviation, so the fixed
|
|
// z-score reproduces the per-need z-score of the research (DEV nDCG@10
|
|
// 0.809 / indirect 0.518 against 0.809 / 0.518; Giga alone 0.738 / 0.403).
|
|
// - Calibration: the isotonic fit of P(consensus >= 2) on the fused score
|
|
// of the 3220 judged DEV pairs (994 positive), computed with the rounded
|
|
// mean and deviation below; 5-fold grouped CV ECE 0.025.
|
|
//
|
|
// The explanation thresholds stay those of Giga, the first member, which
|
|
// alone provides the item vectors. The values are a calibrated starting
|
|
// point, not a product measurement: real cards carry fewer projects than the
|
|
// research profiles carry experience entries.
|
|
func DemoMatchingSemanticsEnsemblePolicy() MatchingSemanticsPolicy {
|
|
policy := DemoMatchingSemanticsPolicy()
|
|
policy.Members = []MatchingSemanticMember{
|
|
{
|
|
Model: SemanticModel{
|
|
ID: GigaEmbeddingsModelID, Revision: GigaEmbeddingsModelRevision, PromptVersion: GigaEmbeddingsPromptVersion,
|
|
},
|
|
Weight: 4000, Mean: 2497, StandardDeviation: 741,
|
|
},
|
|
{
|
|
Model: SemanticModel{
|
|
ID: Qwen3EmbeddingModelID, Revision: Qwen3EmbeddingModelRevision, PromptVersion: Qwen3EmbeddingPromptVersion,
|
|
},
|
|
Weight: 6000, Mean: 3636, StandardDeviation: 731,
|
|
},
|
|
}
|
|
policy.Calibration = demoEnsembleCalibration()
|
|
policy.Source = "LincodexMatch DEV split 2026-10-11, product card views, giga+qwen3 float16; weights 0.4/0.6 S5-DE (reports/step5), mean/std and isotonic fit on 3220 judged pairs"
|
|
return policy
|
|
}
|
|
|
|
// DemoSemanticEnsembleMatchingPolicy returns DemoSemanticMatchingPolicy with
|
|
// the ensemble semantic section; the Fit weights stay those of the single
|
|
// model section.
|
|
func DemoSemanticEnsembleMatchingPolicy() MatchingPolicy {
|
|
policy := DemoSemanticMatchingPolicy()
|
|
semantics := DemoMatchingSemanticsEnsemblePolicy()
|
|
policy.Semantics = &semantics
|
|
return policy
|
|
}
|
|
|
|
// demoEnsembleCalibration is the isotonic fit of the fused score in basis
|
|
// points (a fused score of 1.0 is 10000).
|
|
func demoEnsembleCalibration() []MatchingCalibrationPoint {
|
|
return []MatchingCalibrationPoint{
|
|
{-22961, 0}, {610, 0}, {619, 101}, {3279, 101}, {3279, 263}, {5629, 263}, {5682, 267}, {7140, 267},
|
|
{7155, 559}, {9628, 559}, {9636, 985}, {12855, 985}, {12869, 1379}, {14934, 1379}, {14954, 1690}, {16934, 1690},
|
|
{16971, 1940}, {17749, 1940}, {17751, 2283}, {18641, 2283}, {18642, 2632}, {18955, 2632}, {18960, 2667}, {19764, 2667},
|
|
{19767, 3105}, {21601, 3105}, {21614, 3436}, {23072, 3436}, {23075, 4062}, {23840, 4062}, {23843, 4286}, {23906, 4286},
|
|
{23933, 4444}, {24162, 4444}, {24179, 5059}, {27070, 5059}, {27076, 5766}, {28697, 5766}, {28701, 6706}, {29902, 6706},
|
|
{29916, 7059}, {30450, 7059}, {30460, 7500}, {33107, 7500}, {33109, 7692}, {33320, 7692}, {33354, 8182}, {33738, 8182},
|
|
{33753, 8391}, {35898, 8391}, {35939, 9244}, {40768, 9244}, {40885, 9792}, {44357, 9792}, {44390, 10000}, {52584, 10000},
|
|
}
|
|
}
|