Sentence Similarity
sentence-transformers
Safetensors
bert
feature-extraction
Generated from Trainer
dataset_size:200000
loss:MatryoshkaLoss
loss:MultipleNegativesRankingLoss
Eval Results (legacy)
text-embeddings-inference
Instructions to use ArnavKewalram/bge-base-code-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ArnavKewalram/bge-base-code-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ArnavKewalram/bge-base-code-v1") sentences = [ "Sets the global variables $rects and $origRectSpecs", "def modify_ranking(tournament):\n database = TinyDB('db.json')\n # recuperation de tous les joueurs du tournoi\n players_table = database.table('players')\n list_players = get_player_list(tournament)\n # Modification du rang joueur par joueur\n for player in list_players:\n new_ranking = view.modify_ranking_view(player)\n players_table.update({'Classement': new_ranking}, doc_ids=[player.doc_id])", "function setConstants() {\n const wrapItems = \".image-analysis-wrapper .face-wrap, .image-analysis-wrapper .score-wrap, .image-analysis-wrapper .attribute-wrap, .image-analysis-wrapper .region-block, .image-analysis-wrapper .region-block .word-block .word-wrap\";\n\n $rects = jQuery(\".image-analysis-wrapper .rectangle\");\n\n // Iterate over each rectangle and save the width, height, top position,\n // left position, closest stats block element, and position of the closest\n // stats block element to an object. Each object is then added to the \n // $origRectSpecs array for global use.\n $origRectSpecs = $rects.map(function () {\n closestWrapItems = jQuery(this).siblings(wrapItems);\n\n const stats = closestWrapItems.map(function () {\n return {\n origStatTop: jQuery(this).position().top || parseInt(jQuery(this).css(\"top\")),\n origStatLeft: jQuery(this).position().left || parseInt(jQuery(this).css(\"left\"))\n }\n })\n\n return {\n origRectWidth: jQuery(this).width(),\n origRectHeight: jQuery(this).height(),\n origRectTop: jQuery(this).position().top || parseInt(jQuery(this).css(\"top\")), // if the rect is on a tab that is currently not displayed it has a position of 0, so this check gets the css instead so we don't lose the value\n origRectLeft: jQuery(this).position().left || parseInt(jQuery(this).css(\"left\")),\n statBlock: closestWrapItems[0],\n statPosition: stats[0]\n }\n })\n }", "reset() {\n\n // Set the initial crop to match any given fixed aspect ratio (or\n // default to a square crop 1:1).\n let aspectRatio = this._initialAspectRatio\n\n // Calculate the initial crop size such that it fits within the bounds\n let width = getWidth(this.bounds)\n let height = getWidth(this.bounds) / aspectRatio\n\n if (aspectRatio < width / getHeight(this.bounds)) {\n width = getHeight(this.bounds) * aspectRatio\n height = getHeight(this.bounds)\n }\n\n // Calculate the initial crop position to be central to the bounds\n const x = (getWidth(this.bounds) - width) / 2\n const y = (getHeight(this.bounds) - height) / 2\n\n // Set the region\n this.region = [\n [x, y],\n [x + width, y + height]\n ]\n }" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - generated_from_trainer | |
| - dataset_size:200000 | |
| - loss:MatryoshkaLoss | |
| - loss:MultipleNegativesRankingLoss | |
| base_model: BAAI/bge-base-en-v1.5 | |
| widget: | |
| - source_sentence: Sets the global variables $rects and $origRectSpecs | |
| sentences: | |
| - "def modify_ranking(tournament):\n database = TinyDB('db.json')\n # recuperation\ | |
| \ de tous les joueurs du tournoi\n players_table = database.table('players')\n\ | |
| \ list_players = get_player_list(tournament)\n # Modification du rang joueur\ | |
| \ par joueur\n for player in list_players:\n new_ranking = view.modify_ranking_view(player)\n\ | |
| \ players_table.update({'Classement': new_ranking}, doc_ids=[player.doc_id])" | |
| - "function setConstants() {\n const wrapItems = \".image-analysis-wrapper\ | |
| \ .face-wrap, .image-analysis-wrapper .score-wrap, .image-analysis-wrapper .attribute-wrap,\ | |
| \ .image-analysis-wrapper .region-block, .image-analysis-wrapper .region-block\ | |
| \ .word-block .word-wrap\";\n\n $rects = jQuery(\".image-analysis-wrapper\ | |
| \ .rectangle\");\n\n // Iterate over each rectangle and save the width,\ | |
| \ height, top position,\n // left position, closest stats block element,\ | |
| \ and position of the closest\n // stats block element to an object. Each\ | |
| \ object is then added to the \n // $origRectSpecs array for global use.\n\ | |
| \ $origRectSpecs = $rects.map(function () {\n closestWrapItems\ | |
| \ = jQuery(this).siblings(wrapItems);\n\n const stats = closestWrapItems.map(function\ | |
| \ () {\n return {\n origStatTop: jQuery(this).position().top\ | |
| \ || parseInt(jQuery(this).css(\"top\")),\n origStatLeft: jQuery(this).position().left\ | |
| \ || parseInt(jQuery(this).css(\"left\"))\n }\n })\n\ | |
| \n return {\n origRectWidth: jQuery(this).width(),\n\ | |
| \ origRectHeight: jQuery(this).height(),\n origRectTop:\ | |
| \ jQuery(this).position().top || parseInt(jQuery(this).css(\"top\")), // if the\ | |
| \ rect is on a tab that is currently not displayed it has a position of 0, so\ | |
| \ this check gets the css instead so we don't lose the value\n \ | |
| \ origRectLeft: jQuery(this).position().left || parseInt(jQuery(this).css(\"left\"\ | |
| )),\n statBlock: closestWrapItems[0],\n statPosition:\ | |
| \ stats[0]\n }\n })\n }" | |
| - "reset() {\n\n // Set the initial crop to match any given fixed aspect\ | |
| \ ratio (or\n // default to a square crop 1:1).\n let aspectRatio\ | |
| \ = this._initialAspectRatio\n\n // Calculate the initial crop size such\ | |
| \ that it fits within the bounds\n let width = getWidth(this.bounds)\n\ | |
| \ let height = getWidth(this.bounds) / aspectRatio\n\n if (aspectRatio\ | |
| \ < width / getHeight(this.bounds)) {\n width = getHeight(this.bounds)\ | |
| \ * aspectRatio\n height = getHeight(this.bounds)\n }\n\n \ | |
| \ // Calculate the initial crop position to be central to the bounds\n \ | |
| \ const x = (getWidth(this.bounds) - width) / 2\n const y = (getHeight(this.bounds)\ | |
| \ - height) / 2\n\n // Set the region\n this.region = [\n \ | |
| \ [x, y],\n [x + width, y + height]\n ]\n }" | |
| - source_sentence: Returns true if the motor is at its lower limit. | |
| sentences: | |
| - "def is_lower_limit(self):\n is_lower = self.get_raw_status() & self.STATUS_LLIM\n\ | |
| \ return bool(is_lower)" | |
| - "def testLowerBound(self,time,accel):\n\t\tif (time - self.timestamp) > ParserSettings.TIME_DELTA:#tests\ | |
| \ lockout threshold of a flick event\n\t\t\tif accel > self.lower:#tests to see\ | |
| \ if the flick maximum is met yet, relative to the previous magnitude\n\t\t\t\t\ | |
| self.timestamp \t= time#set appropriate values when flick triggered\n\t\t\t\t\ | |
| toReturn \t\t= self.lower\n\t\t\t\tself.lower\t \t= 0#reset flick for next magnitude\ | |
| \ test\n\t\t\t\treturn toReturn\n\t\t\telse:\n\t\t\t\tself.lower = accel#if no\ | |
| \ flick yet, update most recent flick to test\n\t\t\t\treturn 0\n\t\telse:\n\t\ | |
| \t\treturn 0" | |
| - "function checkVisibility(message)\n{\n\t// Scroll the view down a certain amount\n\ | |
| \t$chatlogs.stop().animate({scrollTop: $chatlogs[0].scrollHeight});\n}" | |
| - source_sentence: Extracts an object of params the given route cares about from the | |
| given params object. | |
| sentences: | |
| - "function getRouteParams(route, params) {\n\t var routeParams = {};\n\t\n\t \ | |
| \ if (!route.path) return routeParams;\n\t\n\t (0, _PatternUtils.getParamNames)(route.path).forEach(function\ | |
| \ (p) {\n\t if (Object.prototype.hasOwnProperty.call(params, p)) {\n\t \ | |
| \ routeParams[p] = params[p];\n\t }\n\t });\n\t\n\t return routeParams;\n\ | |
| \t}" | |
| - "public static void initImageLoader(Context context) {\n\t\tFile cacheDir = StorageUtils.getCacheDirectory(context);\n\ | |
| \t\tImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)\n\ | |
| \t\t\t\t.threadPriority(Thread.NORM_PRIORITY - 2)\n\t\t\t\t.denyCacheImageMultipleSizesInMemory()\ | |
| \ \n//\t\t\t\t.discCache(new UnlimitedDiscCache(cacheDir)) // default\n\t\t\t\t\ | |
| .discCacheFileNameGenerator(new Md5FileNameGenerator())\n\t\t\t\t.memoryCache(new\ | |
| \ LruMemoryCache(2 * 1024 * 1024))\n\t\t\t\t.tasksProcessingOrder(QueueProcessingType.LIFO)\n\ | |
| \t\t\t\t.writeDebugLogs() // Remove for release app\t\t\t\t\n\t\t\t\t.build();\n\ | |
| \t\t// Initialize ImageLoader with configuration.\n\t\tImageLoader.getInstance().init(config);\n\ | |
| \t}" | |
| - "function getRouteParams(route, params) {\n\t var routeParams = {};\n\n\t if\ | |
| \ (!route.path) return routeParams;\n\n\t (0, _PatternUtils.getParamNames)(route.path).forEach(function\ | |
| \ (p) {\n\t if (Object.prototype.hasOwnProperty.call(params, p)) {\n\t \ | |
| \ routeParams[p] = params[p];\n\t }\n\t });\n\n\t return routeParams;\n\t\ | |
| }" | |
| - source_sentence: select all as they all have a class of "section" return array of | |
| IDs | |
| sentences: | |
| - "func (o *BookBuyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)\ | |
| \ {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\ | |
| \t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) //\ | |
| \ let the recovery middleware deal with this\n\t\t}\n\t}\n}" | |
| - "function getMenuCLassesIDs()\n {\n let IdsArray = [];\n const\ | |
| \ elements = document.querySelectorAll('.banner,.section');\n for(const\ | |
| \ elm of elements)\n {\n IdsArray.push(elm.id);\n \ | |
| \ }\n \n return IdsArray;\n }" | |
| - "getAllSectionsForRegion(region) {\n if (!region) {\n return\ | |
| \ null;\n }\n return region.getElementsByClassName(A11yClassNames.SECTION);\n\ | |
| \ }" | |
| - source_sentence: For component xyz, returns "xyz[]" | |
| sentences: | |
| - "public String toString() {\n\t \tif(size == 0) {\n\t \t\treturn \"[]\"\ | |
| ;\n\t \t}else {\n\t \t\t\n\t \t\tString result = \"[\" + elementData[0];\n\ | |
| \t \t\tfor(int i = 1; i < size; i++) {\n\t \t\t\tresult += \", \" + elementData[i];\n\ | |
| \t \t\t}\n\t \t\t\n\t \t\tresult += \"]\";\n\t \t\t\n\t \t\treturn\ | |
| \ result;\n\t \t}\n\t }" | |
| - "def masterPath(self):\n\t\treturn fl.File( self._path + '/master.data' )" | |
| - "private static final String getArrayTypeName(String typeName) {\n final String\ | |
| \ arrayTypeName = builtInArrayComponentName2ArrayTypeName.get(typeName);\n \ | |
| \ return (null == arrayTypeName) ? typeName + ARRAY_TYPE_SUFFIX : arrayTypeName;\n\ | |
| \ }" | |
| pipeline_tag: sentence-similarity | |
| library_name: sentence-transformers | |
| metrics: | |
| - cosine_accuracy@1 | |
| - 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@1 | |
| - cosine_mrr@5 | |
| - cosine_mrr@10 | |
| - cosine_map@100 | |
| model-index: | |
| - name: SentenceTransformer based on BAAI/bge-base-en-v1.5 | |
| results: | |
| - task: | |
| type: information-retrieval | |
| name: Information Retrieval | |
| dataset: | |
| name: cornstack eval | |
| type: cornstack_eval | |
| metrics: | |
| - type: cosine_accuracy@1 | |
| value: 0.718 | |
| name: Cosine Accuracy@1 | |
| - type: cosine_accuracy@5 | |
| value: 0.884 | |
| name: Cosine Accuracy@5 | |
| - type: cosine_accuracy@10 | |
| value: 0.924 | |
| name: Cosine Accuracy@10 | |
| - type: cosine_precision@1 | |
| value: 0.718 | |
| name: Cosine Precision@1 | |
| - type: cosine_precision@3 | |
| value: 0.2866666666666666 | |
| name: Cosine Precision@3 | |
| - type: cosine_precision@5 | |
| value: 0.1768 | |
| name: Cosine Precision@5 | |
| - type: cosine_precision@10 | |
| value: 0.09240000000000001 | |
| name: Cosine Precision@10 | |
| - type: cosine_recall@1 | |
| value: 0.718 | |
| name: Cosine Recall@1 | |
| - type: cosine_recall@3 | |
| value: 0.86 | |
| name: Cosine Recall@3 | |
| - type: cosine_recall@5 | |
| value: 0.884 | |
| name: Cosine Recall@5 | |
| - type: cosine_recall@10 | |
| value: 0.924 | |
| name: Cosine Recall@10 | |
| - type: cosine_ndcg@10 | |
| value: 0.8259696432548304 | |
| name: Cosine Ndcg@10 | |
| - type: cosine_mrr@1 | |
| value: 0.718 | |
| name: Cosine Mrr@1 | |
| - type: cosine_mrr@5 | |
| value: 0.7882666666666666 | |
| name: Cosine Mrr@5 | |
| - type: cosine_mrr@10 | |
| value: 0.7940396825396825 | |
| name: Cosine Mrr@10 | |
| - type: cosine_map@100 | |
| value: 0.7967267778119025 | |
| name: Cosine Map@100 | |
| # SentenceTransformer based on BAAI/bge-base-en-v1.5 | |
| This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval. | |
| ## Model Details | |
| ### Model Description | |
| - **Model Type:** Sentence Transformer | |
| - **Base model:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) <!-- at revision a5beb1e3e68b9ab74eb54cfd186867f64f240e1a --> | |
| - **Maximum Sequence Length:** 384 tokens | |
| - **Output Dimensionality:** 768 dimensions | |
| - **Similarity Function:** Cosine Similarity | |
| - **Supported Modality:** Text | |
| <!-- - **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({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'}) | |
| (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'cls', 'include_prompt': True}) | |
| (2): Normalize({}) | |
| ) | |
| ``` | |
| ## 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("sentence_transformers_model_id") | |
| # Run inference | |
| queries = [ | |
| 'For component xyz, returns "xyz[]"', | |
| ] | |
| documents = [ | |
| 'private static final String getArrayTypeName(String typeName) {\n final String arrayTypeName = builtInArrayComponentName2ArrayTypeName.get(typeName);\n return (null == arrayTypeName) ? typeName + ARRAY_TYPE_SUFFIX : arrayTypeName;\n }', | |
| 'public String toString() {\n\t \tif(size == 0) {\n\t \t\treturn "[]";\n\t \t}else {\n\t \t\t\n\t \t\tString result = "[" + elementData[0];\n\t \t\tfor(int i = 1; i < size; i++) {\n\t \t\t\tresult += ", " + elementData[i];\n\t \t\t}\n\t \t\t\n\t \t\tresult += "]";\n\t \t\t\n\t \t\treturn result;\n\t \t}\n\t }', | |
| ] | |
| query_embeddings = model.encode_query(queries) | |
| document_embeddings = model.encode_document(documents) | |
| print(query_embeddings.shape, document_embeddings.shape) | |
| # [1, 768] [2, 768] | |
| # Get the similarity scores for the embeddings | |
| similarities = model.similarity(query_embeddings, document_embeddings) | |
| print(similarities) | |
| # tensor([[0.4454, 0.3780]]) | |
| ``` | |
| <!-- | |
| ### 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: `cornstack_eval` | |
| * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.sentence_transformer.evaluation.InformationRetrievalEvaluator) | |
| | Metric | Value | | |
| |:--------------------|:----------| | |
| | cosine_accuracy@1 | 0.718 | | |
| | cosine_accuracy@5 | 0.884 | | |
| | cosine_accuracy@10 | 0.924 | | |
| | cosine_precision@1 | 0.718 | | |
| | cosine_precision@3 | 0.2867 | | |
| | cosine_precision@5 | 0.1768 | | |
| | cosine_precision@10 | 0.0924 | | |
| | cosine_recall@1 | 0.718 | | |
| | cosine_recall@3 | 0.86 | | |
| | cosine_recall@5 | 0.884 | | |
| | cosine_recall@10 | 0.924 | | |
| | **cosine_ndcg@10** | **0.826** | | |
| | cosine_mrr@1 | 0.718 | | |
| | cosine_mrr@5 | 0.7883 | | |
| | cosine_mrr@10 | 0.794 | | |
| | cosine_map@100 | 0.7967 | | |
| <!-- | |
| ## 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: 200,000 training samples | |
| * Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code> | |
| * Approximate statistics based on the first 100 samples: | |
| | | anchor | positive | negative | | |
| |:---------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | |
| | type | string | string | string | | |
| | modality | text | text | text | | |
| | details | <ul><li>min: 6 tokens</li><li>mean: 19.83 tokens</li><li>max: 105 tokens</li></ul> | <ul><li>min: 21 tokens</li><li>mean: 139.33 tokens</li><li>max: 384 tokens</li></ul> | <ul><li>min: 11 tokens</li><li>mean: 100.52 tokens</li><li>max: 384 tokens</li></ul> | | |
| * Samples: | |
| | anchor | positive | negative | | |
| |:--------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | |
| | <code>Fades all outputs to the given color and waits for it to complete.</code> | <code>def FadeOutputs(box, color, steps=50):<br> for output in box:<br> output.Fade(color=color, steps=steps)<br> time.sleep(steps / (float(box.frequency) / len(box)))</code> | <code>def _colour_loop(self, colours, seconds=None, milliseconds=None, fade=True):<br> colours = self.convert_to_colour_list(colours) #Forces a list of colours into an actual python list<br> if len(colours)<2:<br> colours.append("#000000") #Blink between black and the specified colour if only one provided<br> <br> #Start with the first colour immediately:<br> if fade:<br> self.fade(colours[0])<br> else:<br> self.set(colours[0])<br> step_time = self.clean_time_in_milliseconds(seconds, milliseconds, default_seconds=1, minimum_milliseconds=50)<br> <br> #Do the loop<br> i = 1 #We're moving to the second colour now<br> total_colours = len(colours)<br> while not self._sequence_stop_signal:<br> #Resolve our colour<br> next_colour = colours[i]<br> i = (i+1) % total_colours #ensures we are never asking for more colours than provided<br> if fade: #Fading is a blocking process, thus we let the fade l...</code> | | |
| | <code>Sets the additional element count if buffer resize is required, defaults to initialElementCount of factory method.</code> | <code>public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); }</code> | <code>public int getResizeElementCount() { return vboSet.getResizeElementCount(); }</code> | | |
| | <code>delete a specific incident</code> | <code>def delete_specific_incident(self, incident_id):<br> self.cursor.execute("""DELETE FROM incidents WHERE incident_id ='%s' AND status='draft'<br> """ %(incident_id))<br> self.commiting()<br> return incident_id</code> | <code>def delete(openstack_resource):<br> openstack_resource.delete()</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 | |
| ], | |
| "matryoshka_weights": [ | |
| 1.0, | |
| 1.0, | |
| 1.0, | |
| 1.0 | |
| ], | |
| "n_dims_per_step": -1 | |
| } | |
| ``` | |
| ### Training Hyperparameters | |
| #### Non-Default Hyperparameters | |
| - `per_device_train_batch_size`: 16 | |
| - `gradient_accumulation_steps`: 4 | |
| - `learning_rate`: 2e-05 | |
| - `num_train_epochs`: 1 | |
| - `warmup_ratio`: 0.05 | |
| - `fp16`: True | |
| - `batch_sampler`: no_duplicates | |
| #### All Hyperparameters | |
| <details><summary>Click to expand</summary> | |
| - `overwrite_output_dir`: False | |
| - `do_predict`: False | |
| - `prediction_loss_only`: True | |
| - `per_device_train_batch_size`: 16 | |
| - `per_device_eval_batch_size`: 8 | |
| - `per_gpu_train_batch_size`: None | |
| - `per_gpu_eval_batch_size`: None | |
| - `gradient_accumulation_steps`: 4 | |
| - `eval_accumulation_steps`: None | |
| - `torch_empty_cache_steps`: None | |
| - `learning_rate`: 2e-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`: 1 | |
| - `max_steps`: -1 | |
| - `lr_scheduler_type`: linear | |
| - `lr_scheduler_kwargs`: None | |
| - `warmup_ratio`: 0.05 | |
| - `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`: False | |
| - `fp16`: True | |
| - `fp16_opt_level`: O1 | |
| - `half_precision_backend`: auto | |
| - `bf16_full_eval`: False | |
| - `fp16_full_eval`: False | |
| - `tf32`: None | |
| - `local_rank`: 0 | |
| - `ddp_backend`: None | |
| - `tpu_num_cores`: None | |
| - `tpu_metrics_debug`: False | |
| - `debug`: [] | |
| - `dataloader_drop_last`: False | |
| - `dataloader_num_workers`: 0 | |
| - `dataloader_prefetch_factor`: None | |
| - `past_index`: -1 | |
| - `disable_tqdm`: False | |
| - `remove_unused_columns`: True | |
| - `label_names`: None | |
| - `load_best_model_at_end`: False | |
| - `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 | cornstack_eval_cosine_ndcg@10 | | |
| |:-----:|:----:|:-------------:|:-----------------------------:| | |
| | 0.016 | 50 | 4.7419 | - | | |
| | 0.032 | 100 | 4.2347 | - | | |
| | 0.048 | 150 | 3.9702 | - | | |
| | 0.064 | 200 | 3.7572 | - | | |
| | 0.08 | 250 | 3.7142 | - | | |
| | 0.096 | 300 | 3.5756 | - | | |
| | 0.112 | 350 | 3.6356 | - | | |
| | 0.128 | 400 | 3.7447 | - | | |
| | 0.144 | 450 | 3.4957 | - | | |
| | 0.16 | 500 | 3.4753 | - | | |
| | 0.176 | 550 | 3.3913 | - | | |
| | 0.192 | 600 | 3.1695 | - | | |
| | 0.208 | 650 | 3.2787 | - | | |
| | 0.224 | 700 | 3.2488 | - | | |
| | 0.24 | 750 | 3.2078 | - | | |
| | 0.256 | 800 | 3.2942 | - | | |
| | 0.272 | 850 | 3.0672 | - | | |
| | 0.288 | 900 | 3.1279 | - | | |
| | 0.304 | 950 | 3.1464 | - | | |
| | 0.32 | 1000 | 3.1526 | 0.8336 | | |
| | 0.336 | 1050 | 3.1064 | - | | |
| | 0.352 | 1100 | 3.2408 | - | | |
| | 0.368 | 1150 | 3.2562 | - | | |
| | 0.384 | 1200 | 3.1835 | - | | |
| | 0.4 | 1250 | 2.9471 | - | | |
| | 0.416 | 1300 | 3.1631 | - | | |
| | 0.432 | 1350 | 3.1428 | - | | |
| | 0.448 | 1400 | 2.9445 | - | | |
| | 0.464 | 1450 | 3.0482 | - | | |
| | 0.48 | 1500 | 3.09 | - | | |
| | 0.496 | 1550 | 3.0184 | - | | |
| | 0.512 | 1600 | 3.031 | - | | |
| | 0.528 | 1650 | 2.9703 | - | | |
| | 0.544 | 1700 | 2.9743 | - | | |
| | 0.56 | 1750 | 3.0344 | - | | |
| | 0.576 | 1800 | 3.0521 | - | | |
| | 0.592 | 1850 | 2.9177 | - | | |
| | 0.608 | 1900 | 3.0357 | - | | |
| | 0.624 | 1950 | 2.9277 | - | | |
| | 0.64 | 2000 | 2.8525 | 0.8287 | | |
| | 0.656 | 2050 | 2.978 | - | | |
| | 0.672 | 2100 | 2.8437 | - | | |
| | 0.688 | 2150 | 2.849 | - | | |
| | 0.704 | 2200 | 2.9248 | - | | |
| | 0.72 | 2250 | 2.8551 | - | | |
| | 0.736 | 2300 | 2.8741 | - | | |
| | 0.752 | 2350 | 2.7847 | - | | |
| | 0.768 | 2400 | 2.8682 | - | | |
| | 0.784 | 2450 | 2.7556 | - | | |
| | 0.8 | 2500 | 2.8122 | - | | |
| | 0.816 | 2550 | 2.9173 | - | | |
| | 0.832 | 2600 | 2.8772 | - | | |
| | 0.848 | 2650 | 2.8275 | - | | |
| | 0.864 | 2700 | 2.7819 | - | | |
| | 0.88 | 2750 | 2.8215 | - | | |
| | 0.896 | 2800 | 2.9207 | - | | |
| | 0.912 | 2850 | 2.8892 | - | | |
| | 0.928 | 2900 | 2.7682 | - | | |
| | 0.944 | 2950 | 2.868 | - | | |
| | 0.96 | 3000 | 2.7926 | 0.8260 | | |
| | 0.976 | 3050 | 2.8871 | - | | |
| | 0.992 | 3100 | 2.8142 | - | | |
| ### Training Time | |
| - **Training**: 2.5 days | |
| - **Evaluation**: 1.9 minutes | |
| - **Total**: 2.5 days | |
| ### Framework Versions | |
| - Python: 3.13.7 | |
| - Sentence Transformers: 5.6.0 | |
| - Transformers: 4.57.6 | |
| - PyTorch: 2.12.1+cu126 | |
| - Accelerate: 1.13.0 | |
| - Datasets: 4.8.5 | |
| - Tokenizers: 0.22.2 | |
| ## 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{oord2019representationlearningcontrastivepredictive, | |
| title={Representation Learning with Contrastive Predictive Coding}, | |
| author={Aaron van den Oord and Yazhe Li and Oriol Vinyals}, | |
| year={2019}, | |
| eprint={1807.03748}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.LG}, | |
| url={https://arxiv.org/abs/1807.03748}, | |
| } | |
| ``` | |
| <!-- | |
| ## 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.* | |
| --> |