--- license: apache-2.0 base_model: sentence-transformers/all-MiniLM-L6-v2 library_name: transformers.js pipeline_tag: feature-extraction tags: - sentence-similarity - onnx - web-testing - locators --- # Cartographer locator model A fine-tuned [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) for [Cartographer](https://github.com/AutomatedTester/cartographer)'s `get_element_locator` tool. Given a plain-English description ("checkout button"), it ranks the elements on a web page by how close their meaning is to the description. It ships as ONNX in the layout [Transformers.js](https://huggingface.co/docs/transformers.js) loads, with full-precision (`onnx/model.onnx`, 90 MB) and 8-bit (`onnx/model_quantized.onnx`, 23 MB) copies. Cartographer loads the 8-bit copy. ## Using it with Cartographer | Variable | Value | |---|---| | `CARTOGRAPHER_LOCATOR_MODEL` | `TheAutomatedTester/locator-model` | | `CARTOGRAPHER_LOCATOR_MIN_SIMILARITY` | `0.44` | Set the threshold too. This model scores on its own scale; below 0.44, a description that matches nothing on the page can still get a confident answer. ## What the model compares Descriptions are compared with element text in the form Cartographer's `describeElement` writes, for example: ``` button, text: Log in password input, placeholder: Password, name: pass a, text: Sign up for free ``` Mean pooling, normalised embeddings, cosine similarity. ## Training | | | |---|---| | Data | `training/data/train.jsonl` at commit `de8c059`: 308 descriptions on 25 pages (14 hand-written, 11 harvested from automationexercise.com, parabank.parasoft.com, demowebshop.tricentis.com and selenium.dev) | | Rows | One per description, with the 5 wrong elements on the same page that the base model scores closest to it | | Loss | MultipleNegativesRankingLoss (the right element must beat its 5 hard wrong elements and every other element in the batch) | | Settings | 10 epochs, batch size 32, learning rate 2e-5, warmup 10%, seed 42 | ## Evaluation On `training/data/eval.jsonl`: 55 descriptions and 20 unrelated ones on 8 pages, from sites not in the training data (the-internet.herokuapp.com, quotes.toscrape.com, and a hand-built shop). Top-1 accuracy through Cartographer's own locator code, at each model's recommended threshold: | Matcher | Descriptive ids | Neutral ids (`el0`, `el1`, …) | Threshold | |---|---|---|---| | Keyword only | 22/55 | 16/55 | | | all-MiniLM-L6-v2 (stock) | 34/55 | 28/55 | 0.50 | | This model | 40/55 | 34/55 | 0.44 | The highest similarity for an unrelated description was 0.41. Both datasets are small and were written by the same person, so treat these numbers as a smoke test rather than a benchmark. Known misses include "sign up link" picking a Sign In button, "complete purchase" missing a payment button, and "stop the camera" picking Start. ## Limitations - English only. - Trained on test-practice sites, not real production sites. - Built to rank the elements on one page, not for general semantic search.