File size: 60,160 Bytes
ae7d591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:4500
- loss:MatryoshkaLoss
- loss:MultipleNegativesRankingLoss
base_model: ibm-granite/granite-embedding-english-r2
widget:
- source_sentence: You are tasked with creating a module in Elm to render an article
    document. The module should include functions to render the body, navigation,
    main content, titles, headings, subheadings, paragraphs, code blocks, images,
    and references. You need to define the necessary types and functions to achieve
    this.
  sentences:
  - '4605'
  - "Context: \nAnswer: ```elm\nmodule ArticleRenderer exposing (Rendered, renderDocument,\
    \ body, navigation, mainContent, title, heading, subheading, paragraph, codeBlock,\
    \ imageBlock, renderReference)\n\nimport Html exposing (Html, div, nav, main,\
    \ h1, h2, h3, p, img, pre, figure, a, span)\nimport Html.Attributes exposing (style,\
    \ src, href, target, rel, hidden, type_)\nimport Html.Styled.Attributes as Attributes\
    \ exposing (css)\nimport Document exposing (Inline, FlatInline, Key, Text, Link,\
    \ Reference, Code, Image)\n\n\ntype alias Rendered msg =\n    Html msg\n\n\n--\
    \ Navigation\nnavigation : Rendered msg\nnavigation =\n    Html.nav\n        [\
    \ css [ Css.marginBottom (rem 1) ]\n        ]\n        [ navLink \"Go back to\
    \ overview\" Route.Index\n        ]\n\n\nnavLink : String -> Route -> Rendered\
    \ msg\nnavLink text route =\n    viewLink\n        { url = Route.toPath route\n\
    \        , text = [ Html.text text ]\n        , styles = [ Css.fontStyle Css.italic\
    \ ]\n        }\n\n\n-- Document rendering\nrenderDocument : Article -> Rendered\
    \ msg\nrenderDocument article =\n    article.document\n        |> List.map renderBlock\n\
    \        |> document\n\n\nrenderBlock : Block -> Rendered msg\nrenderBlock block\
    \ =\n    case block of\n        Title content ->\n            title content\n\n\
    \        Heading contents ->\n            heading contents\n\n        Subheading\
    \ contents ->\n            subheading contents\n\n        Paragraph contents ->\n\
    \            paragraph [] contents\n\n        CodeBlock code ->\n            codeBlock\
    \ code\n\n        ImageBlock image ->\n            imageBlock image\n\n\n-- Landmarks\n\
    body : List (Rendered msg) -> Rendered msg\nbody content =\n    Html.div\n   \
    \     [ css\n            [ Css.padding (rem 1)\n            , Css.maxWidth (rem\
    \ 48)\n            , Css.margin Css.auto\n            ]\n        ]\n        content\n\
    \n\nmainContent : List (Rendered msg) -> Rendered msg\nmainContent contents =\n\
    \    Html.main_ [] contents\n\n\n-- Text\ntitle : String -> Rendered msg\ntitle\
    \ text =\n    Html.h1\n        [ css\n            [ headingStyle\n           \
    \ , Css.fontSize (rem 1.5)\n            ]\n        ]\n        [ Html.text text\
    \ ]\n\n\nheading : List (Inline Path) -> Rendered msg\nheading contents =\n  \
    \  Html.h2\n        [ css\n            [ headingStyle\n            , Css.fontSize\
    \ (rem 1.25)\n            ]\n        ]\n        (List.map renderInline contents)\n\
    \n\nsubheading : List (Inline Path) -> Rendered msg\nsubheading contents =\n \
    \   Html.h3\n        [ css\n            [ headingStyle\n            , Css.fontSize\
    \ (rem 1.1)\n            ]\n        ]\n        (List.map renderInline contents)\n\
    \n\nparagraph : List Css.Style -> List (Inline Path) -> Rendered msg\nparagraph\
    \ styles content =\n    Html.p\n        [ css (paragraphStyle :: styles)\n   \
    \     ]\n        (List.map renderInline content)\n\n\ncodeBlock : Document.Code\
    \ -> Rendered msg\ncodeBlock code =\n    Html.pre [ css [ codeBackgroundStyle,\
    \ Css.padding (em 1) ] ]\n        [ Html.code [ css [ codeFontStyle ] ] [ Html.text\
    \ code.src ] ]\n\n\nimageBlock : Document.Image Path -> Rendered msg\nimageBlock\
    \ image =\n    Html.figure\n        [ css\n            [ Css.margin2 paragraphSpacing\
    \ zero\n            , framedStyle\n            ]\n        ]\n        [ Html.a\n\
    \            [ Attributes.href <| Path.toAbsolute image.fallbackSource.source.src\n\
    \            , Attributes.target \"_blank\"\n            , Attributes.rel \"noopener\"\
    \n            ]\n            [ Html.img\n                [ Attributes.src (Path.toAbsolute\
    \ image.fallbackSource.source.src)\n                , Attributes.alt image.alt\n\
    \                , Attributes.width image.fallbackSource.source.width\n      \
    \          , Attributes.height image.fallbackSource.source.height\n          \
    \      , css\n                    [ Css.display Css.block\n                  \
    \  , Css.maxWidth (pct 100)\n                    , Css.width (pct 100)\n     \
    \               , Css.height Css.auto\n                    ]\n               \
    \ ]\n            ]\n        , Html.figcaption\n            [ css\n           \
    \     [ Css.boxSizing Css.borderBox\n                , Css.width (pct 100)\n \
    \               , Css.padding (rem 0.5)\n                ]\n            ]\n  \
    \          [ Html.text image.caption ]\n        ]\n\n\n-- Text styles\nheadingStyle\
    \ : Css.Style\nheadingStyle =\n    Css.batch\n        [ headingFontFamily\n  \
    \      , Css.fontWeight Css.bold\n        , Css.margin zero\n        , Css.lineHeight\
    \ (num 1.2)\n        ]\n\n\nparagraphStyle : Css.Style\nparagraphStyle =\n   \
    \ Css.batch\n        [ paragraphFontStyle\n        , Css.margin zero\n       \
    \ ]\n\n\ncodeFontStyle : Css.Style\ncodeFontStyle =\n    Css.batch\n        [\
    \ Css.whiteSpace Css.preWrap\n        , Css.fontFamilies [ \"Source Code Pro\"\
    , \"monospace\" ]\n        ]\n\n\ncodeBackgroundStyle : Css.Style\ncodeBackgroundStyle\
    \ =\n    Css.batch\n        [ Css.borderRadius (em 0.2)\n        , Css.backgroundColor\
    \ (Css.hsla 0 0 0.5 0.15)\n        , Css.padding2 (em 0.05) (em 0.2)\n       \
    \ , Css.fontSize (em 0.95)\n        ]\n\n\nframedStyle : Css.Style\nframedStyle\
    \ =\n    let\n        spacing =\n            0.5\n    in\n    Css.batch\n    \
    \    [ framedBorderStyle\n        , Css.borderRadius (rem spacing)\n        ]\n\
    \n\nframedBorderStyle : Css.Style\nframedBorderStyle =\n    Css.border3 (px 1)\
    \ Css.solid borderColor\n\n\nparagraphSpacing : Css.Rem\nparagraphSpacing =\n\
    \    rem 1\n\n\nborderColor : Css.Color\nborderColor =\n    Css.hsla 0 0 0 0.25\n\
    \n\nparagraphFontStyle : Css.Style\nparagraphFontStyle =\n    Css.batch\n    \
    \    [ Css.lineHeight (num 1.35)\n        ]\n\n\n-- Helper functions\nrenderInline\
    \ : Inline Path -> Rendered msg\nrenderInline inline =\n    case inline of\n \
    \       TextInline text ->\n            renderText [] text\n\n        LinkInline\
    \ link ->\n            renderLink link\n\n        ReferenceInline reference ->\n\
    \            renderReference reference\n\n        CodeInline code ->\n       \
    \     renderCode code\n\n        KeysInline keys ->\n            renderKeys keys\n\
    \n\nrenderText : List Css.Style -> Text -> Rendered msg\nrenderText extraStyles\
    \ text =\n    let\n        italic =\n            if text.style.emphasized then\n\
    \                [ Css.fontStyle Css.italic ]\n\n            else\n          \
    \      []\n\n        styles =\n            italic ++ extraStyles\n    in\n   \
    \ if text.style.emphasized then\n        Html.em [ css styles ] [ Html.text text.content\
    \ ]\n\n    else if List.isEmpty styles then\n        Html.text text.content\n\n\
    \    else\n        Html.span [ css styles ] [ Html.text text.content ]\n\n\nrenderLink\
    \ : Link -> Rendered msg\nrenderLink link =\n    viewLink\n        { text = List.map\
    \ (renderText []) link.text\n        , url = Url.toString link.url\n        ,\
    \ styles = []\n        }\n\n\nviewLink : { text : List (Rendered msg), url : String,\
    \ styles : List Css.Style } -> Rendered msg\nviewLink { text, url, styles } =\n\
    \    let\n        unvisitedColor =\n            Css.rgb 22 22 162\n\n        visitedColor\
    \ =\n            Css.inherit\n    in\n    Html.a\n        [ Attributes.href url\n\
    \        , css\n            ([ Css.color unvisitedColor\n             , Css.visited\n\
    \                [ Css.color visitedColor\n                ]\n             , hover\n\
    \                [ Css.textDecorationStyle Css.dotted\n                ]\n   \
    \          ]\n                ++ styles\n            )\n        ]\n        text\n\
    \n\nrenderReference : Reference Path -> Rendered msg\nrenderReference reference\
    \ =\n    viewLink\n        { text =\n            List.map\n                (renderText\n\
    \                    [ Css.fontWeight Css.bold\n                    , Css.fontSize\
    \ (em 0.8)\n                    ]\n                )\n                reference.text\n\
    \        , url = Path.toAbsolute reference.path\n        , styles = []\n     \
    \   }\n\n\nrenderCode : Code -> Rendered msg\nrenderCode code =\n    Html.code\n\
    \        [ css [ codeFontStyle, codeBackgroundStyle ]\n        ]\n        [ Html.text\
    \ code.src ]\n\n\nrenderKeys : Keys -> Rendered msg\nrenderKeys keys =\n    case\
    \ keys of\n        ( first, [] ) ->\n            renderKey first\n\n        (\
    \ first, rest ) ->\n            Html.kbd [ css [ Css.whiteSpace Css.preWrap ]\
    \ ]\n                (List.map renderKey (first :: rest)\n                   \
    \ |> List.intersperse (Html.text \"+\\u{200B}\")\n                )\n\n\nrenderKey\
    \ : Key -> Rendered msg\nrenderKey key =\n    let\n        keyBorderColor =\n\
    \            Css.hsl 0 0 0.75\n\n        keyText =\n            case key of\n\
    \                Letter l ->\n                    String.fromChar l\n\n      \
    \          Ctrl ->\n                    \"Ctrl\"\n\n                Shift ->\n\
    \                    \"Shift\\u{00A0}⇧\"\n\n                Enter ->\n       \
    \             \"Enter\\u{00A0}↵\"\n\n                Tab ->\n                \
    \    \"Tab\\u{00A0}↹\"\n\n                Up ->\n                    \"↑\\u{00A0}up\"\
    \n\n                Down ->\n                    \"↓\\u{00A0}down\"\n    in\n\
    \    Html.kbd\n        [ css\n            [ codeFontStyle\n            , Css.fontSize\
    \ (em 0.8)\n            , Css.padding2 (em 0) (em 0.1)\n            , Css.border3\
    \ (px 1) Css.solid keyBorderColor\n            , Css.borderRadius (em 0.2)\n \
    \           , Css.boxShadow5 Css.inset zero (px -1) zero keyBorderColor\n    \
    \        , Css.verticalAlign Css.center\n            , Css.whiteSpace Css.pre\n\
    \            ]\n        ]\n        [ Html.text keyText ]\n```"
  - "Context: \nAnswer: 40"
- source_sentence: 'You are tasked with creating a graded object in a category `C`
    using a type `β`. A graded object over `C` is essentially a function `β → C` into
    the objects of `C`. Your goal is to define the `graded_object` in a category,
    where you will project the `i`-th component of the graded object and create a
    shift functor on the graded objects. Additionally, you need to construct the total
    functor `graded_object β C ⥤ C` and prove that it is faithful.


    Write a program that accomplishes the following tasks:

    1. Define the graded object in a category.

    2. Create a shift functor on the graded objects.

    3. Construct the total functor and prove that it is faithful.'
  sentences:
  - "Context: \nAnswer: 33"
  - '1514'
  - "Context: \nAnswer: ```haskell\nimport algebra.group.basic\nimport category_theory.pi.basic\n\
    import category_theory.shift\n\nnamespace category_theory\n\nuniverses w v u\n\
    \ndef graded_object (β : Type w) (C : Type u) : Type (max w u) := β → C\n\ninstance\
    \ inhabited_graded_object (β : Type w) (C : Type u) [inhabited C] :\n  inhabited\
    \ (graded_object β C) :=\n⟨λ b, inhabited.default C⟩\n\ninstance category_of_graded_objects\
    \ (β : Type w) : category.{(max w v)} (graded_object β C) :=\ncategory_theory.pi\
    \ (λ _, C)\n\ndef eval {β : Type w} (b : β) : graded_object β C ⥤ C :=\n{ obj\
    \ := λ X, X b,\n  map := λ X Y f, f b }\n\nsection\nvariable (C)\n\ndef comap_eq\
    \ {β γ : Type w} {f g : β → γ} (h : f = g) : comap (λ _, C) f ≅ comap (λ _, C)\
    \ g :=\n{ hom := { app := λ X b, eq_to_hom begin dsimp [comap], subst h, end },\n\
    \  inv := { app := λ X b, eq_to_hom begin dsimp [comap], subst h, end }, }\n\n\
    lemma comap_eq_symm {β γ : Type w} {f g : β → γ} (h : f = g) :\n  comap_eq C h.symm\
    \ = (comap_eq C h).symm :=\nby tidy\n\nlemma comap_eq_trans {β γ : Type w} {f\
    \ g h : β → γ} (k : f = g) (l : g = h) :\n  comap_eq C (k.trans l) = comap_eq\
    \ C k ≪≫ comap_eq C l :=\nbegin\n  ext X b,\n  simp,\nend\n\ndef comap_equiv {β\
    \ γ : Type w} (e : β ≃ γ) :\n  (graded_object β C) ≌ (graded_object γ C) :=\n\
    { functor := comap (λ _, C) (e.symm : γ → β),\n  inverse := comap (λ _, C) (e\
    \ : β → γ),\n  counit_iso := (comap_comp (λ _, C) _ _).trans (comap_eq C (by {\
    \ ext, simp } )),\n  unit_iso := (comap_eq C (by { ext, simp } )).trans (comap_comp\
    \ _ _ _).symm,\n  functor_unit_iso_comp' := λ X, by { ext b, dsimp, simp, } }\n\
    \nend\n\ninstance has_shift {β : Type*} [add_comm_group β] (s : β) :\n  has_shift\
    \ (graded_object_with_shift s C) :=\n{ shift := comap_equiv C\n  { to_fun := λ\
    \ b, b-s,\n    inv_fun := λ b, b+s,\n    left_inv := λ x, (by simp),\n    right_inv\
    \ := λ x, (by simp), } }\n\ninstance has_zero_morphisms [has_zero_morphisms C]\
    \ (β : Type w) :\n  has_zero_morphisms.{(max w v)} (graded_object β C) :=\n{ has_zero\
    \ := λ X Y,\n  { zero := λ b, 0 } }\n\nlemma zero_apply [has_zero_morphisms C]\
    \ (β : Type w) (X Y : graded_object β C) (b : β) :\n  (0 : X ⟶ Y) b = 0 := rfl\n\
    \nopen_locale zero_object\n\ninstance has_zero_object [has_zero_object C] [has_zero_morphisms\
    \ C] (β : Type w) :\n  has_zero_object.{(max w v)} (graded_object β C) :=\n{ zero\
    \ := λ b, (0 : C),\n  unique_to := λ X, ⟨⟨λ b, 0⟩, λ f, (by ext)⟩,\n  unique_from\
    \ := λ X, ⟨⟨λ b, 0⟩, λ f, (by ext)⟩, } }\n\nvariables (β : Type)\nvariables (C\
    \ : Type u) [category.{v} C]\nvariables [has_coproducts C]\n\ndef total : graded_object\
    \ β C ⥤ C :=\n{ obj := λ X, ∐ (λ i : ulift.{v} β, X i.down),\n  map := λ X Y f,\
    \ limits.sigma.map (λ i, f i.down) }\n\ninstance : faithful (total β C) :=\n{\
    \ map_injective' := λ X Y f g w,\n  begin\n    classical,\n    ext i,\n    replace\
    \ w := sigma.ι (λ i : ulift.{v} β, X i.down) ⟨i⟩ ≫= w,\n    erw [colimit.ι_map,\
    \ colimit.ι_map] at w,\n    exact mono.right_cancellation _ _ w,\n  end }\n\n\
    end graded_object\n```"
- source_sentence: 'You are required to implement a CUDA kernel function for deterministic
    devoxelization. The function takes input features of size (n, c), indices of size
    (N, 8), weight of size (N, 8), and is expected to produce output features of size
    (N, c). The kernel function should be able to perform the following steps:

    1. Calculate the index based on the thread and block dimensions.

    2. Iterate through each value of i (less than N) and j (less than c).

    3. Access the corresponding indices, weight, and feat based on the current iteration.

    4. Perform a calculation involving the indices, weight, and feat arrays to populate
    the output array.'
  sentences:
  - "Context: \nAnswer: -15"
  - "Context: \nAnswer: ```c\n#include <stdio.h>\n#include <stdlib.h>\n#include <thrust/device_vector.h>\n\
    #include \"../common/gpu.cuh\"\n\n__global__ void deterministic_devoxelize_kernel(int\
    \ N, int c, const int *__restrict__ indices, const float *__restrict__ weight,\
    \ const float *__restrict__ feat, float *__restrict__ out){\n    int index = blockIdx.x\
    \ * blockDim.x + threadIdx.x;\n    int i = index / c;\n    int j = index % c;\n\
    \    \n    if(i < N){\n        const int* indices_ = indices + 8 * i;\n      \
    \  const float *weight_ = weight + 8 * i;\n        const float *feat_ = feat +\
    \ j;\n        \n        float cur_feat;\n        for(int k = 0; k < 8; k++){\n\
    \            cur_feat = (indices_[k] >= 0) ? feat_[indices_[k] * c]  : 0; \n \
    \           out[i * c + j] += weight_[k] * cur_feat;\n        }\n    }\n}\n\n\
    void deterministic_devoxelize_wrapper(int N, int c, const int * indices, const\
    \ float * weight, const float * feat, float * out){\n    deterministic_devoxelize_kernel<<<N,\
    \ c>>>(N, c, indices, weight, feat, out);\n}\n```\nPlease note that the solution\
    \ provided is a CUDA kernel function for deterministic devoxelization, along with\
    \ a wrapper function for easier usage."
  - '4073'
- source_sentence: 'You are tasked with implementing a grayscale morphological operation
    with flat linear structuring elements in C++ using the CUDA framework. Your function
    should take in an input volume, step vectors for line segments, the number of
    steps for line segments, an operation to perform, and the block size for GPU processing.
    The input volume is a numeric array, the lineSteps parameter is an int32 matrix
    representing step vectors for line segments, and the lineLens parameter is an
    int32 vector representing the number of steps for line segments.


    Your function should validate the inputs and ensure that the number of steps vectors
    and step lengths are equal. It should then allocate an output volume and extract
    line segments from the input parameters. Finally, your function should perform
    the specified morphological operation using flat linear structuring elements and
    return the output volume with the result of the operation.'
  sentences:
  - '3896'
  - "Context: \nAnswer: SMTP is a push protocol for sending emails, while IMAP (Internet\
    \ Message Access Protocol) is a pull protocol for retrieving emails from a server.\
    \ IMAP allows users to manage emails on the server (e.g., filtering, searching),\
    \ whereas SMTP only transmits messages. IMAP is preferred for client access because\
    \ it enables asynchronous retrieval, supports offline use, and maintains email\
    \ state across devices, unlike SMTP's stateless nature."
  - "Context: \nAnswer: ```cpp\n#include <stdexcept>\n#include <vector>\n\n#include\
    \ \"mex.h\"\n\n#include \"view.cuh\"\n#include \"morph.cuh\"\n#include \"strel.cuh\"\
    \n#include \"flat_linear_morph.cuh\"\n\n#include \"mex_common.cuh\"\n\ntemplate\
    \ <class Ty>\nvoid flatLinearMorphOp(mxArray *mxRes, const mxArray *mxVol, const\
    \ std::vector<gpho::LineSeg>& lines,\n    int op, int3 blockSize);\n\nvoid mexFunction(int\
    \ nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])\n{\n    // Validate\
    \ inputs (to be implemented)\n\n    // Allocate output (to be implemented)\n\n\
    \    // Extract line segments (to be implemented)\n\n    // Run function (to be\
    \ implemented)\n}\n\ntemplate <class Ty>\nvoid flatLinearMorphOp(mxArray *mxRes,\
    \ const mxArray *mxVol, const std::vector<gpho::LineSeg>& lines,\n    int op,\
    \ int3 blockSize)\n{\n    gpho::HostView<Ty> res(static_cast<Ty *>(mxGetData(mxRes)),\
    \ volSize(mxRes));\n    gpho::HostView<const Ty> vol(static_cast<const Ty *>(mxGetData(mxVol)),\
    \ volSize(mxVol));\n\n    switch (op) {\n    case MOP_DILATE:\n        gpho::flatLinearDilateErode<gpho::MORPH_DILATE>(res,\
    \ vol, lines, blockSize);\n        break;\n    case MOP_ERODE:\n        gpho::flatLinearDilateErode<gpho::MORPH_ERODE>(res,\
    \ vol, lines, blockSize);\n        break;\n    default:\n        abortWithMsg(\"\
    invalid morphology op\");\n    }\n}\n```"
- source_sentence: Calculate $(-1)^{47} + 2^{(3^3+4^2-6^2)}$.
  sentences:
  - "Context: \nAnswer: 2"
  - "Context: \nAnswer: 127"
  - '4750'
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy@1
- cosine_accuracy@3
- cosine_accuracy@5
- cosine_accuracy@10
- cosine_precision@1
- cosine_precision@3
- cosine_precision@5
- cosine_precision@10
- cosine_recall@1
- cosine_recall@3
- cosine_recall@5
- cosine_recall@10
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@100
model-index:
- name: SentenceTransformer based on ibm-granite/granite-embedding-english-r2
  results:
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: dim 768
      type: dim_768
    metrics:
    - type: cosine_accuracy@1
      value: 0.626
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.706
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.726
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.758
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.626
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.23533333333333334
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.1452
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.07579999999999998
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.626
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.706
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.726
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.758
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.6916401386587206
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.6704460317460319
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.6750546261347222
      name: Cosine Map@100
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: dim 512
      type: dim_512
    metrics:
    - type: cosine_accuracy@1
      value: 0.636
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.7
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.724
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.758
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.636
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.23333333333333334
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.1448
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.07579999999999998
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.636
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.7
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.724
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.758
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.694038077949631
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.6738849206349207
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.6784599411787897
      name: Cosine Map@100
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: dim 256
      type: dim_256
    metrics:
    - type: cosine_accuracy@1
      value: 0.638
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.698
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.712
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.75
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.638
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.2326666666666667
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.14239999999999997
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.075
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.638
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.698
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.712
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.75
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.6915490012428582
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.6731365079365079
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.6780550682950801
      name: Cosine Map@100
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: dim 128
      type: dim_128
    metrics:
    - type: cosine_accuracy@1
      value: 0.636
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.698
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.716
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.74
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.636
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.23266666666666666
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.1432
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.074
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.636
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.698
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.716
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.74
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.6863050743630661
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.6692539682539683
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.6739281987227784
      name: Cosine Map@100
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: dim 64
      type: dim_64
    metrics:
    - type: cosine_accuracy@1
      value: 0.628
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.692
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.714
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.734
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.628
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.23066666666666666
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.14279999999999998
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.0734
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.628
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.692
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.714
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.734
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.680595460049486
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.6635103174603174
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.6681288217342812
      name: Cosine Map@100
---

# SentenceTransformer based on ibm-granite/granite-embedding-english-r2

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [ibm-granite/granite-embedding-english-r2](https://huggingface.co/ibm-granite/granite-embedding-english-r2). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

## Model Details

### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [ibm-granite/granite-embedding-english-r2](https://huggingface.co/ibm-granite/granite-embedding-english-r2) <!-- at revision 47ea694b257b703fee9253d75c2b1f2985180498 -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
<!-- - **Training Dataset:** Unknown -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### Full Model Architecture

```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```

## Usage

### Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("shatonix/granite-embedding-math-cs")
# Run inference
sentences = [
    'Calculate $(-1)^{47} + 2^{(3^3+4^2-6^2)}$.',
    'Context: \nAnswer: 127',
    '4750',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000,  0.5650, -0.0154],
#         [ 0.5650,  1.0000, -0.0246],
#         [-0.0154, -0.0246,  1.0000]])
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

## Evaluation

### Metrics

#### Information Retrieval

* Dataset: `dim_768`
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
  ```json
  {
      "truncate_dim": 768
  }
  ```

| Metric              | Value      |
|:--------------------|:-----------|
| cosine_accuracy@1   | 0.626      |
| cosine_accuracy@3   | 0.706      |
| cosine_accuracy@5   | 0.726      |
| cosine_accuracy@10  | 0.758      |
| cosine_precision@1  | 0.626      |
| cosine_precision@3  | 0.2353     |
| cosine_precision@5  | 0.1452     |
| cosine_precision@10 | 0.0758     |
| cosine_recall@1     | 0.626      |
| cosine_recall@3     | 0.706      |
| cosine_recall@5     | 0.726      |
| cosine_recall@10    | 0.758      |
| **cosine_ndcg@10**  | **0.6916** |
| cosine_mrr@10       | 0.6704     |
| cosine_map@100      | 0.6751     |

#### Information Retrieval

* Dataset: `dim_512`
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
  ```json
  {
      "truncate_dim": 512
  }
  ```

| Metric              | Value     |
|:--------------------|:----------|
| cosine_accuracy@1   | 0.636     |
| cosine_accuracy@3   | 0.7       |
| cosine_accuracy@5   | 0.724     |
| cosine_accuracy@10  | 0.758     |
| cosine_precision@1  | 0.636     |
| cosine_precision@3  | 0.2333    |
| cosine_precision@5  | 0.1448    |
| cosine_precision@10 | 0.0758    |
| cosine_recall@1     | 0.636     |
| cosine_recall@3     | 0.7       |
| cosine_recall@5     | 0.724     |
| cosine_recall@10    | 0.758     |
| **cosine_ndcg@10**  | **0.694** |
| cosine_mrr@10       | 0.6739    |
| cosine_map@100      | 0.6785    |

#### Information Retrieval

* Dataset: `dim_256`
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
  ```json
  {
      "truncate_dim": 256
  }
  ```

| Metric              | Value      |
|:--------------------|:-----------|
| cosine_accuracy@1   | 0.638      |
| cosine_accuracy@3   | 0.698      |
| cosine_accuracy@5   | 0.712      |
| cosine_accuracy@10  | 0.75       |
| cosine_precision@1  | 0.638      |
| cosine_precision@3  | 0.2327     |
| cosine_precision@5  | 0.1424     |
| cosine_precision@10 | 0.075      |
| cosine_recall@1     | 0.638      |
| cosine_recall@3     | 0.698      |
| cosine_recall@5     | 0.712      |
| cosine_recall@10    | 0.75       |
| **cosine_ndcg@10**  | **0.6915** |
| cosine_mrr@10       | 0.6731     |
| cosine_map@100      | 0.6781     |

#### Information Retrieval

* Dataset: `dim_128`
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
  ```json
  {
      "truncate_dim": 128
  }
  ```

| Metric              | Value      |
|:--------------------|:-----------|
| cosine_accuracy@1   | 0.636      |
| cosine_accuracy@3   | 0.698      |
| cosine_accuracy@5   | 0.716      |
| cosine_accuracy@10  | 0.74       |
| cosine_precision@1  | 0.636      |
| cosine_precision@3  | 0.2327     |
| cosine_precision@5  | 0.1432     |
| cosine_precision@10 | 0.074      |
| cosine_recall@1     | 0.636      |
| cosine_recall@3     | 0.698      |
| cosine_recall@5     | 0.716      |
| cosine_recall@10    | 0.74       |
| **cosine_ndcg@10**  | **0.6863** |
| cosine_mrr@10       | 0.6693     |
| cosine_map@100      | 0.6739     |

#### Information Retrieval

* Dataset: `dim_64`
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
  ```json
  {
      "truncate_dim": 64
  }
  ```

| Metric              | Value      |
|:--------------------|:-----------|
| cosine_accuracy@1   | 0.628      |
| cosine_accuracy@3   | 0.692      |
| cosine_accuracy@5   | 0.714      |
| cosine_accuracy@10  | 0.734      |
| cosine_precision@1  | 0.628      |
| cosine_precision@3  | 0.2307     |
| cosine_precision@5  | 0.1428     |
| cosine_precision@10 | 0.0734     |
| cosine_recall@1     | 0.628      |
| cosine_recall@3     | 0.692      |
| cosine_recall@5     | 0.714      |
| cosine_recall@10    | 0.734      |
| **cosine_ndcg@10**  | **0.6806** |
| cosine_mrr@10       | 0.6635     |
| cosine_map@100      | 0.6681     |

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Dataset

#### Unnamed Dataset

* Size: 4,500 training samples
* Columns: <code>anchor</code>, <code>positive</code>, and <code>id</code>
* Approximate statistics based on the first 1000 samples:
  |         | anchor                                                                             | positive                                                                            | id                                                                              |
  |:--------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------|
  | type    | string                                                                             | string                                                                              | string                                                                          |
  | details | <ul><li>min: 8 tokens</li><li>mean: 80.08 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 9 tokens</li><li>mean: 165.53 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 3.81 tokens</li><li>max: 4 tokens</li></ul> |
* Samples:
  | anchor                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | positive                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | id                |
  |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------|
  | <code>Stella’s antique shop has 3 dolls, 2 clocks and 5 glasses for sale. She sells the dolls for $5 each. The clocks are priced at $15 each. The glasses are priced at $4 each. If she spent $40 to buy everything and she sells all of her merchandise, how much profit will she make?</code>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <code>Context: <br>Answer: 25</code>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | <code>3430</code> |
  | <code>You are tasked with creating a Ruby program that defines a service for creating a project in a Continuous Integration (CI) system. The service should be able to execute with valid parameters and handle specific scenarios.<br><br>The program should include the following:<br>- A class called `Ci::CreateProjectService` that defines the service for creating a project.<br>- A method within the `Ci::CreateProjectService` class called `execute` that takes in three parameters: `current_user` (representing the current user), `project` (representing the project to be created), and `ci_origin_project` (optional, representing the project to use as a template for settings and jobs).<br>- The `execute` method should handle the following scenarios:<br>  1. When executed with valid parameters, it should return a new instance of `Ci::Project` that is persisted.<br>  2. When executed without a project dump (empty string), it should raise an exception.<br>  3. When executed with a `ci_origin_project` for forking, it should use ...</code> | <code>Context: <br>Answer: ```ruby<br>class Ci::CreateProjectService<br>  def execute(current_user, project, ci_origin_project = nil)<br>    if project.empty?<br>      raise StandardError, 'Project dump is required'<br>    end<br><br>    new_project = Ci::Project.new<br>    new_project.save<br><br>    if ci_origin_project<br>      new_project.shared_runners_enabled = ci_origin_project.shared_runners_enabled<br>      new_project.public = ci_origin_project.public<br>      new_project.allow_git_fetch = ci_origin_project.allow_git_fetch<br>    end<br><br>    new_project<br>  end<br>end<br>```</code>                                                                                                                                                               | <code>656</code>  |
  | <code>Why is the Insertion Sort algorithm considered optimal for nearly sorted datasets, and how does its time complexity compare to other quadratic sorting algorithms?</code>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <code>Context: <br>Answer: Insertion Sort operates in O(n²) time complexity in the worst case, but for nearly sorted datasets, it achieves O(n) time complexity. This is because it only requires a minimal number of swaps to place elements in order. For datasets where most elements are already in their correct positions, the number of inversions (pairs out of order) is small, reducing the number of comparisons and swaps. This contrasts with other quadratic algorithms like Selection Sort, which must scan the entire dataset for each element, leading to O(n²) operations regardless of initial order. The efficiency of Insertion Sort for nearly sorted data stems from its ability to leverage existing order, making it a better choice for such scenarios.</code> | <code>1305</code> |
* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
  ```json
  {
      "loss": "MultipleNegativesRankingLoss",
      "matryoshka_dims": [
          768,
          512,
          256,
          128,
          64
      ],
      "matryoshka_weights": [
          1,
          1,
          1,
          1,
          1
      ],
      "n_dims_per_step": -1
  }
  ```

### Training Hyperparameters
#### Non-Default Hyperparameters

- `eval_strategy`: epoch
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `gradient_accumulation_steps`: 2
- `num_train_epochs`: 10
- `lr_scheduler_type`: cosine
- `warmup_ratio`: 0.1
- `bf16`: True
- `tf32`: True
- `dataloader_num_workers`: 4
- `load_best_model_at_end`: True
- `batch_sampler`: no_duplicates

#### All Hyperparameters
<details><summary>Click to expand</summary>

- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: epoch
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 2
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 5e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 10
- `max_steps`: -1
- `lr_scheduler_type`: cosine
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `bf16`: True
- `fp16`: False
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: True
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 4
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: True
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `parallelism_config`: None
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch_fused
- `optim_args`: None
- `adafactor`: False
- `group_by_length`: False
- `length_column_name`: length
- `project`: huggingface
- `trackio_space_id`: trackio
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `use_legacy_prediction_loop`: False
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: None
- `hub_always_push`: False
- `hub_revision`: None
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `include_for_metrics`: []
- `eval_do_concat_batches`: True
- `fp16_backend`: auto
- `push_to_hub_model_id`: None
- `push_to_hub_organization`: None
- `mp_parameters`: 
- `auto_find_batch_size`: False
- `full_determinism`: False
- `torchdynamo`: None
- `ray_scope`: last
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `include_tokens_per_second`: False
- `include_num_input_tokens_seen`: no
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `use_liger_kernel`: False
- `liger_kernel_config`: None
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: True
- `prompts`: None
- `batch_sampler`: no_duplicates
- `multi_dataset_batch_sampler`: proportional
- `router_mapping`: {}
- `learning_rate_mapping`: {}

</details>

### Training Logs
| Epoch   | Step    | Training Loss | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
|:-------:|:-------:|:-------------:|:----------------------:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
| -1      | -1      | -             | 0.6227                 | 0.6213                 | 0.6163                 | 0.6036                 | 0.5905                |
| 0.2817  | 10      | 10.3671       | -                      | -                      | -                      | -                      | -                     |
| 0.5634  | 20      | 8.1302        | -                      | -                      | -                      | -                      | -                     |
| 0.8451  | 30      | 6.6781        | -                      | -                      | -                      | -                      | -                     |
| 1.0     | 36      | -             | 0.6371                 | 0.6373                 | 0.6368                 | 0.6384                 | 0.6297                |
| 1.1127  | 40      | 5.6041        | -                      | -                      | -                      | -                      | -                     |
| 1.3944  | 50      | 5.3589        | -                      | -                      | -                      | -                      | -                     |
| 1.6761  | 60      | 5.2615        | -                      | -                      | -                      | -                      | -                     |
| 1.9577  | 70      | 5.1322        | -                      | -                      | -                      | -                      | -                     |
| 2.0     | 72      | -             | 0.6584                 | 0.6599                 | 0.6567                 | 0.6590                 | 0.6588                |
| 2.2254  | 80      | 4.2222        | -                      | -                      | -                      | -                      | -                     |
| 2.5070  | 90      | 3.6282        | -                      | -                      | -                      | -                      | -                     |
| 2.7887  | 100     | 3.5652        | -                      | -                      | -                      | -                      | -                     |
| 3.0     | 108     | -             | 0.6679                 | 0.6724                 | 0.6750                 | 0.6699                 | 0.6645                |
| 3.0563  | 110     | 3.1212        | -                      | -                      | -                      | -                      | -                     |
| 3.3380  | 120     | 1.8016        | -                      | -                      | -                      | -                      | -                     |
| 3.6197  | 130     | 1.8941        | -                      | -                      | -                      | -                      | -                     |
| 3.9014  | 140     | 1.8576        | -                      | -                      | -                      | -                      | -                     |
| 4.0     | 144     | -             | 0.6900                 | 0.6923                 | 0.6937                 | 0.6863                 | 0.6771                |
| 4.1690  | 150     | 1.0872        | -                      | -                      | -                      | -                      | -                     |
| 4.4507  | 160     | 0.7482        | -                      | -                      | -                      | -                      | -                     |
| 4.7324  | 170     | 0.7307        | -                      | -                      | -                      | -                      | -                     |
| 5.0     | 180     | 0.8322        | 0.6909                 | 0.6988                 | 0.6947                 | 0.6873                 | 0.6800                |
| 5.2817  | 190     | 0.329         | -                      | -                      | -                      | -                      | -                     |
| 5.5634  | 200     | 0.3246        | -                      | -                      | -                      | -                      | -                     |
| 5.8451  | 210     | 0.274         | -                      | -                      | -                      | -                      | -                     |
| 6.0     | 216     | -             | 0.6898                 | 0.6929                 | 0.6904                 | 0.6900                 | 0.6801                |
| 6.1127  | 220     | 0.2161        | -                      | -                      | -                      | -                      | -                     |
| 6.3944  | 230     | 0.1178        | -                      | -                      | -                      | -                      | -                     |
| 6.6761  | 240     | 0.1418        | -                      | -                      | -                      | -                      | -                     |
| 6.9577  | 250     | 0.1319        | -                      | -                      | -                      | -                      | -                     |
| 7.0     | 252     | -             | 0.6920                 | 0.6890                 | 0.6910                 | 0.6880                 | 0.6789                |
| 7.2254  | 260     | 0.0979        | -                      | -                      | -                      | -                      | -                     |
| 7.5070  | 270     | 0.0653        | -                      | -                      | -                      | -                      | -                     |
| 7.7887  | 280     | 0.0852        | -                      | -                      | -                      | -                      | -                     |
| **8.0** | **288** | **-**         | **0.6934**             | **0.69**               | **0.6934**             | **0.6877**             | **0.6825**            |
| 8.0563  | 290     | 0.08          | -                      | -                      | -                      | -                      | -                     |
| 8.3380  | 300     | 0.0526        | -                      | -                      | -                      | -                      | -                     |
| 8.6197  | 310     | 0.066         | -                      | -                      | -                      | -                      | -                     |
| 8.9014  | 320     | 0.0549        | -                      | -                      | -                      | -                      | -                     |
| 9.0     | 324     | -             | 0.6911                 | 0.6929                 | 0.6905                 | 0.6858                 | 0.6802                |
| 9.1690  | 330     | 0.0384        | -                      | -                      | -                      | -                      | -                     |
| 9.4507  | 340     | 0.0523        | -                      | -                      | -                      | -                      | -                     |
| 9.7324  | 350     | 0.0333        | -                      | -                      | -                      | -                      | -                     |
| 10.0    | 360     | 0.0488        | 0.6916                 | 0.6940                 | 0.6915                 | 0.6863                 | 0.6806                |

* The bold row denotes the saved checkpoint.

### Framework Versions
- Python: 3.12.12
- Sentence Transformers: 5.2.0
- Transformers: 4.57.3
- PyTorch: 2.9.1+cu128
- Accelerate: 1.12.0
- Datasets: 4.4.2
- Tokenizers: 0.22.1

## Citation

### BibTeX

#### Sentence Transformers
```bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
```

#### MatryoshkaLoss
```bibtex
@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}
```

#### MultipleNegativesRankingLoss
```bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->