Legal models in XGBoost Serving must follow the following specifications:
- XGBoost model must be named deploy.model
- Leaf Mapping must be named deploy.leaf_mapping, each line contains the mapping relationships between the leaf in this tree and the feature and is seperated with space. The first field is the tree number with the uint32_t type, the following fields are mapping relationships between the leaf and the feature seperated with colon, the part before colon is the leaf ID with the uint32_t type, the part after colon is the feature ID with the int32_t type. One legal deploy.leaf_mapping may look like this:
0 31:4097 32:4098 33:4099 34:4100 35:4101 36:4102 37:4103 38:4104 39:4105 40:4106 41:4107 42:4108 43:4109 44:4110 45:4111 46:4112 47:4113 48:4114 49:4115 50:4116 51:4117 52:4118 53:4119 54:4120 55:4121 56:4122 57:4123 58:4124 59:4125 60:4126 61:4127 62:4128
1 31:4129 32:4130 33:4131 34:4132 35:4133 36:4134 37:4135 38:4136 39:4137 40:4138 41:4139 42:4140 43:4141 44:4142 45:4143 46:4144 47:4145 48:4146 49:4147 50:4148 51:4149 52:4150 53:4151 54:4152 55:4153 56:4154 57:4155 58:4156 59:4157 60:4158 61:4159 62:4160
2 31:4161 32:4162 33:4163 34:4164 35:4165 36:4166 37:4167 38:4168 39:4169 40:4170 41:4171 42:4172 43:4173 44:4174 45:4175 46:4176 47:4177 48:4178 49:4179 50:4180 51:4181 52:4182 53:4183 54:4184 55:4185 56:4186 57:4187 58:4188 59:4189 60:4190 61:4191 62:4192
3 31:4193 32:4194 33:4195 34:4196 35:4197 36:4198 37:4199 38:4200 39:4201 40:4202 41:4203 42:4204 43:4205 44:4206 45:4207 46:4208 47:4209 48:4210 49:4211 50:4212 51:4213 52:4214 53:4215 54:4216 55:4217 56:4218 57:4219 58:4220 59:4221 60:4222 61:4223 62:4224
-
FM model must be named deploy.fm, as we support regular FM models and alphaFM_softmax models, there are two legal model specifications.
For the regular FM model, the first line must contain two parts, the first is "bias" and the second is the bias value with the float type. The following lines are weights and implicit vectors for every feature seperated by space. For each line, the first field is the feature ID with the uint64_t type, the second field is the weight with the float type, others are implicit vector values with the float type. One legal deploy.fm may look like this:
bias -0.0412945
1 -0.0133094 -0.00641085 -0.00157906 0.00766156 0.00765444 -0.026999 -0.0267311
2 -0.0147291 -0.0299582 0.0105835 0.0156399 0.0128812 -0.0137143 0.00553601
3 -0.0223769 -0.00658522 -0.0357828 -0.0206767 -0.0126719 0.0145142 0.00411225
For the alphaFM_softmax model, the deploy.fm must be consistent with the Model Format. One legal deploy.fm may look like this:
bias 0.107435 409391 -1377.6 0.0414969 487675 -580.714 -0.0547054 145437 418.719 0.0234518 42047.8 -96.8648 -0.0951025 10252.7 195.071 -0.118009 7305.98 204.786
2065982 0 0.0957365 0.0725888 -0.067353 0.0932497 0.106917 0.128101 -0.0400333 -0.0917294 0.0130492 -0.0418091 0.0933118 -0.0806584 -0.0131085 -0.179711 0.0274253 0.0144554 0.00828573 0.0316491 0.0450829 0.124085 -0.0175861 0.105949 -0.0157273 0.0170343 0.0646549 -0.0821 -0.105984 0.0608276 0.00306985 -0.0221825 0.0290694 0.0257532 0.0313623 -0.177094 0.00289447 0.0137232 0.0873174 0.0491946 0.0081572 1.76382e-05 0.255669 0.0153493 0.00883195 0.00606149 0.000124745 0.000389053 0.0331087 0.00489838 0.0186608 0.00285696 0.205225 0.0118477 0.00853703 0.145129 0.0756066 0.00784878 0.00273117 0.0104019 0.00119468 0.0151151 0.000328193 0.00877592 0.0132548 0.0136434 0.00308044 0.0021536 -0.156813 -0.287216 0.693545 -0.635452 -0.102812 -0.00656012 -0.100791 0.351184 0.0694517 -0.0127541 -0.0320128 0.0120944 -0.134254 0.321542 -0.211533 0.0379976 -0.528089 -0.177746 0.00908639 -0.564469 -0.178255 -0.0991345 -0.0358222 -0.136736 -0.079259 0.324817 0.0202843 -0.0202866 0.108061 -0.0649845 0.0232337 -0.0703094 0 -0.11453 0.131563 -0.0705991 -0.133567 0.0545952 -0.200452 -0.0220082 0.0814625 -0.0675818 0.14476 0.042658 0.00575103 0.119388 0.0789084 -0.190256 -0.0254182 -0.114535 0.15659 -0.00288165 0.0168668 0.0698939 0.21711 -0.0808582 -0.0612806 0.0284518 -0.0530024 -0.0933913 0.046312 -0.134947 0.0177713 0.0336864 -0.0341455 0.0153038 0.123709 0.000117425 0.00841278 0.00218925 0.00162165 0.00744344 0.00205641 0.000653602 1.99839e-05 0.00147141 0.000478426 0.00248822 0.00247425 0.00010066 0.0056144 6.48456e-05 0.00268826 0.000167564 0.00427469 0.00875809 0.000694368 0.00177703 0.00598896 0.00276271 0.00301685 0.0019943 0.00379293 0.000875655 0.00424892 0.00106015 0.000969092 0.000289017 0.000186786 0.0139853 -0.14962 0.0192765 0.0673046 -0.00792912 0.227148 0.0368187 -0.0117536 0.0134884 -0.0414537 -0.0924393 0.0440205 -0.0339891 -0.19318 0.0386942 -0.0254906 0.0167077 -0.270142 -0.0881911 -0.03524 -0.101082 -0.413424 0.032439 0.012392 -0.0700694 0.00369812 0.0256803 -0.12556 0.0553176 -0.0421947 -0.0284542 0.0230003 0 0.0651883 -0.104912 -0.0149023 -0.102228 0.0830867 0.0656946 0.127092 0.0562297 0.109952 0.0893176 0.0619786 0.057687 0.0508677 -0.0612199 0.0494241 -0.00603323 0.0221043 -0.1866 0.239662 -0.0390927 0.11626 -0.145929 -0.034308 0.1249 -0.135386 -0.145081 -0.0504971 -0.00807491 0.00647213 -0.266622 -0.0796619 0.057335 0.00216439 0.046523 7.13098e-05 4.95322e-05 0.00643523 0.000146554 0.00104605 0.000164329 0.000383068 0.00406393 8.505e-05 0.000299583 0.000134559 0.00207518 0.000121765 0.000245299 0.00314843 0.00021775 0.000282434 0.000958741 0.00181765 0.000200358 5.52669e-05 0.00113636 7.75375e-06 5.16846e-05 0.000860553 0.000194058 0.00235719 0.00138684 4.31751e-05 0.000555302 0.000730321 0.000356173 -0.0194542 0.00772932 0.104129 0.0126454 -0.0860876 -0.029662 -0.0693214 -0.135441 -0.0110579 -0.0482274 -0.025979 -0.0981118 -0.022261 0.0348386 -0.111575 -0.0129758 -0.0242354 0.146519 -0.246988 0.0252218 -0.00985171 0.0646754 -0.000873904 -0.0107695 0.0500965 0.0264904 0.000482704 0.0432545 -0.00742131 0.102093 0.0160319 -0.00276862 0 0.0962324 0.0819875 -0.0441351 -0.00445114 -0.0390664 0.0872288 -0.0299843 -0.0637088 -0.162154 0.0123966 0.0732199 -0.0372036 -0.0582029 0.000516208 -0.0496956 -0.00467238 0.0676605 -0.0260249 0.060078 0.0803861 0.0219683 -0.0136082 0.0814833 0.0465123 -0.0155771 -0.183971 -0.0630429 -0.0437646 -0.0150558 -0.0245799 0.108211 0.0841136 3.5992e-05 0.00599933 3.99122e-07 1.90468e-06 3.75287e-06 5.63055e-06 1.47877e-06 8.59327e-06 2.84552e-05 1.01697e-06 7.58811e-06 1.44004e-05 6.19874e-06 9.69006e-06 3.09589e-05 2.703e-05 1.95754e-06 2.16592e-05 3.45814e-05 2.67764e-05 2.51072e-06 2.82239e-06 2.84973e-06 1.48852e-05 1.29769e-05 1.54864e-06 1.46527e-05 7.40493e-05 1.06969e-06 3.51672e-05 4.23419e-06 3.14975e-06 2.44644e-05 1.39417e-05 -0.00184768 -0.00364312 0.00364723 0.00258412 0.00216618 -0.00804553 0.00853327 0.00229339 0.0116882 -0.00473564 -0.00613568 -0.000796674 0.012041 -0.00525271 0.00278972 0.00508885 -0.00207708 -0.00248122 -0.00348843 -0.00438096 0.000946415 -0.00280809 -0.00226828 8.68051e-05 0.00502043 0.0402672 0.00233831 -0.000739537 -0.0014381 0.00264722 -0.00575838 -0.0100152 0 -0.0111343 -0.0959777 0.0287068 0.0859298 -0.116613 -0.0652382 -0.0429444 0.104671 -0.0154954 0.110414 0.0646899 -0.115736 -0.175324 0.00327157 0.185235 -0.0131296 -0.023474 0.00530094 0.0656165 0.0264227 0.00286245 -0.0691354 -0.0503036 0.0532146 -0.0625779 -0.0120316 -0.0517609 0.0462166 -0.11949 0.0454466 0.0972846 0.0874118 2.67858e-10 1.63664e-05 5.36766e-12 1.082e-10 3.14259e-11 7.70669e-11 1.29137e-10 2.17593e-13 3.22411e-11 1.51533e-10 7.61892e-13 7.26197e-11 1.22141e-10 6.202e-12 8.63058e-11 8.97031e-12 3.07943e-11 4.23483e-12 7.72589e-12 1.60286e-10 9.32784e-11 1.0437e-10 5.92167e-11 1.31022e-13 8.03519e-11 1.87421e-11 6.01283e-11 8.16938e-11 1.44201e-10 2.99594e-11 1.25572e-11 1.96641e-10 9.32317e-12 4.65507e-11 2.83274e-06 9.56511e-06 -8.82442e-06 -6.30839e-06 1.51396e-05 1.42163e-07 1.0555e-05 -3.80795e-05 -6.02356e-07 -2.73401e-05 -2.53504e-05 8.25493e-06 4.18655e-05 -3.19102e-06 -2.61076e-05 -1.51749e-06 4.08449e-06 1.13182e-05 -2.23326e-05 -1.56149e-05 7.25469e-06 1.38529e-07 1.79823e-05 -2.78338e-07 1.95064e-06 -6.86353e-06 4.22916e-07 4.14167e-07 4.92494e-06 -2.67687e-05 -2.88756e-06 -5.10507e-06 0 -0.0158132 0.0512882 0.154145 -0.0549804 -0.0135257 0.0516155 -0.0160299 0.0814027 0.0739422 0.00476953 0.0500695 -0.008631 -0.0261618 0.0688778 0.0551348 -0.0840092 0.0826963 -0.0315979 -0.186573 0.0818327 0.0342876 0.0415885 -0.100552 -0.154764 -0.0555523 -0.150353 -0.0156334 0.0908152 -0.153289 -0.103494 -0.129967 0.00236979 7.16768e-07 0.000846622 2.89005e-06 5.80946e-08 4.38862e-07 1.35569e-06 1.4538e-07 1.6853e-08 3.05927e-07 4.19431e-07 7.36565e-08 1.83013e-08 3.01571e-08 1.34985e-06 2.02115e-07 9.12093e-08 1.32526e-07 1.39881e-07 4.4541e-07 3.73322e-07 1.15202e-07 8.5542e-07 2.00207e-12 1.42495e-08 5.99112e-09 1.4235e-06 8.79135e-08 3.68654e-08 4.28382e-09 1.598e-07 2.22557e-08 6.39589e-07 4.0678e-07 1.82677e-06 -0.00116236 -0.000488266 -0.00137986 0.000115978 -0.000278144 -0.000263833 0.000730432 -0.00040675 -0.000129957 0.000122377 -2.41361e-07 -0.000961276 -0.000214339 -0.000718043 -0.000765467 0.00100241 -0.000436423 -0.000224874 0.00160593 -0.000588834 -2.38525e-06 -0.00021866 7.82571e-05 0.00249989 0.00062593 0.000385362 -4.49864e-05 -0.00112582 0.000308179 0.000855636 0.00102004 0.00128752
Before we deploy the models with XGBoost Serving, we must export the models based on the Model's specifications.
Please refer XGBoost model export for details about exporting XGBoost models. For regular FM model, you must save the model based on the FM model's specification and for alphaFM_softmax model, refer alphaFM_softmax model export for details about exporting alphaFM_softmax models.