aboutsummaryrefslogtreecommitdiff
path: root/libffwd/late.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-27 00:58:05 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-27 01:03:41 +0200
commitaf55803d0dff9eb692c760c8d486e736c945061d (patch)
tree0875a1112bf98304e445e0544c4309670d6f4769 /libffwd/late.c
parent0f861b7f3098750ddee4f6570f3be228d1da5320 (diff)
downloadffwd-af55803d0dff9eb692c760c8d486e736c945061d.tar.gz
ffwd-af55803d0dff9eb692c760c8d486e736c945061d.zip
chore: clean up comment formatting and wording
Diffstat (limited to 'libffwd/late.c')
-rw-r--r--libffwd/late.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/libffwd/late.c b/libffwd/late.c
index e086ad3..9418a20 100644
--- a/libffwd/late.c
+++ b/libffwd/late.c
@@ -1,3 +1,16 @@
+/*
+ * Late-interaction model.
+ *
+ * A late-interaction model is a pooled base model plus a 1_Dense linear
+ * projection from hidden states to token vectors.
+ *
+ * Instead of pooling to one vector, it keeps one projected vector per kept token
+ * and scores query/doc pairs with MaxSim.
+ *
+ * Reuses the base model's packed forward pass and workspace. This layer only
+ * owns the projection, token-vector buffer, and scoring.
+ */
+
#include "ffwd.h"
#include "model_internal.h"
#include "kernels.h"
@@ -8,17 +21,6 @@
#include <limits.h>
#include <float.h>
-/* ========================================================================
- * Late-interaction model
- *
- * A late-interaction model is a pooled base model plus a 1_Dense linear
- * projection from hidden states to token vectors. Instead of pooling to one
- * vector, it keeps one projected vector per kept token and scores query/doc
- * pairs with MaxSim. It reuses the base model's packed forward pass and
- * workspace; only the projection, the token-vector buffer, and the scoring
- * live here.
- * ======================================================================== */
-
struct ffwd_late_model {
ffwd_model_t *base;
safetensors_file_t *dense_sf;
@@ -107,8 +109,9 @@ const ffwd_config_t *ffwd_late_model_config(const ffwd_late_model_t *model) {
int ffwd_late_model_token_dim(const ffwd_late_model_t *model) { return model ? model->token_dim : 0; }
-/* Internal (internal.h): expose the base model and projection so GPU
- * backends can upload them to device without seeing struct ffwd_late_model. */
+/* Internal (internal.h):
+ * expose the base model and projection so GPU backends can upload them to the
+ * device without seeing struct ffwd_late_model. */
ffwd_model_t *ffwd_late_model_base(const ffwd_late_model_t *model) {
return model ? model->base : NULL;
}