模型交付中不起眼的一半,是讓服務可靠運作
The boring half of shipping a model
作者分享團隊將模型訓練成果變成可依賴服務的經驗,模型訓練用了兩週,之後又花約五週建立可靠性。做法包括推理前驗證資料格式,驗證失敗時回傳明確錯誤;每次預測記錄模型及預處理版本,並在 CI 對 300 個標註樣本執行評測。評測曾發現兩次看似無害的預處理調整令結果下降四點,團隊亦以每千份文件的成本作為設計指標。
The model was the easy part. It took two weeks to train something good enough, and about five more to make it something the team could rely on.
The half nobody puts in the writeup:
Data validation before inference. If a field arrives empty or in a new format, the model still returns a confident answer. We added a schema check and a rule: if validation fails, return a clear error instead of a guess.
A version pair. Every prediction logs the model version and the preprocessing version, because they drift independently and a mismatch produces results that look plausible.
An eval set that lives in the repo and runs in CI. Three hundred labeled examples, run on every change. It has caught two 'harmless' preprocessing tweaks that quietly cost four points.
A cost number. Not accuracy, not F1, just the price per thousand documents. It shapes the design more than any other metric.
None of this is interesting at a conference. It is the difference between a demo and a service.
來源:DEV Community · dev.to