{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html","markdown":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.md","pages":[{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":1},{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":2},{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":3},{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":4},{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":5},{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":6},{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","unit":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","unitId":"lab12-图文检索与表示缓存","chapter":"course","number":7}],"aliases":[{"oldId":"b-9eb5e0ae11092885f1f12737","targetId":"b-9eb5e0ae11092885f1f12737","page":"reading-opening","operation":"move","beforeSHA256":"dc3dd8d669c0539692ccd8800a03068a1629bcdf04090f59fd2fba8026242e23","afterSHA256":"dc3dd8d669c0539692ccd8800a03068a1629bcdf04090f59fd2fba8026242e23","reason":"Same source body in authored semantic page"},{"oldId":"b-0a25f2051efbe96400e9111e","targetId":"b-0a25f2051efbe96400e9111e","page":"reading-opening","operation":"move","beforeSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","afterSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","reason":"Same source body in authored semantic page"},{"oldId":"b-e48e8edb4d34c919553e6960","targetId":"b-e48e8edb4d34c919553e6960","page":"reading-opening","operation":"move","beforeSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","afterSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","reason":"Same source body in authored semantic page"},{"oldId":"b-38adec5ef737cdb620311d3e","targetId":"b-38adec5ef737cdb620311d3e","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-55354a58cd7395f4bfe1764b","targetId":"b-55354a58cd7395f4bfe1764b","page":"reading-opening","operation":"move","beforeSHA256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","afterSHA256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","reason":"Same source body in authored semantic page"},{"oldId":"b-1fd7eb830402a2b1539bfdb9","targetId":"b-1fd7eb830402a2b1539bfdb9","page":"reading-opening","operation":"move","beforeSHA256":"5fbe114bcb870df3b0a22d360a98a599544e8d98166e2baab6796d9846c84725","afterSHA256":"5fbe114bcb870df3b0a22d360a98a599544e8d98166e2baab6796d9846c84725","reason":"Same source body in authored semantic page"},{"oldId":"b-03d39e78a26f816b77b0bc50","targetId":"b-03d39e78a26f816b77b0bc50","page":"reading-opening","operation":"move","beforeSHA256":"3ac767754b4f134bba4821d4304d9450b1a03cc82aaf44073413740cbfd449aa","afterSHA256":"3ac767754b4f134bba4821d4304d9450b1a03cc82aaf44073413740cbfd449aa","reason":"Same source body in authored semantic page"},{"oldId":"b-b9c04e8890f0954d0c0f06fa","targetId":"b-b9c04e8890f0954d0c0f06fa","page":"reading-opening","operation":"move","beforeSHA256":"a315e05d1f004b11ff9c24607a524c3ba290695efbdf9fc1f8c6f4b5d3b8a42d","afterSHA256":"a315e05d1f004b11ff9c24607a524c3ba290695efbdf9fc1f8c6f4b5d3b8a42d","reason":"Same source body in authored semantic page"},{"oldId":"b-98debf7e4ac9d831e599d52b","targetId":"b-98debf7e4ac9d831e599d52b","page":"reading-opening","operation":"move","beforeSHA256":"495443f171850cc5a7e353e9b66975fb4671b36198e5ab69cd02d4e8ecd080ae","afterSHA256":"495443f171850cc5a7e353e9b66975fb4671b36198e5ab69cd02d4e8ecd080ae","reason":"Same source body in authored semantic page"},{"oldId":"b-cd285b0e9875a11df3d01dbf","targetId":"b-cd285b0e9875a11df3d01dbf","page":"reading-opening","operation":"move","beforeSHA256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","afterSHA256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","reason":"Same source body in authored semantic page"},{"oldId":"b-99b4e0646e898ddd843545f2","targetId":"b-99b4e0646e898ddd843545f2","page":"reading-opening","operation":"move","beforeSHA256":"12ceba147ef6dd56c8b723f733b3413face0fb8553a2d2532308176a4f4f306a","afterSHA256":"12ceba147ef6dd56c8b723f733b3413face0fb8553a2d2532308176a4f4f306a","reason":"Same source body in authored semantic page"},{"oldId":"b-5b473f2655f4a3e8bdda3163","targetId":"b-5b473f2655f4a3e8bdda3163","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"c55c81a2779d4884d73f8f9239637e8601ad2a671e8bfa4b1b0eaf733ce8c149","afterSHA256":"c55c81a2779d4884d73f8f9239637e8601ad2a671e8bfa4b1b0eaf733ce8c149","reason":"Same source body in authored semantic page"},{"oldId":"b-20f239869a46b414683b46a7","targetId":"b-20f239869a46b414683b46a7","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"a4760dc5c790d3551a0886f0b7e4afeba240e6e6546433a75593c9ee8ca2fc79","afterSHA256":"a4760dc5c790d3551a0886f0b7e4afeba240e6e6546433a75593c9ee8ca2fc79","reason":"Same source body in authored semantic page"},{"oldId":"b-28e75835c1789260edb6412b","targetId":"b-28e75835c1789260edb6412b","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"40758dc2b27ab13a7646c5b5af382412086396de48f6a362d0c866ac461a59b6","afterSHA256":"40758dc2b27ab13a7646c5b5af382412086396de48f6a362d0c866ac461a59b6","reason":"Same source body in authored semantic page"},{"oldId":"b-e7c6e8129bd467e2e0497b73","targetId":"b-e7c6e8129bd467e2e0497b73","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"0e65aac53651921d8e9f96626efa5458f0943e951cabcded0f5af48364ebb76f","afterSHA256":"a19555b36c40f361b20577ae383941cce9382473f9a009a407ecc3e394e25645","reason":"Same source body in authored semantic page"},{"oldId":"b-a1afc11f537e0d8b469f5337","targetId":"b-a1afc11f537e0d8b469f5337","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"5748751d5292c3aa044b6275be2ca22516edcf83bd727d34669cfe3f93e3aeb8","afterSHA256":"5748751d5292c3aa044b6275be2ca22516edcf83bd727d34669cfe3f93e3aeb8","reason":"Same source body in authored semantic page"},{"oldId":"b-5eccbd25a2a5700a2163ed3a","targetId":"b-5eccbd25a2a5700a2163ed3a","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"6fbf90ab812717a1cc7048a95944cd7f5194e019c122acc2da4909b06ab55514","afterSHA256":"6fbf90ab812717a1cc7048a95944cd7f5194e019c122acc2da4909b06ab55514","reason":"Same source body in authored semantic page"},{"oldId":"b-d6bbe145feaf87c800efa7b3","targetId":"b-d6bbe145feaf87c800efa7b3","page":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","operation":"move","beforeSHA256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","afterSHA256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","reason":"Same source body in authored semantic page"},{"oldId":"b-6449cf4436992853d078180f","targetId":"b-6449cf4436992853d078180f","page":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","operation":"move","beforeSHA256":"6a6a7b78abfe6364f4ef040e54cd2bf106294e030c2d6a73dcdad1dd69ddfa24","afterSHA256":"6a6a7b78abfe6364f4ef040e54cd2bf106294e030c2d6a73dcdad1dd69ddfa24","reason":"Same source body in authored semantic page"},{"oldId":"b-08cc3d63cb25ee10997dd916","targetId":"b-08cc3d63cb25ee10997dd916","page":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","operation":"move","beforeSHA256":"a9db9edd976ff657caa5941b4245c0b52971ebde344e66c024f0e5ab01b0401f","afterSHA256":"a9db9edd976ff657caa5941b4245c0b52971ebde344e66c024f0e5ab01b0401f","reason":"Same source body in authored semantic page"},{"oldId":"b-a4b923ba2dce85fc83905954","targetId":"b-a4b923ba2dce85fc83905954","page":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","operation":"move","beforeSHA256":"6981901db7db96134fa7095db2336567bb8c37f0f76f8e294f664880fb8c1808","afterSHA256":"6981901db7db96134fa7095db2336567bb8c37f0f76f8e294f664880fb8c1808","reason":"Same source body in authored semantic page"},{"oldId":"b-90b9c89842d38f1209849fc7","targetId":"b-90b9c89842d38f1209849fc7","page":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","operation":"move","beforeSHA256":"aa8be1410199fba8c51caa638e575eceda30ec6f40f30bbfa56b0107d8f9e20f","afterSHA256":"aa8be1410199fba8c51caa638e575eceda30ec6f40f30bbfa56b0107d8f9e20f","reason":"Same source body in authored semantic page"},{"oldId":"b-ed8e447c34587b3ae0fba140","targetId":"b-ed8e447c34587b3ae0fba140","page":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","operation":"move","beforeSHA256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","afterSHA256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","reason":"Same source body in authored semantic page"},{"oldId":"b-e370bed2cb4a098443b22f9b","targetId":"b-e370bed2cb4a098443b22f9b","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"72042c5a397268efdedab711c30b3be6e811dbf705389989de882bfab7e7565c","afterSHA256":"72042c5a397268efdedab711c30b3be6e811dbf705389989de882bfab7e7565c","reason":"Same source body in authored semantic page"},{"oldId":"b-8808b0b1b707c5b2c59c8551","targetId":"b-8808b0b1b707c5b2c59c8551","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"e912abb9cf15500ad588e974eab6aaf8e3a3dbfb4a3289c72d0cebe6988f1272","afterSHA256":"e912abb9cf15500ad588e974eab6aaf8e3a3dbfb4a3289c72d0cebe6988f1272","reason":"Same source body in authored semantic page"},{"oldId":"b-2e6ab49d2d128c2dade1b1e1","targetId":"b-2e6ab49d2d128c2dade1b1e1","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"6f11c5e11524e032f183e4cb3071fb0773bf2a4e4ec7c99fc8f90f22962ea858","afterSHA256":"6f11c5e11524e032f183e4cb3071fb0773bf2a4e4ec7c99fc8f90f22962ea858","reason":"Same source body in authored semantic page"},{"oldId":"b-c816a944dbafffde0a75b822","targetId":"b-c816a944dbafffde0a75b822","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"17197a3b41b63d107be94a74b22c9ae450a89fee34051c2caca715be92157969","afterSHA256":"17197a3b41b63d107be94a74b22c9ae450a89fee34051c2caca715be92157969","reason":"Same source body in authored semantic page"},{"oldId":"b-1c868f0f1b4271af83312dc7","targetId":"b-1c868f0f1b4271af83312dc7","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"03548e94c27e646b9073eeed385278bb117959dca4e57b428eeb514af543181c","afterSHA256":"03548e94c27e646b9073eeed385278bb117959dca4e57b428eeb514af543181c","reason":"Same source body in authored semantic page"},{"oldId":"b-9f1ece11d4c55fb9ec961583","targetId":"b-9f1ece11d4c55fb9ec961583","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"4199206c98f1400fd4f86b9a1b6859bfd6336b777ff8ee4644f10049430a0e81","afterSHA256":"4199206c98f1400fd4f86b9a1b6859bfd6336b777ff8ee4644f10049430a0e81","reason":"Same source body in authored semantic page"},{"oldId":"b-fce7fbb83e5873caf9d7e3ed","targetId":"b-fce7fbb83e5873caf9d7e3ed","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"rewrite","beforeSHA256":"468e5d4cafaad526d89627bdf133d70be61020ae8c8861c61102bb7bcc03c15a","afterSHA256":"19e1f4ed476f267b8d54876e0f38b9544dbd5efb15a13fa7844ca5e3c57b18fd","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-498917ee920c04e5fb9b2488","targetId":"b-498917ee920c04e5fb9b2488","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"deb1e19b802e3c9a8340b7f6c73704f55fd26daae1b19a560c7e056ce1a3d9e2","afterSHA256":"deb1e19b802e3c9a8340b7f6c73704f55fd26daae1b19a560c7e056ce1a3d9e2","reason":"Same source body in authored semantic page"},{"oldId":"b-44377a1126fbbd8a8c6d25bf","targetId":"b-44377a1126fbbd8a8c6d25bf","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"f800f03ae61070290c48f513109f46c73596c6752c4ce0097251d87c426a99d0","afterSHA256":"f800f03ae61070290c48f513109f46c73596c6752c4ce0097251d87c426a99d0","reason":"Same source body in authored semantic page"},{"oldId":"b-6f090a8ce99fc9c23e03e00a","targetId":"b-6f090a8ce99fc9c23e03e00a","page":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","operation":"move","beforeSHA256":"1ddf1e6f4a92876b964902f2f6ed34917b02a0822b4f77a25e14c3e0b6358d91","afterSHA256":"1ddf1e6f4a92876b964902f2f6ed34917b02a0822b4f77a25e14c3e0b6358d91","reason":"Same source body in authored semantic page"},{"oldId":"b-e39569319db3df0da74ccd02","targetId":"b-e39569319db3df0da74ccd02","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"cc34b1d8d96a4a8b5be556959bf607fe886b3e40109adebba891f9b6d77ccf4f","afterSHA256":"cc34b1d8d96a4a8b5be556959bf607fe886b3e40109adebba891f9b6d77ccf4f","reason":"Same source body in authored semantic page"},{"oldId":"b-c03c3ecc9f0d555d9dea1edb","targetId":"b-c03c3ecc9f0d555d9dea1edb","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"29de550b073aa289c5c63996c445f8ef9074e4112c55ccd3992e7ea786a72ca4","afterSHA256":"29de550b073aa289c5c63996c445f8ef9074e4112c55ccd3992e7ea786a72ca4","reason":"Same source body in authored semantic page"},{"oldId":"b-a089d0bd2fea0c35b8c52ac6","targetId":"b-a089d0bd2fea0c35b8c52ac6","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"rewrite","beforeSHA256":"e1c547b6e70c56eee1fa6cd81d029af495999c5a23ba0feca79b25a35f761586","afterSHA256":"43f16868b0a2ff3caaf4097219db411875fa2eddf5ab688376216b11ba085931","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-0f80068bffcc65f34401893e","targetId":"b-0f80068bffcc65f34401893e","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"7df53ec83d5158fab387bde9da8775e8145a415001ec6c33bbc5889e686315c6","afterSHA256":"7df53ec83d5158fab387bde9da8775e8145a415001ec6c33bbc5889e686315c6","reason":"Same source body in authored semantic page"},{"oldId":"b-c9420e8d4c8e0aecbf1b4db2","targetId":"b-c9420e8d4c8e0aecbf1b4db2","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"0058f1b1f72f4b12fed94a47316508cdf7a76909d978c569cc516bd2b096b4c4","afterSHA256":"0058f1b1f72f4b12fed94a47316508cdf7a76909d978c569cc516bd2b096b4c4","reason":"Same source body in authored semantic page"},{"oldId":"b-1c47991ed9a184b1c9668e7b","targetId":"b-1c47991ed9a184b1c9668e7b","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"0aca1a9483c1d58d13fe4c22db96395bf7ece1daf2b5e25e23c67d8e06f67d18","afterSHA256":"0aca1a9483c1d58d13fe4c22db96395bf7ece1daf2b5e25e23c67d8e06f67d18","reason":"Same source body in authored semantic page"},{"oldId":"b-6c4c220e2a32c4d14a619a93","targetId":"b-6c4c220e2a32c4d14a619a93","page":"reading-block-304aa2a46d41405db647924c1a08d5c0","operation":"move","beforeSHA256":"1f446813e339d77894338425dfd088564fcaa921bd9d6fcdb446e1a9523375fd","afterSHA256":"1f446813e339d77894338425dfd088564fcaa921bd9d6fcdb446e1a9523375fd","reason":"Same source body in authored semantic page"},{"oldId":"b-8bc180a5a728111098a325e0","targetId":"b-8bc180a5a728111098a325e0","page":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","operation":"move","beforeSHA256":"2fd9111f853e5d93f7d59d72c39d6652bb45bfaa5b4f36353c00e0eca228db69","afterSHA256":"2fd9111f853e5d93f7d59d72c39d6652bb45bfaa5b4f36353c00e0eca228db69","reason":"Same source body in authored semantic page"},{"oldId":"b-4468bdbe15c85ac848a48978","targetId":"b-4468bdbe15c85ac848a48978","page":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","operation":"move","beforeSHA256":"1c0a54709b04ee6babf39f66eee1768f60b0f62b5c9cd89bb4c23667b8ade7c6","afterSHA256":"1c0a54709b04ee6babf39f66eee1768f60b0f62b5c9cd89bb4c23667b8ade7c6","reason":"Same source body in authored semantic page"},{"oldId":"b-06f2a34e7ea59bb2e62e382c","targetId":"b-06f2a34e7ea59bb2e62e382c","page":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","operation":"move","beforeSHA256":"9131075fd10fc81a22296a0bfdfa26a9b81a5fc2506249842fe1f424e20c20b0","afterSHA256":"9131075fd10fc81a22296a0bfdfa26a9b81a5fc2506249842fe1f424e20c20b0","reason":"Same source body in authored semantic page"},{"oldId":"b-4b4f17c9f28c68ab9464d33a","targetId":"b-4b4f17c9f28c68ab9464d33a","page":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","operation":"move","beforeSHA256":"7319327aded1ab0df3bfecb88955ac7ec5e20b4a260492e8c92a288c7f8f2c0e","afterSHA256":"7319327aded1ab0df3bfecb88955ac7ec5e20b4a260492e8c92a288c7f8f2c0e","reason":"Same source body in authored semantic page"},{"oldId":"b-fe57b7afef4ca583a695c11e","targetId":"b-fe57b7afef4ca583a695c11e","page":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","operation":"move","beforeSHA256":"1c94690e55052c3ecda347fd63eda585c74c30839c4f2ee4f7e60c12cef100b7","afterSHA256":"1c94690e55052c3ecda347fd63eda585c74c30839c4f2ee4f7e60c12cef100b7","reason":"Same source body in authored semantic page"},{"oldId":"b-c7f027143638a845fdfa8f95","targetId":"b-c7f027143638a845fdfa8f95","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"bbae6b88d175740fcc388f6a8c87e215f238a735f871795aaf66c88b7cab6763","afterSHA256":"bbae6b88d175740fcc388f6a8c87e215f238a735f871795aaf66c88b7cab6763","reason":"Same source body in authored semantic page"},{"oldId":"b-7c450cf26df38fb0b34747f0","targetId":"b-7c450cf26df38fb0b34747f0","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"42636dfc286ae067e3a3dd324d3254fd946cf97ff5a9b437d0cd7499fd2dfb67","afterSHA256":"42636dfc286ae067e3a3dd324d3254fd946cf97ff5a9b437d0cd7499fd2dfb67","reason":"Same source body in authored semantic page"},{"oldId":"b-5fc1389d0817cd23b44b0d31","targetId":"b-5fc1389d0817cd23b44b0d31","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"3df82b0623b773e41f2ed517ca902a17ceeae0a40bd60e17ab4b0ab30bdb5fb8","afterSHA256":"3df82b0623b773e41f2ed517ca902a17ceeae0a40bd60e17ab4b0ab30bdb5fb8","reason":"Same source body in authored semantic page"},{"oldId":"b-b9f6586d85ba1c2a450be8b6","targetId":"b-b9f6586d85ba1c2a450be8b6","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"c60d3777bf170bdaa4d3d1080e566dc13881ed5547b9588c256b50c81668901d","afterSHA256":"c60d3777bf170bdaa4d3d1080e566dc13881ed5547b9588c256b50c81668901d","reason":"Same source body in authored semantic page"},{"oldId":"b-4945e8dd8115ee0e4fb5ef07","targetId":"b-4945e8dd8115ee0e4fb5ef07","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"683fb353614b8caea2b20354148eb392f1ae5b27cdddc2afc985881ecd61869e","afterSHA256":"683fb353614b8caea2b20354148eb392f1ae5b27cdddc2afc985881ecd61869e","reason":"Same source body in authored semantic page"},{"oldId":"b-d02b62b73d372ffcb27a7e28","targetId":"b-d02b62b73d372ffcb27a7e28","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"a586469ccc83fb5dcf05cbbe1b152e57de2fd97ec876b73756c1a3bac5a9d09c","afterSHA256":"a586469ccc83fb5dcf05cbbe1b152e57de2fd97ec876b73756c1a3bac5a9d09c","reason":"Same source body in authored semantic page"},{"oldId":"b-35bdb5ce98c17c8997b74c3d","targetId":"b-35bdb5ce98c17c8997b74c3d","page":"reading-block-00d45a521ea24f3894d71b0c128448a3","operation":"move","beforeSHA256":"fcd877d1c393bc745c961addcd221b12f2ddf742a1feec276a9658eddddb9f9d","afterSHA256":"fcd877d1c393bc745c961addcd221b12f2ddf742a1feec276a9658eddddb9f9d","reason":"Same source body in authored semantic page"},{"oldId":"block-687d09fc176e4c64a0bf836efcbe03f1--1-输入来源编码和缓存身份","targetId":"b-5b473f2655f4a3e8bdda3163","operation":"retain-source-identity"},{"oldId":"block-5ba73f2552e945a7a94eb9043c0ac480--2-精确搜索模型给分评价定义相关","targetId":"b-6449cf4436992853d078180f","operation":"retain-source-identity"},{"oldId":"block-62a7fe6e03324fd9877c139c11e4ce0e--3-实际的近似索引先路由到簇再在簇内精排","targetId":"b-e370bed2cb4a098443b22f9b","operation":"retain-source-identity"},{"oldId":"block-304aa2a46d41405db647924c1a08d5c0--4-缓存节约什么不能节约什么","targetId":"b-e39569319db3df0da74ccd02","operation":"retain-source-identity"},{"oldId":"block-8cfb433dc5cc4c4d9b8052e80463dfb5--5-查询依赖的交互一个可运行的区域加权对照","targetId":"b-8bc180a5a728111098a325e0","operation":"retain-source-identity"},{"oldId":"block-00d45a521ea24f3894d71b0c128448a3--6-做一个有意义的改变并解释它改变了哪层","targetId":"b-c7f027143638a845fdfa8f95","operation":"retain-source-identity"}],"blocks":[{"id":"b-9eb5e0ae11092885f1f12737","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-9eb5e0ae11092885f1f12737","content":"# LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sha256":"dc3dd8d669c0539692ccd8800a03068a1629bcdf04090f59fd2fba8026242e23","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-0a25f2051efbe96400e9111e","prerequisites":[{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0a25f2051efbe96400e9111e","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-0a25f2051efbe96400e9111e","content":"并入相关学习路径","sha256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9eb5e0ae11092885f1f12737","nextBlock":"b-e48e8edb4d34c919553e6960","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"}],"relatedBlocks":[]},{"id":"b-e48e8edb4d34c919553e6960","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-e48e8edb4d34c919553e6960","content":"同一CLIP缓存、exact/IVF搜索、延迟/扫描量、区域交互基线","sha256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0a25f2051efbe96400e9111e","nextBlock":"b-38adec5ef737cdb620311d3e","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-38adec5ef737cdb620311d3e","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-38adec5ef737cdb620311d3e","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e48e8edb4d34c919553e6960","nextBlock":"b-55354a58cd7395f4bfe1764b","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-55354a58cd7395f4bfe1764b","type":"p","scope":"block-51c1a716f8564c5184d501805db714e9","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-55354a58cd7395f4bfe1764b","content":"**学习路径：** [文字候选与图文检索](/course/study/clip-retrieval.html)","sha256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-38adec5ef737cdb620311d3e","nextBlock":"b-1fd7eb830402a2b1539bfdb9","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1fd7eb830402a2b1539bfdb9","type":"p","scope":"block-51c1a716f8564c5184d501805db714e9","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-1fd7eb830402a2b1539bfdb9","content":"这是[LAB 04](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/0ba963931ddf4866b507b210d93a43bf)之后的检索分支：已有的CLIP向量怎样复用，返回哪一个ID又该怎样评价？先读[P59](/course/pages/l3-r2-p59.html)与[缓存接口](/course/blocks/retrieval-cache-interface.html)。","sha256":"5fbe114bcb870df3b0a22d360a98a599544e8d98166e2baab6796d9846c84725","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-55354a58cd7395f4bfe1764b","nextBlock":"b-03d39e78a26f816b77b0bc50","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-03d39e78a26f816b77b0bc50","type":"p","scope":"block-51c1a716f8564c5184d501805db714e9","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-03d39e78a26f816b77b0bc50","content":"基础路线读第1节真实照片/缓存身份、第2节exact命中ID、第4节编码次数与内存。应能解释同一查询的Hit、Recall和exact重合率各在问什么，留下查询、相关集合、K及命中ID，而不只记平均分。","sha256":"3ac767754b4f134bba4821d4304d9450b1a03cc82aaf44073413740cbfd449aa","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1fd7eb830402a2b1539bfdb9","nextBlock":"b-b9c04e8890f0954d0c0f06fa","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b9c04e8890f0954d0c0f06fa","type":"p","scope":"block-51c1a716f8564c5184d501805db714e9","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-b9c04e8890f0954d0c0f06fa","content":"二维向量只是热身；主体使用2026-09-22保存的24×512图像向量与12×512查询向量。默认读取并核验缓存，不重新运行CLIP编码器。首次材料下载仍需网络；改变图片或查询文字才需重算对应编码。","sha256":"a315e05d1f004b11ff9c24607a524c3ba290695efbdf9fc1f8c6f4b5d3b8a42d","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-03d39e78a26f816b77b0bc50","nextBlock":"b-98debf7e4ac9d831e599d52b","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-98debf7e4ac9d831e599d52b","type":"p","scope":"block-51c1a716f8564c5184d501805db714e9","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-98debf7e4ac9d831e599d52b","content":"第3节IVF和第5节区域加权是第八讲选读，保留完整可运行实现。阅读可按问题跳转，实际运行需按全部代码顺序，因第4节也读取第3节的索引变量。","sha256":"495443f171850cc5a7e353e9b66975fb4671b36198e5ab69cd02d4e8ecd080ae","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b9c04e8890f0954d0c0f06fa","nextBlock":"b-cd285b0e9875a11df3d01dbf","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-cd285b0e9875a11df3d01dbf","type":"pre","scope":"block-4e6be52d45e84175a6f134439b154cd8","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-cd285b0e9875a11df3d01dbf","content":"```\n# 每次整册运行使用临时工作目录，保留项目旧文件与历史结果。\nimport os, tempfile\nL03_RUN_DIR=tempfile.mkdtemp(prefix=\"lecture03-lab12-\")\nos.chdir(L03_RUN_DIR)\nimport numpy as np\nI=np.array([[1,0],[0,1],[.8,.2]],float); T=np.array([[1,0],[0,1]],float); I/=np.linalg.norm(I,axis=1,keepdims=True); T/=np.linalg.norm(T,axis=1,keepdims=True)\nS=T@I.T; print('similarity\\n',S.round(3)); ranks=np.argsort(-S,axis=1); truth=[0,1]\nfor k in [1,2]: print('Recall@'+str(k),np.mean([truth[i] in ranks[i,:k] for i in range(2)]))\n```","sha256":"e03f64d6228373bf789a043218b6e0b79bfb3690f26045ed0469c9a91958de34","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-98debf7e4ac9d831e599d52b","nextBlock":"b-99b4e0646e898ddd843545f2","prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-99b4e0646e898ddd843545f2","type":"p","scope":"block-f54d70a0d5e4428a9b2af782ef04561d","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-99b4e0646e898ddd843545f2","content":"热身里每个查询只有一个指定正例，`truth=[0,1]`，因此“该正例是否进入前 K”的均值可称单正例 Recall@K。第三张向量与第一张接近，但不是指定正例；相似性与评价标注是两件事。真实图集中同一照片有四个关联裁剪，后面采用 Hit@K 和 exact 邻居重合率，避免把多正例情形继续不加说明地称为同一种 Recall。","sha256":"12ceba147ef6dd56c8b723f733b3413face0fb8553a2d2532308176a4f4f306a","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-opening","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","number":1},"sectionTitle":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","currentQuestion":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-cd285b0e9875a11df3d01dbf","nextBlock":null,"prerequisites":[{"id":"b-9eb5e0ae11092885f1f12737","url":"#b-9eb5e0ae11092885f1f12737","role":"section-title"},{"id":"b-0a25f2051efbe96400e9111e","url":"#b-0a25f2051efbe96400e9111e","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5b473f2655f4a3e8bdda3163","type":"h2","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-5b473f2655f4a3e8bdda3163","content":"## 1 · 输入、来源、编码和缓存身份","sha256":"c55c81a2779d4884d73f8f9239637e8601ad2a671e8bfa4b1b0eaf733ce8c149","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-20f239869a46b414683b46a7","prerequisites":[{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-20f239869a46b414683b46a7","type":"p","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-20f239869a46b414683b46a7","content":"六张照片来自 scikit-image 0.25.2：Chelsea 猫（Stefan van der Walt，CC0）、宇航员（NASA，公共领域）、咖啡（Rachel Michetti，CC0）、摄影者（Lav Varshney，CC0）、火箭（SpaceX，公共领域）和星系深场（NASA，公共领域）。原始照片、授权说明、逐文件 SHA-256 均在 `assets/manifest.json`。每张图生成 full、center90、left90、right90 四个确定性视图，共 24 个索引项。每类有两条人工写定查询，共 12 条。","sha256":"a4760dc5c790d3551a0886f0b7e4afeba240e6e6546433a75593c9ee8ca2fc79","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5b473f2655f4a3e8bdda3163","nextBlock":"b-28e75835c1789260edb6412b","prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"}],"relatedBlocks":[]},{"id":"b-28e75835c1789260edb6412b","type":"p","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-28e75835c1789260edb6412b","content":"四个视图来自同一张图，彼此高度相关；这里没有训练／测试拆分，因为没有拟合视觉模型。它们用来观察索引分桶与排序，不是 24 张独立测试照片，更不是六类泛化性能评估。聚类训练只拟合无监督检索索引，不会重新训练 CLIP。","sha256":"40758dc2b27ab13a7646c5b5af382412086396de48f6a362d0c866ac461a59b6","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-20f239869a46b414683b46a7","nextBlock":"b-e7c6e8129bd467e2e0497b73","prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"},{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e7c6e8129bd467e2e0497b73","type":"p","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-e7c6e8129bd467e2e0497b73","content":"![六张真实照片组成的小图库](/assets/display/61b4b65c7be015d923cad24b.webp)","sha256":"a19555b36c40f361b20577ae383941cce9382473f9a009a407ecc3e394e25645","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-28e75835c1789260edb6412b","nextBlock":"b-a1afc11f537e0d8b469f5337","prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"},{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a1afc11f537e0d8b469f5337","type":"p","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-a1afc11f537e0d8b469f5337","content":"真实编码在 2026-09-22 本地 CPU 运行。图像和文字预处理、checkpoint revision 和哈希与 LAB 04 相同；512 维特征分别做 L2 归一化，缓存为 float32。`gallery` shape 为 `[24,512]`，`queries` 为 `[12,512]`。直接把旧猫图四个分数拼成“图像向量”是不合法的：当前包保存的是实际编码器的完整输出。","sha256":"5748751d5292c3aa044b6275be2ca22516edcf83bd727d34669cfe3f93e3aeb8","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e7c6e8129bd467e2e0497b73","nextBlock":"b-5eccbd25a2a5700a2163ed3a","prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"},{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5eccbd25a2a5700a2163ed3a","type":"p","scope":"block-687d09fc176e4c64a0bf836efcbe03f1","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-5eccbd25a2a5700a2163ed3a","content":"[下载独立材料](/course/materials/lecture03-clip-retrieval.zip)。默认只需 `requirements-cache.txt`；完整重算编码需额外 `requirements-inference.txt`、`python fetch_clip.py` 和 `python run_clip_retrieval.py --encode`。缓存原始生成时间和当前读缓存的时间分开记录。","sha256":"6fbf90ab812717a1cc7048a95944cd7f5194e019c122acc2da4909b06ab55514","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a1afc11f537e0d8b469f5337","nextBlock":"b-d6bbe145feaf87c800efa7b3","prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"},{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d6bbe145feaf87c800efa7b3","type":"pre","scope":"block-0befde2587964e63937189481b9abcce","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-d6bbe145feaf87c800efa7b3","content":"```\n# 独立材料，不依赖另一册 notebook 的内存；重复运行复用本项目已下载内容。\nfrom pathlib import Path\nimport io, json, zipfile, requests, sys, hashlib\n_candidates=[Path.cwd()/'lecture03-clip-retrieval', Path.cwd()]\nRETRIEVAL_ROOT=next((p for p in _candidates if (p/'cache/clip-features.npz').exists()),None)\nif RETRIEVAL_ROOT is None:\n    _response=requests.get('https://codingai-lec03.pages.dev/course/materials/lecture03-clip-retrieval.zip',timeout=60)\n    _response.raise_for_status()\n    _data=_response.content\n    print('下载材料 ZIP:',len(_data),'bytes; SHA256',hashlib.sha256(_data).hexdigest())\n    with zipfile.ZipFile(io.BytesIO(_data)) as z:\n        for info in z.infolist():\n            target=(Path.cwd()/info.filename).resolve()\n            assert target.is_relative_to(Path.cwd().resolve()), '拒绝越界路径'\n            if info.is_dir():target.mkdir(parents=True,exist_ok=True)\n            elif not target.exists():\n                target.parent.mkdir(parents=True,exist_ok=True);target.write_bytes(z.read(info))\n    RETRIEVAL_ROOT=Path.cwd()/'lecture03-clip-retrieval'\nassert (RETRIEVAL_ROOT/'cache/provenance.json').is_file()\nsys.path.insert(0,str(RETRIEVAL_ROOT))\nimport run_clip_retrieval as cr\nimport numpy as np\np=json.loads((RETRIEVAL_ROOT/'cache/provenance.json').read_text())\nassert cr.sha(RETRIEVAL_ROOT/'cache/clip-features.npz')==p['cache_sha256']\nassert cr.sha(RETRIEVAL_ROOT/'assets/manifest.json')==p['manifest_sha256']\nmanifest=json.loads((RETRIEVAL_ROOT/'assets/manifest.json').read_text())\nfor r in manifest['gallery']+manifest['relation']+manifest['holder']:\n    assert cr.sha(RETRIEVAL_ROOT/r['path'])==r['sha256']\na=np.load(RETRIEVAL_ROOT/'cache/clip-features.npz')\nprint('已核验真实 CLIP 缓存；生成时间',p['generated_at_utc'])\nprint('本格只载入缓存，没有在当前 notebook 运行 CLIP 编码器。')\nprint('gallery, queries:',a['gallery'].shape,a['queries'].shape)\n\n```","sha256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-687d09fc176e4c64a0bf836efcbe03f1","title":"1 · 输入、来源、编码和缓存身份","number":2},"sectionTitle":"1 · 输入、来源、编码和缓存身份","currentQuestion":"1 · 输入、来源、编码和缓存身份","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5eccbd25a2a5700a2163ed3a","nextBlock":null,"prerequisites":[{"id":"b-5b473f2655f4a3e8bdda3163","url":"#b-5b473f2655f4a3e8bdda3163","role":"section-title"},{"id":"b-20f239869a46b414683b46a7","url":"#b-20f239869a46b414683b46a7","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6449cf4436992853d078180f","type":"h2","scope":"block-5ba73f2552e945a7a94eb9043c0ac480","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-6449cf4436992853d078180f","content":"## 2 · 精确搜索：模型给分，评价定义相关","sha256":"6a6a7b78abfe6364f4ef040e54cd2bf106294e030c2d6a73dcdad1dd69ddfa24","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","number":3},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-08cc3d63cb25ee10997dd916","prerequisites":[{"id":"b-08cc3d63cb25ee10997dd916","url":"#b-08cc3d63cb25ee10997dd916","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-08cc3d63cb25ee10997dd916","type":"p","scope":"block-5ba73f2552e945a7a94eb9043c0ac480","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-08cc3d63cb25ee10997dd916","content":"对于一个文本查询 $q$，精确检索逐个计算 $s_i=q^\\top v_i$ 并取最大的 K 项。归一化不等于校准：cosine 只是排序分数，不是“该图片正确的概率”。同一矩阵转置即可图搜文；不需要另训练一个模型，但两个方向的候选集合和评价单位不同。","sha256":"a9db9edd976ff657caa5941b4245c0b52971ebde344e66c024f0e5ab01b0401f","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","number":3},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"q","definitionContext":"2 · 精确搜索：模型给分，评价定义相关"},{"latex":"s_i=q^\\top v_i","definitionContext":"2 · 精确搜索：模型给分，评价定义相关"}],"previousBlock":"b-6449cf4436992853d078180f","nextBlock":"b-a4b923ba2dce85fc83905954","prerequisites":[{"id":"b-6449cf4436992853d078180f","url":"#b-6449cf4436992853d078180f","role":"section-title"}],"relatedBlocks":[]},{"id":"b-a4b923ba2dce85fc83905954","type":"p","scope":"block-5ba73f2552e945a7a94eb9043c0ac480","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-a4b923ba2dce85fc83905954","content":"本册规定：一个查询对应源类别的四个视图都算相关。**语义 Hit@K** 为“前 K 中至少有一个相关图”的查询比例；它不等于召回全部四个相关图的比例。**ANN top-3 overlap** 为 $|A_3(q)\\cap E_3(q)|/3$ 的平均值，评价近似索引是否找回精确搜索的邻居，完全不使用类别标签。这两项必须分开：模型的精确排序可能错，ANN 也可能完美复制这个错误。","sha256":"6981901db7db96134fa7095db2336567bb8c37f0f76f8e294f664880fb8c1808","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","number":3},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"|A_3(q)\\cap E_3(q)|/3","definitionContext":"2 · 精确搜索：模型给分，评价定义相关"}],"previousBlock":"b-08cc3d63cb25ee10997dd916","nextBlock":"b-90b9c89842d38f1209849fc7","prerequisites":[{"id":"b-6449cf4436992853d078180f","url":"#b-6449cf4436992853d078180f","role":"section-title"},{"id":"b-08cc3d63cb25ee10997dd916","url":"#b-08cc3d63cb25ee10997dd916","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-90b9c89842d38f1209849fc7","type":"p","scope":"block-5ba73f2552e945a7a94eb9043c0ac480","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-90b9c89842d38f1209849fc7","content":"当前小集 exact 文搜图 Hit@3=1.0、图搜文 Hit@1=1.0。它只能说明这些照片和查询能被本模型匹配，不能支持未知照片或复杂关系的泛化结论。LAB 04 的左右关系反例正好显示：整图对象匹配成功不自动推出关系绑定正确。","sha256":"aa8be1410199fba8c51caa638e575eceda30ec6f40f30bbfa56b0107d8f9e20f","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","number":3},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a4b923ba2dce85fc83905954","nextBlock":"b-ed8e447c34587b3ae0fba140","prerequisites":[{"id":"b-6449cf4436992853d078180f","url":"#b-6449cf4436992853d078180f","role":"section-title"},{"id":"b-08cc3d63cb25ee10997dd916","url":"#b-08cc3d63cb25ee10997dd916","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ed8e447c34587b3ae0fba140","type":"pre","scope":"block-e05d4164e12144fea000c0bf4d6b7e2f","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-ed8e447c34587b3ae0fba140","content":"```\nX,Q=a['gallery'],a['queries']\nassert np.allclose(np.linalg.norm(X,axis=1),1,atol=2e-6)\nlabels=np.array([r['label'] for r in manifest['gallery']])\ntruth=[r['label'] for r in manifest['queries']]\nS=Q@X.T\nexact=np.stack([cr.stable_rank(row,k=3) for row in S])\nfor i,row in enumerate(exact):\n    print(manifest['queries'][i]['text'],'->',[(manifest['gallery'][j]['id'],round(float(S[i,j]),4)) for j in row])\nhit3=np.mean([any(labels[j]==truth[i] for j in row) for i,row in enumerate(exact)])\nprint('exact semantic Hit@3:',hit3)\n# 反方向：每张图对 12 条文字排序。每类有两条同义候选。\ni2t=np.stack([cr.stable_rank(row,k=1) for row in S.T])\nprint('image-to-text Hit@1:',np.mean([truth[row[0]]==labels[i] for i,row in enumerate(i2t)]))\n\n```","sha256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-5ba73f2552e945a7a94eb9043c0ac480","title":"2 · 精确搜索：模型给分，评价定义相关","number":3},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-90b9c89842d38f1209849fc7","nextBlock":null,"prerequisites":[{"id":"b-6449cf4436992853d078180f","url":"#b-6449cf4436992853d078180f","role":"section-title"},{"id":"b-08cc3d63cb25ee10997dd916","url":"#b-08cc3d63cb25ee10997dd916","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e370bed2cb4a098443b22f9b","type":"h2","scope":"block-62a7fe6e03324fd9877c139c11e4ce0e","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-e370bed2cb4a098443b22f9b","content":"## 3 · 实际的近似索引：先路由到簇，再在簇内精排","sha256":"72042c5a397268efdedab711c30b3be6e811dbf705389989de882bfab7e7565c","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-8808b0b1b707c5b2c59c8551","prerequisites":[{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8808b0b1b707c5b2c59c8551","type":"p","scope":"block-62a7fe6e03324fd9877c139c11e4ce0e","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-8808b0b1b707c5b2c59c8551","content":"本实验实现 IVF-Flat，而不只是打印一个标为 ANN 的 Recall。首先对归一化图像特征做固定 seed=17 的 spherical k-means，得到 8 个中心；每张图分配到 cosine 最大的中心，倒排表保存该簇内真实图片 ID。查询时先计算到 8 个中心的分数，只打开最近的 `nprobe` 个簇，然后对候选图片的原 float32 向量计算精确 cosine 并排序。","sha256":"e912abb9cf15500ad588e974eab6aaf8e3a3dbfb4a3289c72d0cebe6988f1272","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e370bed2cb4a098443b22f9b","nextBlock":"b-2e6ab49d2d128c2dade1b1e1","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"}],"relatedBlocks":[]},{"id":"b-2e6ab49d2d128c2dade1b1e1","type":"p","scope":"block-62a7fe6e03324fd9877c139c11e4ce0e","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-2e6ab49d2d128c2dade1b1e1","content":"近似发生在“哪些簇被打开”，不是候选内部的打分。一个本来应在 exact 前三的图只要被放进未打开的簇，就可能漏检。`nprobe` 增大通常减少这种遗漏，但候选扫描增多；当 `nprobe=8` 时所有桶都打开，应恢复 exact 的相同排名。本例以图片 ID 作为相同分数的固定次序，避免把平分的排序差异误认为近似错误。","sha256":"6f11c5e11524e032f183e4cb3071fb0773bf2a4e4ec7c99fc8f90f22962ea858","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8808b0b1b707c5b2c59c8551","nextBlock":"b-c816a944dbafffde0a75b822","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c816a944dbafffde0a75b822","type":"p","scope":"block-62a7fe6e03324fd9877c139c11e4ce0e","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-c816a944dbafffde0a75b822","content":"下面是真正参与当前实验的聚类代码；完整脚本还有文件核验、向量缓存和结果保存。","sha256":"17197a3b41b63d107be94a74b22c9ae450a89fee34051c2caca715be92157969","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-2e6ab49d2d128c2dade1b1e1","nextBlock":"b-1c868f0f1b4271af83312dc7","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1c868f0f1b4271af83312dc7","type":"pre","scope":"block-645d32ebb74d4ed68f805e40027fb013","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-1c868f0f1b4271af83312dc7","content":"```\nunit=cr.unit\ndef spherical_kmeans(X,nlist=8,seed=17,iterations=40):\n    rng=np.random.default_rng(seed)\n    centers=X[rng.choice(len(X),nlist,replace=False)].copy()\n    for _ in range(iterations):\n        ids=(X@centers.T).argmax(1)\n        new=np.stack([unit(X[ids==i].mean(0,keepdims=True))[0] if np.any(ids==i) else centers[i] for i in range(nlist)])\n        if np.allclose(new,centers,atol=1e-7):break\n        centers=new\n    ids=(X@centers.T).argmax(1)\n    return centers,[np.flatnonzero(ids==i) for i in range(nlist)]\n\ncenters,lists=spherical_kmeans(X,nlist=8,seed=17)\ndef ivf_search(q,nprobe,k=3):\n    buckets=cr.stable_rank(q@centers.T,k=nprobe)\n    candidates=np.concatenate([lists[int(b)] for b in buckets])\n    ranked=cr.stable_rank(q@X[candidates].T,ids=candidates,k=k)\n    return ranked,candidates\nfor nprobe in [1,2,4,8]:\n    answer=[ivf_search(q,nprobe) for q in Q]\n    overlap=np.mean([len(set(e)&set(r))/3 for e,(r,c) in zip(exact,answer)])\n    hit=np.mean([any(labels[j]==truth[i] for j in r) for i,(r,c) in enumerate(answer)])\n    print('nprobe',nprobe,'mean scanned',np.mean([len(c) for r,c in answer]),'overlap',overlap,'Hit@3',hit)\n    if nprobe==8:assert all(np.array_equal(e,r) for e,(r,c) in zip(exact,answer))\n# 逐项找出 nprobe=1 的遗漏，不只看一个平均分。\nfor i,q in enumerate(Q):\n    ranked,candidates=ivf_search(q,1)\n    missing=sorted(set(exact[i])-set(ranked))\n    if missing:\n        print('query:',manifest['queries'][i]['text'])\n        print('missed exact neighbors:',[manifest['gallery'][j]['id'] for j in missing])\n\n```","sha256":"03548e94c27e646b9073eeed385278bb117959dca4e57b428eeb514af543181c","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c816a944dbafffde0a75b822","nextBlock":"b-9f1ece11d4c55fb9ec961583","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9f1ece11d4c55fb9ec961583","type":"p","scope":"block-9a00ee8cea714be583e46603becc2e69","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-9f1ece11d4c55fb9ec961583","content":"**选读结果：近似索引，不是第三讲新增主讲段。**","sha256":"4199206c98f1400fd4f86b9a1b6859bfd6336b777ff8ee4644f10049430a0e81","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1c868f0f1b4271af83312dc7","nextBlock":"b-fce7fbb83e5873caf9d7e3ed","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-fce7fbb83e5873caf9d7e3ed","type":"table","scope":"block-9a00ee8cea714be583e46603becc2e69","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-fce7fbb83e5873caf9d7e3ed","content":"| 方法 | 平均扫描图片向量 | exact top-3 重合率 | 语义 Hit@3 | 12查询中位耗时 / p95，ms |\n| --- | --- | --- | --- | --- |\n| exact | 24 | 1.0000 | 1.0000 | 0.0456 / 0.0609 |\n| IVF nprobe=1 | 4.17 | 0.7778 | 1.0000 | 0.1016 / 0.1672 |\n| IVF nprobe=2 | 7.67 | 1.0000 | 1.0000 | 0.1084 / 0.2591 |\n| IVF nprobe=4 | 13.25 | 1.0000 | 1.0000 | 0.1185 / 0.1837 |\n| IVF nprobe=8 | 24.00 | 1.0000 | 1.0000 | 0.1370 / 0.2236 |","sha256":"19e1f4ed476f267b8d54876e0f38b9544dbd5efb15a13fa7844ca5e3c57b18fd","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["方法","平均扫描图片向量","exact top-3 重合率","语义 Hit@3","12查询中位耗时 / p95，ms"],"rows":[["方法","平均扫描图片向量","exact top-3 重合率","语义 Hit@3","12查询中位耗时 / p95，ms"],["exact","24","1.0000","1.0000","0.0456 / 0.0609"],["IVF nprobe=1","4.17","0.7778","1.0000","0.1016 / 0.1672"],["IVF nprobe=2","7.67","1.0000","1.0000","0.1084 / 0.2591"],["IVF nprobe=4","13.25","1.0000","1.0000","0.1185 / 0.1837"],["IVF nprobe=8","24.00","1.0000","1.0000","0.1370 / 0.2236"]]},"previousBlock":"b-9f1ece11d4c55fb9ec961583","nextBlock":"b-498917ee920c04e5fb9b2488","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-498917ee920c04e5fb9b2488","type":"p","scope":"block-9a00ee8cea714be583e46603becc2e69","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-498917ee920c04e5fb9b2488","content":"这是2026-09-22 本地 CPU 的保存实测，不是解析复杂度。NumPy 2.3.5，单 BLAS 线程；每个样本点运行全部 12 查询，预热 20 次，测量 100 次。计时包括 Python 循环、路由、候选抽取和排序，排除磁盘读写、编码和索引构建。完整 BLAS 信息及索引构建时间见 `verified/retrieval-results.json`。","sha256":"deb1e19b802e3c9a8340b7f6c73704f55fd26daae1b19a560c7e056ce1a3d9e2","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-fce7fbb83e5873caf9d7e3ed","nextBlock":"b-44377a1126fbbd8a8c6d25bf","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-44377a1126fbbd8a8c6d25bf","type":"p","scope":"block-9a00ee8cea714be583e46603becc2e69","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-44377a1126fbbd8a8c6d25bf","content":"`nprobe=1` 的 exact 邻居重合率只有 0.7778，但语义 Hit@3 仍是 1：有些同源裁剪被漏掉，仍有另一个正确类别裁剪留下。这直接说明两种指标回答不同问题。`nprobe=2` 在这个小集恢复全部 exact 前三；它不保证其他数据也如此。","sha256":"f800f03ae61070290c48f513109f46c73596c6752c4ce0097251d87c426a99d0","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-498917ee920c04e5fb9b2488","nextBlock":"b-6f090a8ce99fc9c23e03e00a","prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6f090a8ce99fc9c23e03e00a","type":"p","scope":"block-9a00ee8cea714be583e46603becc2e69","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-6f090a8ce99fc9c23e03e00a","content":"所有 ANN 配置都比 exact 慢，因为图库仅 24 项，矩阵点积太便宜，Python 桶访问和排序开销更突出。扫描数下降并不自动意味着延迟下降。共享CPU的调度也会影响这些微小耗时。大库里是否更快必须再测；不得把此处计算次数乘一个任意常数作为“毫秒”。","sha256":"1ddf1e6f4a92876b964902f2f6ed34917b02a0822b4f77a25e14c3e0b6358d91","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-62a7fe6e03324fd9877c139c11e4ce0e","title":"3 · 实际的近似索引：先路由到簇，再在簇内精排","number":4},"sectionTitle":"3 · 实际的近似索引：先路由到簇，再在簇内精排","currentQuestion":"3 · 实际的近似索引：先路由到簇，再在簇内精排","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-44377a1126fbbd8a8c6d25bf","nextBlock":null,"prerequisites":[{"id":"b-e370bed2cb4a098443b22f9b","url":"#b-e370bed2cb4a098443b22f9b","role":"section-title"},{"id":"b-8808b0b1b707c5b2c59c8551","url":"#b-8808b0b1b707c5b2c59c8551","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e39569319db3df0da74ccd02","type":"h2","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-e39569319db3df0da74ccd02","content":"## 4 · 缓存节约什么，不能节约什么？","sha256":"cc34b1d8d96a4a8b5be556959bf607fe886b3e40109adebba891f9b6d77ccf4f","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-c03c3ecc9f0d555d9dea1edb","prerequisites":[{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c03c3ecc9f0d555d9dea1edb","type":"p","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-c03c3ecc9f0d555d9dea1edb","content":"下表是同一 $N=24,Q=12,d=512$ 任务的解析工作量，不是把未执行的全部逐对编码写成实测。每次“样本编码”指一个图片或一条文字通过对应编码器；批处理调用可以一次处理多个样本，二者不相等。","sha256":"29de550b073aa289c5c63996c445f8ef9074e4112c55ccd3992e7ea786a72ca4","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"N=24,Q=12,d=512","definitionContext":"4 · 缓存节约什么，不能节约什么？"}],"previousBlock":"b-e39569319db3df0da74ccd02","nextBlock":"b-a089d0bd2fea0c35b8c52ac6","prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"}],"relatedBlocks":[]},{"id":"b-a089d0bd2fea0c35b8c52ac6","type":"table","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-a089d0bd2fea0c35b8c52ac6","content":"| 组织方式 | 图像样本编码 | 文字样本编码 | 相似度计算 | 可复用内容 |\n| --- | --- | --- | --- | --- |\n| 每对都重编码 | 288 | 288 | 288 个512维点积 | 无 |\n| 双编码器缓存 | 24（入库一次） | 12 | 288 个512维点积 | 图像向量可跨查询复用 |\n| 新增一条查询 | 0 | 1 | exact为24个点积 | 原图像库不变 |\n| IVF nprobe=1 | 入库同上 | 查询同上 | 每查询8个中心点积+平均4.17个图片点积 | 中心、倒排表、图片向量 |","sha256":"43f16868b0a2ff3caaf4097219db411875fa2eddf5ab688376216b11ba085931","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["组织方式","图像样本编码","文字样本编码","相似度计算","可复用内容"],"rows":[["组织方式","图像样本编码","文字样本编码","相似度计算","可复用内容"],["每对都重编码","288","288","288 个512维点积","无"],["双编码器缓存","24（入库一次）","12","288 个512维点积","图像向量可跨查询复用"],["新增一条查询","0","1","exact为24个点积","原图像库不变"],["IVF nprobe=1","入库同上","查询同上","每查询8个中心点积+平均4.17个图片点积","中心、倒排表、图片向量"]]},"previousBlock":"b-c03c3ecc9f0d555d9dea1edb","nextBlock":"b-0f80068bffcc65f34401893e","prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"},{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0f80068bffcc65f34401893e","type":"p","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-0f80068bffcc65f34401893e","content":"图片矩阵为 $24×512×4=49,152$ 字节；8个中心另占16,384字节，倒排 ID 另占192字节（保存基准使用的 int64）。这没有计入 Python 对象、图片文件和模型权重，不能直接称整个服务的内存。","sha256":"7df53ec83d5158fab387bde9da8775e8145a415001ec6c33bbc5889e686315c6","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"24×512×4=49,152","definitionContext":"4 · 缓存节约什么，不能节约什么？"}],"previousBlock":"b-a089d0bd2fea0c35b8c52ac6","nextBlock":"b-c9420e8d4c8e0aecbf1b4db2","prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"},{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c9420e8d4c8e0aecbf1b4db2","type":"p","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-c9420e8d4c8e0aecbf1b4db2","content":"2026-09-22 的全部实测编码还包括候选与关系扩展，共 36 个图像样本和24条文字，分别以9个图像批次和1个文字批次编码；另做两对逐对重编码核验（额外2图+2文），与缓存点积最大差8.94×10⁻⁸。将CLIP按配对重复调用，算的仍然是 $f(I)^\\top g(T)$，并没有出现图文联合注意力。","sha256":"0058f1b1f72f4b12fed94a47316508cdf7a76909d978c569cc516bd2b096b4c4","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"f(I)^\\top g(T)","definitionContext":"4 · 缓存节约什么，不能节约什么？"}],"previousBlock":"b-0f80068bffcc65f34401893e","nextBlock":"b-1c47991ed9a184b1c9668e7b","prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"},{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1c47991ed9a184b1c9668e7b","type":"p","scope":"block-304aa2a46d41405db647924c1a08d5c0","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-1c47991ed9a184b1c9668e7b","content":"这次36图编码含预处理共2.726秒、24文共0.205秒，是一趟本地CPU墙钟时间，不含模型加载/下载，不能当作稳定线上延迟。代码另行测量缓存搜索分布，已经在上表展示。更换模型、revision、预处理或图片内容会使旧缓存失效；只增加候选文字不会改变已有图片向量。","sha256":"0aca1a9483c1d58d13fe4c22db96395bf7ece1daf2b5e25e23c67d8e06f67d18","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c9420e8d4c8e0aecbf1b4db2","nextBlock":"b-6c4c220e2a32c4d14a619a93","prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"},{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6c4c220e2a32c4d14a619a93","type":"pre","scope":"block-5d25311e26c2487a838e6e92dcd3946a","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-6c4c220e2a32c4d14a619a93","content":"```\nN,d=X.shape;Qn=len(Q)\nprint('解析样本编码次数：每对重算',N*Qn,N*Qn,'；缓存',N,Qn)\nprint('矩阵字节：',X.nbytes,'；中心字节：',centers.nbytes,'；ID字节：',sum(l.nbytes for l in lists))\nprint('真实缓存生成记录：',p['image_count'],p['text_count'],'样本；',p['image_batch_calls'],p['text_batch_calls'],'批次')\nprint('另两对逐对重算与缓存的最大差：',p['pairwise_validation_max_abs_delta'])\n\n```","sha256":"1f446813e339d77894338425dfd088564fcaa921bd9d6fcdb446e1a9523375fd","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-304aa2a46d41405db647924c1a08d5c0","title":"4 · 缓存节约什么，不能节约什么？","number":5},"sectionTitle":"4 · 缓存节约什么，不能节约什么？","currentQuestion":"4 · 缓存节约什么，不能节约什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1c47991ed9a184b1c9668e7b","nextBlock":null,"prerequisites":[{"id":"b-e39569319db3df0da74ccd02","url":"#b-e39569319db3df0da74ccd02","role":"section-title"},{"id":"b-c03c3ecc9f0d555d9dea1edb","url":"#b-c03c3ecc9f0d555d9dea1edb","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8bc180a5a728111098a325e0","type":"h2","scope":"block-8cfb433dc5cc4c4d9b8052e80463dfb5","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-8bc180a5a728111098a325e0","content":"## 5 · 查询依赖的交互：一个可运行的区域加权对照","sha256":"2fd9111f853e5d93f7d59d72c39d6652bb45bfaa5b4f36353c00e0eca228db69","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","number":6},"sectionTitle":"5 · 查询依赖的交互：一个可运行的区域加权对照","currentQuestion":"5 · 查询依赖的交互：一个可运行的区域加权对照","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-4468bdbe15c85ac848a48978","prerequisites":[{"id":"b-4468bdbe15c85ac848a48978","url":"#b-4468bdbe15c85ac848a48978","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4468bdbe15c85ac848a48978","type":"p","scope":"block-8cfb433dc5cc4c4d9b8052e80463dfb5","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-4468bdbe15c85ac848a48978","content":"“每对都调用模型”不等于“有图文交互”。我们再定义一个小而完整的 query-dependent 后期交互：先缓存左右两个照片区域的 CLIP 向量 $r_1,r_2$；对每一个查询 $q$，计算 $u_j=q^\\top r_j$，然后用 $w_j=\\mathrm{softmax}(u_j/0.05)$ 加权，得到分数 $s=\\sum_jw_ju_j$。查询不同，区域权重和汇总表示不同，所以它确实在比较时使用了图和文的共同信息；但它是本册定义的加权规则，没有训练新的联合编码器，也不是 CLIP 官方的全图匹配分数。","sha256":"1c0a54709b04ee6babf39f66eee1768f60b0f62b5c9cd89bb4c23667b8ade7c6","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","number":6},"sectionTitle":"5 · 查询依赖的交互：一个可运行的区域加权对照","currentQuestion":"5 · 查询依赖的交互：一个可运行的区域加权对照","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"r_1,r_2","definitionContext":"5 · 查询依赖的交互：一个可运行的区域加权对照"},{"latex":"q","definitionContext":"5 · 查询依赖的交互：一个可运行的区域加权对照"},{"latex":"u_j=q^\\top r_j","definitionContext":"5 · 查询依赖的交互：一个可运行的区域加权对照"},{"latex":"w_j=\\mathrm{softmax}(u_j/0.05)","definitionContext":"5 · 查询依赖的交互：一个可运行的区域加权对照"},{"latex":"s=\\sum_jw_ju_j","definitionContext":"5 · 查询依赖的交互：一个可运行的区域加权对照"}],"previousBlock":"b-8bc180a5a728111098a325e0","nextBlock":"b-06f2a34e7ea59bb2e62e382c","prerequisites":[{"id":"b-8bc180a5a728111098a325e0","url":"#b-8bc180a5a728111098a325e0","role":"section-title"}],"relatedBlocks":[]},{"id":"b-06f2a34e7ea59bb2e62e382c","type":"p","scope":"block-8cfb433dc5cc4c4d9b8052e80463dfb5","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-06f2a34e7ea59bb2e62e382c","content":"在“猫左、宇航员右”拼贴上，cat 查询给左猫区94.15%的权重；astronaut 查询给右宇航员区80.08%。这是一项可观察的查询依赖变化。它的代价是每对查询与图要计算多个区域点积，缓存也从一向量变成区域集合；由于区域特征独立生成，它仍可部分预计算。","sha256":"9131075fd10fc81a22296a0bfdfa26a9b81a5fc2506249842fe1f424e20c20b0","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","number":6},"sectionTitle":"5 · 查询依赖的交互：一个可运行的区域加权对照","currentQuestion":"5 · 查询依赖的交互：一个可运行的区域加权对照","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4468bdbe15c85ac848a48978","nextBlock":"b-4b4f17c9f28c68ab9464d33a","prerequisites":[{"id":"b-8bc180a5a728111098a325e0","url":"#b-8bc180a5a728111098a325e0","role":"section-title"},{"id":"b-4468bdbe15c85ac848a48978","url":"#b-4468bdbe15c85ac848a48978","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4b4f17c9f28c68ab9464d33a","type":"p","scope":"block-8cfb433dc5cc4c4d9b8052e80463dfb5","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-4b4f17c9f28c68ab9464d33a","content":"接着使用两条“谁在左/右”的关系句。交换区域顺序后，下述加权分数**完全相同**，因为这个公式对区域排列不敏感；它没有使用坐标。这不是代码 bug，而是设计本身丢失了顺序。如果需要真正的区域关系，需要显式位置、关系模块或经训练的联合模型。一个一般的 cross-encoder 会在内部让图文 token 相互条件化，通常不能将整次交互压成一个与查询无关的图片向量；本册只给其结构和成本解释，没有假装运行或比较某个未加载的 cross-encoder。","sha256":"7319327aded1ab0df3bfecb88955ac7ec5e20b4a260492e8c92a288c7f8f2c0e","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","number":6},"sectionTitle":"5 · 查询依赖的交互：一个可运行的区域加权对照","currentQuestion":"5 · 查询依赖的交互：一个可运行的区域加权对照","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-06f2a34e7ea59bb2e62e382c","nextBlock":"b-fe57b7afef4ca583a695c11e","prerequisites":[{"id":"b-8bc180a5a728111098a325e0","url":"#b-8bc180a5a728111098a325e0","role":"section-title"},{"id":"b-4468bdbe15c85ac848a48978","url":"#b-4468bdbe15c85ac848a48978","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-fe57b7afef4ca583a695c11e","type":"pre","scope":"block-06052931c0434d36aae2251b7873e30c","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-fe57b7afef4ca583a695c11e","content":"```\nR=a['relation_regions'][:,1:]  # 两图 × 两区域 × 512，丢弃full区域\n# 同一图片换查询，观察权重确实变化。\natomic=R[0]@Q[[0,2]].T\nweights=np.exp((atomic-atomic.max(0,keepdims=True))/.05)\nweights/=weights.sum(0,keepdims=True)\nprint('cat / astronaut 查询的 [左区,右区] 权重：',weights.T)\n# 同样两个对象交换左右；无坐标的对称聚合不可能分辨顺序。\nlocal=np.einsum('ijd,kd->ikj',R,a['relation_text'])\nw=np.exp((local-local.max(-1,keepdims=True))/.05);w/=w.sum(-1,keepdims=True)\nscore=(w*local).sum(-1)\nprint('两张交换图 × 两条关系句：',score)\nassert np.allclose(score[0],score[1],atol=1e-6)\n\n```","sha256":"1c94690e55052c3ecda347fd63eda585c74c30839c4f2ee4f7e60c12cef100b7","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-8cfb433dc5cc4c4d9b8052e80463dfb5","title":"5 · 查询依赖的交互：一个可运行的区域加权对照","number":6},"sectionTitle":"5 · 查询依赖的交互：一个可运行的区域加权对照","currentQuestion":"5 · 查询依赖的交互：一个可运行的区域加权对照","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4b4f17c9f28c68ab9464d33a","nextBlock":null,"prerequisites":[{"id":"b-8bc180a5a728111098a325e0","url":"#b-8bc180a5a728111098a325e0","role":"section-title"},{"id":"b-4468bdbe15c85ac848a48978","url":"#b-4468bdbe15c85ac848a48978","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c7f027143638a845fdfa8f95","type":"h2","scope":"block-00d45a521ea24f3894d71b0c128448a3","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-c7f027143638a845fdfa8f95","content":"## 6 · 做一个有意义的改变，并解释它改变了哪层","sha256":"bbae6b88d175740fcc388f6a8c87e215f238a735f871795aaf66c88b7cab6763","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-7c450cf26df38fb0b34747f0","prerequisites":[{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-7c450cf26df38fb0b34747f0","type":"p","scope":"block-00d45a521ea24f3894d71b0c128448a3","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-7c450cf26df38fb0b34747f0","content":"先把 `nprobe=1` 改成2，固定向量、查询、真值和K，记录漏掉的具体图片ID如何变化。这只改变搜索近似程度；模型表示没有改善。再把K改为1，重新计算 Hit@1 和 top-1 overlap，不得把不同K的数直接拼在同一结论里。若改变聚类seed，先记录簇大小和对应遗漏；单次成功不等于所有划分都成功。","sha256":"42636dfc286ae067e3a3dd324d3254fd946cf97ff5a9b437d0cd7499fd2dfb67","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c7f027143638a845fdfa8f95","nextBlock":"b-5fc1389d0817cd23b44b0d31","prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"}],"relatedBlocks":[]},{"id":"b-5fc1389d0817cd23b44b0d31","type":"p","scope":"block-00d45a521ea24f3894d71b0c128448a3","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-5fc1389d0817cd23b44b0d31","content":"若想把第二条猫查询换成另一个同义模板，必须重算该文本编码，而不是在旧查询ID下改文字标题。默认缓存播放明确拒绝冒充新模型输出；在材料包副本中只修改 `assets/manifest.json` 的 `queries[1].text`，保留cat相关性定义，随后执行 `python run_clip_retrieval.py --encode`，才会为新文字生成真实特征和新的缓存身份。若改成“谁在左边”，需要另选同场多对象输入并定义坐标真值，不能沿用单对象类别标签；对应输入和反例已在LAB04。保留已验证的包，新实验应在一个副本目录执行，以便比较输入hash。","sha256":"3df82b0623b773e41f2ed517ca902a17ceeae0a40bd60e17ab4b0ab30bdb5fb8","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7c450cf26df38fb0b34747f0","nextBlock":"b-b9f6586d85ba1c2a450be8b6","prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"},{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b9f6586d85ba1c2a450be8b6","type":"p","scope":"block-00d45a521ea24f3894d71b0c128448a3","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-b9f6586d85ba1c2a450be8b6","content":"最后回到任务：caption 需生成新句子，检索只能返回已经入库的候选；VQA要针对问题产生答案，grounding要交付可检验区域。检索用一个独立向量换来便于缓存和索引的结构，同时未承诺词级关系、坐标或完整生成。这一取舍通过当前真实关系反例和区域加权例可亲自检验。","sha256":"c60d3777bf170bdaa4d3d1080e566dc13881ed5547b9588c256b50c81668901d","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5fc1389d0817cd23b44b0d31","nextBlock":"b-4945e8dd8115ee0e4fb5ef07","prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"},{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4945e8dd8115ee0e4fb5ef07","type":"p","scope":"block-00d45a521ea24f3894d71b0c128448a3","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-4945e8dd8115ee0e4fb5ef07","content":"**保存自己的运行：**执行下面单元会在新UTC时间目录写检索结果、实际计时、环境和脚本hash；默认只复用真实CLIP缓存。`verified/` 保留2026-09-22 完整编码基准，`legacy/` 保留旧实验，互不改日期。","sha256":"683fb353614b8caea2b20354148eb392f1ae5b27cdddc2afc985881ecd61869e","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b9f6586d85ba1c2a450be8b6","nextBlock":"b-d02b62b73d372ffcb27a7e28","prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"},{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d02b62b73d372ffcb27a7e28","type":"pre","scope":"block-d0aadb6d836c4b38abb5a326b9eea3a8","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-d02b62b73d372ffcb27a7e28","content":"```\nimport subprocess\ncompleted=subprocess.run([sys.executable,str(RETRIEVAL_ROOT/'run_clip_retrieval.py')],check=True,text=True,capture_output=True)\nprint(completed.stdout)\nprint('当前运行只重做检索；完整图文编码的生成身份见cache/provenance.json。')\n\n```","sha256":"a586469ccc83fb5dcf05cbbe1b152e57de2fd97ec876b73756c1a3bac5a9d09c","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4945e8dd8115ee0e4fb5ef07","nextBlock":"b-35bdb5ce98c17c8997b74c3d","prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"},{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-35bdb5ce98c17c8997b74c3d","type":"p","scope":"block-03e5b572855240478ac76bd5f0f39568","url":"https://codingai-lec03.pages.dev/course/lab12-图文检索与表示缓存.html#b-35bdb5ce98c17c8997b74c3d","content":"来源与实现边界：[OpenAI CLIP 官方代码](https://github.com/openai/CLIP)、[固定 checkpoint](https://huggingface.co/openai/clip-vit-base-patch32/tree/3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268)、[scikit-image 数据文档](https://scikit-image.org/docs/0.25.x/api/skimage.data.html)。本册的8簇 spherical k-means IVF-Flat 和区域加权是透明的教学实现；未调用FAISS，不声称复现生产规模索引，也未训练新的cross-encoder。","sha256":"fcd877d1c393bc745c961addcd221b12f2ddf742a1feec276a9658eddddb9f9d","chapter":{"id":"course","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"unit":{"id":"lab12-图文检索与表示缓存","title":"LAB 12 · CLIP延伸：缓存与检索（近似索引选读）"},"page":{"id":"reading-block-00d45a521ea24f3894d71b0c128448a3","title":"6 · 做一个有意义的改变，并解释它改变了哪层","number":7},"sectionTitle":"6 · 做一个有意义的改变，并解释它改变了哪层","currentQuestion":"6 · 做一个有意义的改变，并解释它改变了哪层","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-d02b62b73d372ffcb27a7e28","nextBlock":null,"prerequisites":[{"id":"b-c7f027143638a845fdfa8f95","url":"#b-c7f027143638a845fdfa8f95","role":"section-title"},{"id":"b-7c450cf26df38fb0b34747f0","url":"#b-7c450cf26df38fb0b34747f0","role":"problem-context"}],"relatedBlocks":[]}]}
