Home
Softono
n

naver

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
3

Software by naver

fe-news
Open Source

fe-news

# FE News <img src="./assets/logo.svg" width="150" align="right" style="margin:0 0 0 20px"> FE News는 네이버 FE 엔지니어들이 엄선한 양질의 `FE 및 주요한 기술 소식`들을 큐레이션 해 공유하는 것을 목표로 합니다. 이를 통해 국내 개발자들에게 지식 공유에 대한 가치 인식과 성장에 도움을 주고자 합니다. :grin: > [!TIP] > 네이버 Front-end 조직이 어떤 일을 하고, 개발자들이 어떻게 성장하고 있는지 궁금하신가요?<br> > - [네이버 Front-end 소개](../../tree/fe-org) > > 국내 FE/JS 생태계 현황을 확인해 보세요!<br> > - [State of FE·JS Korea](https://naver.github.io/fe-news/stateof-fejs/) ## 🚩 발행소식 발행소식은 [`/issues`](/issues) 폴더 내의 `yyyy-mm.md` 파일을 통해 확인할 수 있습니다. ## 📆 발행주기 매월 첫째 주 수요일, 월 1회 발행 ## 🔔 구독방법 다음의 방법들을 통해 발행 소식을 구독하실 수 있습니다. > [!NOTE] > 대부분의 커밋은 소식의 발행 또는 오타, 정보 수정에 대한 PR의 머지 수준에서 발생합니다. - GitHub 프로젝트 `watch`를 통해 구독하기 - 저장소 상단의 `watch` 버튼을 클릭해 프로젝트를 지켜보는 것으로 구독 - RSS 리더를 통해 구독하기 - RSS 리더를 통해 GitHub 프로젝트 커밋을 구독 - https://github.com/naver/fe-news/commits/master.atom - 메일로 구독하기 - https://fenews.substack.com/embed > [!IMPORTANT] > Disclaimer > - 큐레이션은 구독자에게 최대한 도움이 될 것으로 기대되는 측면과 다양성을 고려해 선별됩니다. > - FE News는 생산된 정보를 "있는 그대로" 매개하며, 정보의 정확성 및 신뢰성은 원칙적으로 정보를 작성한 원 저작자에게 있습니다. ## 📬 최신소식 > 이전 소식들은 '연도'를 클릭하면 보실 수 있습니다. ### 2026 - [2026-06](/issues/2026-06.md) - [2026-05](/issues/2026-05.md) - [2026-04](/issues/2026-04.md) - [2026-03](/issues/2026-03.md) - [2026-02](/issues/2026-02.md) - [2026-01](/issues/2026-01.md) <details> <summary>2025</summary> - [2025-12](/issues/2025-12.md) - [2025-11](/issues/2025-11.md) - [2025-10](/issues/2025-10.md) - [2025-09](/issues/2025-09.md) - [2025-08](/issues/2025-08.md) - [2025-07](/issues/2025-07.md) - [2025-06](/issues/2025-06.md) - [2025-05](/issues/2025-05.md) - [2025-04](/issues/2025-04.md) - [2025-03](/issues/2025-03.md) - [2025-02](/issues/2025-02.md) - [2025-01](/issues/2025-01.md) </details> <details> <summary>2024</summary> - [2024-12](/issues/2024-12.md) - [2024-11](/issues/2024-11.md) - [2024-10](/issues/2024-10.md) - [2024-09](/issues/2024-09.md) - [2024-08](/issues/2024-08.md) - [2024-07](/issues/2024-07.md) - [2024-06](/issues/2024-06.md) - [2024-05](/issues/2024-05.md) - [2024-04](/issues/2024-04.md) - [2024-03](/issues/2024-03.md) - [2024-02](/issues/2024-02.md) - [2024-01](/issues/2024-01.md) </details> <details> <summary>2023</summary> - [2023-12](/issues/2023-12.md) - [2023-11](/issues/2023-11.md) - [2023-10](/issues/2023-10.md) - [2023-09](/issues/2023-09.md) - [2023-08](/issues/2023-08.md) - [2023-07](/issues/2023-07.md) - [2023-06](/issues/2023-06.md) - [2023-05](/issues/2023-05.md) - [2023-04](/issues/2023-04.md) - [2023-03](/issues/2023-03.md) - [2023-02](/issues/2023-02.md) - [2023-01](/issues/2023-01.md) </details> <details> <summary>2022</summary> - [2022-12](/issues/2022-12.md) - [2022-11](/issues/2022-11.md) - [2022-10](/issues/2022-10.md) - [2022-09](/issues/2022-09.md) - [2022-08](/issues/2022-08.md) - [2022-07](/issues/2022-07.md) - [2022-06](/issues/2022-06.md) - [2022-05](/issues/2022-05.md) - [2022-04](/issues/2022-04.md) - [2022-03](/issues/2022-03.md) - [2022-02](/issues/2022-02.md) - [2022-01](/issues/2022-01.md) </details> <details> <summary>2021</summary> - [2021-12](/issues/2021-12.md) - [2021-11](/issues/2021-11.md) - [2021-10](/issues/2021-10.md) - [2021-09](/issues/2021-09.md) - [2021-08](/issues/2021-08.md) - [2021-07](/issues/2021-07.md) - [2021-06](/issues/2021-06.md) - [2021-05](/issues/2021-05.md) - [2021-04](/issues/2021-04.md) - [2021-03](/issues/2021-03.md) - [2021-02](/issues/2021-02.md) - [2021-01](/issues/2021-01.md) </details> <details> <summary>2020</summary> - [2020-12](/issues/2020-12.md) - [2020-11](/issues/2020-11.md) - [2020-10](/issues/2020-10.md) - [2020-09](/issues/2020-09.md) - [2020-08](/issues/2020-08.md) - [2020-07](/issues/2020-07.md) - [2020-06](/issues/2020-06.md) - [2020-05](/issues/2020-05.md) - [2020-04](/issues/2020-04.md) - [2020-03](/issues/2020-03.md) - [2020-02](/issues/2020-02.md) </details> ----- ## 🧑🏻‍💻 Team [![Jae Sung Park](https://avatars.githubusercontent.com/u/2178435?s=150&v=4)](https://github.com/netil) | [![DonBum Ham](https://avatars.githubusercontent.com/u/5152681?s=150&v=4)](https://github.com/silveracy) | [![Inkyu Oh](https://avatars.githubusercontent.com/u/13645032?s=150&v=4)](https://github.com/gomjellie) | [![Inseo Hwang](https://avatars.githubusercontent.com/u/24623403?s=150&v=4)](https://github.com/sjsjsj1246) :---:|:---:|:---:|:---: [Jae Sung Park](https://github.com/netil) | [DonBum Ham](https://github.com/silveracy) | [Inkyu Oh](https://github.com/gomjellie) | [Inseo Hwang](https://github.com/sjsjsj1246) ## 😎 Contributors <a href="https://github.com/naver/fe-news/graphs/contributors"> <img src="https://contrib.rocks/image?repo=naver/fe-news" /> </a>

Read-it-Later & RSS
6.3K Github Stars
egjs-infinitegrid
Open Source

egjs-infinitegrid

<h1 align="center" style="max-width: 100%;"> <img width="256" alt="InfiniteGrid Logo" src="https://naver.github.io/egjs-infinitegrid/img/infinitegrid_logo.png" style="max-width: 100%;" /><br/> <a href="https://naver.github.io/egjs-infinitegrid/">@egjs/infinitegrid</a> </h1> <p align="center" style="line-height: 2;"> <a href="https://www.npmjs.com/package/@egjs/infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/infinitegrid.svg?style=flat-square&color=007acc&label=version&logo=NPM" alt="version" /></a> <a href="https://www.npmjs.com/package/@egjs/infinitegrid" target="_blank"><img alt="npm weekly downloads" src="https://img.shields.io/npm/dw/@egjs/infinitegrid?logo=npm&style=flat-square&color=007acc" /></a> <a href="https://www.npmjs.com/package/@egjs/infinitegrid" target="_blank"><img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/@egjs/infinitegrid.svg?style=flat-square&label=%F0%9F%92%BE%20gzipped&color=007acc" /></a> <a href="https://github.com/naver/egjs-infinitegrid/actions" target="_blank"><img alt="Github actions" src="https://img.shields.io/github/actions/workflow/status/naver/egjs-infinitegrid/run-e2e.yml?branch=master&style=flat-square" /></a>&nbsp; <a href="https://coveralls.io/github/naver/egjs-infinitegrid?branch=master&style=flat-square" target="_blank"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/naver/egjs-infinitegrid.svg?style=flat-square&label=%E2%9C%85%20coverage" /></a> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/LICENSE" target="_blank"><img alt="GitHub" src="https://img.shields.io/github/license/naver/egjs-infinitegrid.svg?style=flat-square&label=%F0%9F%93%9C%20license&color=08CE5D" /></a> </p> <p align="center" style="line-height: 2;"> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/ngx-infinitegrid/README.md" target="_blank"><img alt="Angular" src="https://img.shields.io/static/v1.svg?label=&message=Angular&style=flat-square&logo=Angular&color=dd0031" /></a> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/react-infinitegrid/README.md" target="_blank"><img alt="React" src="https://img.shields.io/static/v1.svg?label=&message=React&style=flat-square&logo=React&logoColor=white&color=61dafb" /></a> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/vue-infinitegrid/README.md" target="_blank"><img alt="Vue" src="https://img.shields.io/static/v1.svg?label=&message=Vue&style=flat-square&logo=Vue.js&logoColor=white&color=42b883" /></a> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/svelte-infinitegrid/README.md" target="_blank"><img alt="Svelte" src="https://img.shields.io/static/v1.svg?label=&message=Svelte&style=flat-square&logo=svelte&logoColor=white&color=FF3E00" /></a> <img src="https://img.shields.io/static/v1.svg?label=&message=TypeScript&color=294E80&style=flat-square&logo=typescript" /> </p> <h3 align="center"> <a href="https://naver.github.io/egjs-infinitegrid/">Demo</a> / <a href="https://naver.github.io/egjs-infinitegrid/docs/api/InfiniteGrid">Documentation</a> / <a href="https://naver.github.io/egjs/"><img height="20" src="https://naver.github.io/egjs/img/logo.svg"/> Other components</a> </h3> <p align="center"> <b>A module used to arrange elements including content infinitely according to grid type. With this module, you can implement various grids composed of different card elements whose sizes vary. It guarantees performance by maintaining the number of DOMs the module is handling under any circumstance</b><br />📱💻🖥 </p> <p align="center"> <b>Supported Frameworks</b><br/> <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/ngx-infinitegrid/README.md"><img width="45" src="https://naver.github.io/egjs-infinitegrid/img/icons/angular.svg" alt="AngularJS" /></a>&nbsp;&nbsp; <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/react-infinitegrid/README.md"><img width="45" src="https://naver.github.io/egjs-infinitegrid/img/icons/react.svg" alt="React" /></a>&nbsp;&nbsp; <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/vue-infinitegrid/README.md"><img width="45" src="https://naver.github.io/egjs-infinitegrid/img/icons/vue.svg" alt="Vue.js" /></a>&nbsp;&nbsp; <a href="https://github.com/naver/egjs-infinitegrid/blob/master/packages/svelte-infinitegrid/README.md"><img width="45" src="https://naver.github.io/egjs-infinitegrid/img/icons/svelte.svg" alt="Svelte" /></a> </p> ----- ## ✨ Features - Use it in a framework you like. - We supports all major JS frameworks like React, Vue, Angular - Restore state like position and active slide with [persist](https://naver.github.io/egjs-persist/) - Supports both Desktop & Mobile - Support Dynamic Options - Rich API ## 📖 Articles * [InfiniteGrid 4 Release!!](https://medium.com/naver-fe-platform/infinitegrid-4-release-f4e2d05b0292) ## ⚙️ Installation #### npm ```bash $ npm install --save @egjs/infinitegrid ``` #### CDN - jsDelivr: https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/ - unpkg: https://unpkg.com/@egjs/infinitegrid/dist/ - cdnjs: https://cdnjs.com/libraries/egjs-infinitegrid ## 🏃 Quick Start #### HTML ```html <div class="container"></div> ``` #### ES Modules ```ts import { MasonryInfiniteGrid } from "@egjs/infinitegrid"; const ig = new MasonryInfiniteGrid(".container", { gap: 5 }); ``` #### With CDN ```html <!-- Packaged with all dependencies --> <!-- https://naver.github.io/egjs-infinitegrid/release/latest/dist/infinitegrid.min.js --> <script src="https://unpkg.com/@egjs/infinitegrid/dist/infinitegrid.min.js"></script> ``` ```js var ig = new InfiniteGrid.MasonryInfiniteGrid(".container", { gap: 5 }); ``` ```js import { MasonryInfiniteGrid } from "@egjs/infinitegrid"; function getItems(nextGroupKey, count) { const nextItems = []; for (let i = 0; i < count; ++i) { const num = nextGroupKey * count + i; nextItems.push(`<div class="item"></div>`); } return nextItems; } const ig = new MasonryInfiniteGrid(".container", { gap: 5, }); ig.on("requestAppend", (e) => { const nextGroupKey = (+e.groupKey || 0) + 1; ig.append(getItems(nextGroupKey, 10), nextGroupKey); }); ig.renderItems(); ``` ### Use Faster & Lazy Rendering * When the `loading="lazy"` or `data-grid-lazy="true"`(external lazy loading) attribute is used, Rendering of the items occurs immediately. When items are loaded, they are rendered sequentially. ```html <img src="..." /> <img src="..." /> <img src="..." loading="lazy" /> <img data-grid-lazy="true" /> ``` * If you use `data-grid-width` and `data-grid-height` attributes, the size of self, child image, and video elements is automatically adjusted until loading is complete. ```html <div data-grid-width="100" data-grid-height="100"> <img src="..." /> <img src="..." /> <img src="..." /> </div> ``` * If you use `data-grid-skip="true"` attribute, you can omit it even if there are images in itself and child image, and video elements. ```html <div data-grid-skip="true"> <img src="..." /> <img src="..." /> <img src="..." /> </div> ``` ### Detect resize of Container & Children InfiniteGrid calculates the size of container and children by window resizing event. However, even if the size of the window does not change, the size of the event container and children can change. Most of the first rendering issues are also like this. In this case, I recommend [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) for you. Provides `useResizeObserver` option to detect size change of container and `observeChildren` option to detect size change of children. ```js import { MasonryInfiniteGrid, JustifiedInfiniteGrid, FrameInfiniteGrid, PackingInfiniteGrid } from "@egjs/infinitegrid"; // InfiniteGrid.MasonryInfiniteGrid const grid = new MasonryInfiniteGrid(container, { gap: 5, useResizeObserver: true, observeChildren: true, }); grid.renderItems(); ``` ## Pre-guess size for performance or invisible items. ### What if all items were the same size? If you use the `isEqualSize` option, all items are considered to be the same size. Each resize only calculates the size of one item. Add `data-grid-not-equal-size="true"` attribute if there is an exceptional item whose size needs to be calculated while using isEqualSize. ```html <div class="item item1"></div> <div class="item item1"></div> <div class="item item1"></div> <!--item2 is a different size than item1.--> <div class="item item2" data-grid-not-equal-size="true"></div> ``` ### What if a size group exists? `isEqualSize` assumes all items are equal. But if there are more than two size-groups, use `data-grid-size-group`. ```html <!--item1 has the same size.--> <div class="item item1" data-grid-size-group="1"></div> <div class="item item1" data-grid-size-group="1"></div> <!--item2 has the same size.--> <div class="item item2" data-grid-size-group="2"></div> <div class="item item2" data-grid-size-group="2"></div> ``` ### What if all items don't change size? If all items do not have a constant size, use the `isConstantSize` option. Resizing doesn't calculate the item's size. If you want to recalculate, use `.updateItems(items, { useOrgResize: true })` method or `.renderItems({ useOrgResize: true })` method. ## 📦 Packages |Package|Version|Description| |:-----:|:-----:|:-----:| |[**@egjs/infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/infinitegrid.svg?style=flat-square&color=dddd31&label=%F0%9F%94%96" alt="version" /></a>|Vanilla Module of InfiniteGrid| |[**@egjs/ngx-infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/ngx-infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/ngx-infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/ngx-infinitegrid.svg?style=flat-square&color=dd0031&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-infinitegrid/img/icons/angular.svg" valign="middle" alt="Angular" /> [Angular](https://angular.io/) port of @egjs/infinitegrid| |[**@egjs/react-infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/react-infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/react-infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/react-infinitegrid.svg?style=flat-square&color=00d8ff&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-infinitegrid/img/icons/react.svg" valign="middle" alt="React" /> [React](https://reactjs.org/) port of @egjs/infinitegrid| |[**@egjs/vue-infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/vue-infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/vue-infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/vue-infinitegrid.svg?style=flat-square&color=42b883&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-infinitegrid/img/icons/vue.svg" valign="middle" alt="Vue.js" /> [Vue.js@2](https://vuejs.org/v2/guide/index.html) port of @egjs/infinitegrid| |[**@egjs/vue3-infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/vue3-infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/vue3-infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/vue3-infinitegrid.svg?style=flat-square&color=42b883&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-infinitegrid/img/icons/vue.svg" valign="middle" alt="Vue.js" /> [Vue.js@3](https://v3.vuejs.org/) port of @egjs/infinitegrid| |[**@egjs/svelte-infinitegrid**](https://github.com/naver/egjs-infinitegrid/blob/master/packages/svelte-infinitegrid/README.md)|<a href="https://www.npmjs.com/package/@egjs/svelte-infinitegrid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/svelte-infinitegrid.svg?style=flat-square&color=FF3E00&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-infinitegrid/img/icons/svelte.svg" valign="middle" alt="Svelte" /> [Svelte](https://svelte.dev/) port of @egjs/infinitegrid| ## 🌐 Supported Browsers |<img width="20" src="https://simpleicons.org/icons/internetexplorer.svg" alt="IE" />|<img width="20" src="https://simpleicons.org/icons/googlechrome.svg" alt="Chrome" />|<img width="20" src="https://simpleicons.org/icons/firefoxbrowser.svg" alt="Firefox" />|<img width="20" src="https://simpleicons.org/icons/safari.svg" alt="Safari" />|<img width="20" src="https://simpleicons.org/icons/apple.svg" alt="iOS" />|<img width="20" src="https://simpleicons.org/icons/android.svg" alt="Android" />| |:---:|:---:|:---:|:---:|:---:|:---:| |9+(With polyfill), 11+ for Angular & Svelte|Latest|Latest|Latest|7+|4+| ## 📼 Demos Check our [Demos](https://naver.github.io/egjs-infinitegrid/). ## 📖 Documentation See [Documentation](https://naver.github.io/egjs-infinitegrid/release/latest/doc/index.html) page. ## 🙌 Contributing See [CONTRIBUTING.md](https://github.com/naver/egjs-infinitegrid/blob/master/CONTRIBUTING.md). ## 📝 Feedback Please file an [Issue](https://github.com/naver/egjs-infinitegrid/issues). ## 🛣️ Roadmap See our [Roadmap](https://github.com/naver/egjs-infinitegrid/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%F0%9F%9B%A3%EF%B8%8FRoadmap+). ## 📜 License @egjs/infinitegrid is released under the [MIT license](https://github.com/naver/egjs-infinitegrid/blob/master/LICENSE). ``` Copyright (c) 2015-present NAVER Corp. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` <p align="center"> <a href="https://naver.github.io/egjs/"><img height="50" src="https://naver.github.io/egjs/img/logotype1_black.svg" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/naver"><img height="50" src="https://naver.github.io/OpenSourceGuide/book/assets/naver_logo.png" /></a> </p>

CSS Frameworks & UI Kits Mobile Development Web Components & Widgets
2.4K Github Stars
splade
Open Source

splade

# SPLADE [![paper](https://img.shields.io/badge/arxiv-arXiv%3A2107.05720-brightgreen)](https://arxiv.org/abs/2107.05720) [![blog](https://img.shields.io/badge/blog-splade-orange)](https://europe.naverlabs.com/blog/splade-a-sparse-bi-encoder-bert-based-model-achieves-effective-and-efficient-first-stage-ranking/) [![huggingface weights](https://img.shields.io/badge/huggingface-splade-9cf)](https://huggingface.co/naver) [![weights](https://img.shields.io/badge/weights-splade-blue)](https://europe.naverlabs.com/research/machine-learning-and-optimization/splade-models/) ## What's New: * November 2023: Better training code for SPLADE and rerankers training (e.g, cross encoders, RankT5) available; new models coming soon on github! * July 2023: We add the code for static pruning SPLADE indexes in order to reproduce [A Static Pruning Study on Sparse Neural Retrievers](https://arxiv.org/abs/2304.12702) * May 2023: We add a new branch (based on HF Trainer) allowing training with several negatives : https://github.com/naver/splade/tree/hf * April 2023: We have removed the weights and pushed them to huggingface (https://huggingface.co/naver/splade_v2_max and https://huggingface.co/naver/splade_v2_distil) <img src="./images/splade_figure.png" width="650"> This repository contains the code to perform **training**, **indexing** and **retrieval** for SPLADE models. It also includes everything needed to launch evaluation on the [BEIR](https://github.com/beir-cellar/beir) benchmark. **TL; DR** SPLADE is a neural retrieval model which learns query/document **sparse** expansion via the BERT MLM head and sparse regularization. Sparse representations benefit from several advantages compared to dense approaches: efficient use of inverted index, explicit lexical match, interpretability... They also seem to be better at generalizing on out-of-domain data (BEIR benchmark). * (v1, SPLADE) [SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking](https://arxiv.org/abs/2107.05720), *Thibault Formal*, *Benjamin Piwowarski* and *Stéphane Clinchant*. SIGIR21 short paper. By benefiting from recent advances in training neural retrievers, our **v2** models rely on hard-negative mining, distillation and better Pre-trained Language Model initialization to further increase their **effectiveness**, on both in-domain (MS MARCO) and out-of-domain evaluation (BEIR benchmark). * (v2, SPLADE v2) [SPLADE v2: Sparse Lexical and Expansion Model for Information Retrieval](https://arxiv.org/abs/2109.10086), *Thibault Formal*, *Benjamin Piwowarski*, *Carlos Lassance*, and *Stéphane Clinchant*. arxiv. * (v2bis, SPLADE++) [From Distillation to Hard Negative Sampling: Making Sparse Neural IR Models More Effective](http://arxiv.org/abs/2205.04733), *Thibault Formal*, *Carlos Lassance*, *Benjamin Piwowarski*, and *Stéphane Clinchant*. SIGIR22 short paper (*extension of SPLADE v2*). Finally, by introducing several modifications (query specific regularization, disjoint encoders etc.), we are able to improve **efficiency**, achieving latency on par with BM25 under the same computing constraints. * (efficient SPLADE) [An Efficiency Study for SPLADE Models](https://dl.acm.org/doi/10.1145/3477495.3531833), *Carlos Lassance* and *Stéphane Clinchant*. SIGIR22 short paper. Weights for models trained under various settings can be found on [Naver Labs Europe website](https://europe.naverlabs.com/research/machine-learning-and-optimization/splade-models/), as well as [Hugging Face](https://huggingface.co/naver). Please bear in mind that SPLADE is more a class of models rather than a model per se: depending on the regularization magnitude, we can obtain different models (from very sparse to models doing intense query/doc expansion) with different properties and performance. *splade: a spork that is sharp along one edge or both edges, enabling it to be used as a knife, a fork and a spoon.* *** # Getting started :rocket: ## Requirements We recommend to start from a fresh environment, and install the packages from `conda_splade_env.yml`. ``` conda create -n splade_env python=3.9 conda activate splade_env conda env create -f conda_splade_env.yml ``` ## Usage ### Playing with the model `inference_splade.ipynb` allows you to load and perform inference with a trained model, in order to inspect the predicted "bag-of-expanded-words". We provide weights for six main models: | model | MRR@10 (MS MARCO dev) | | --- | --- | | `naver/splade_v2_max` (**v2** [HF](https://huggingface.co/naver/splade_v2_max)) | 34.0 | | `naver/splade_v2_distil` (**v2** [HF](https://huggingface.co/naver/splade_v2_distil)) | 36.8 | | `naver/splade-cocondenser-selfdistil` (**SPLADE++**, [HF](https://huggingface.co/naver/splade-cocondenser-selfdistil)) | 37.6 | | `naver/splade-cocondenser-ensembledistil` (**SPLADE++**, [HF](https://huggingface.co/naver/splade-cocondenser-ensembledistil)) | 38.3 | | `naver/efficient-splade-V-large-doc` ([HF](https://huggingface.co/naver/efficient-splade-V-large-doc)) + `naver/efficient-splade-V-large-query` ([HF](https://huggingface.co/naver/efficient-splade-V-large-query)) (**efficient SPLADE**) | 38.8 | | `naver/efficient-splade-VI-BT-large-doc` ([HF](https://huggingface.co/naver/efficient-splade-VI-BT-large-doc)) + `efficient-splade-VI-BT-large-query` ([HF](https://huggingface.co/naver/efficient-splade-VI-BT-large-query)) (**efficient SPLADE**) | 38.0 | We also uploaded various models [here](https://europe.naverlabs.com/research/machine-learning-and-optimization/splade-models/). Feel free to try them out! ### High level overview of the code structure * This repository lets you either train (`train.py`), index (`index.py`), retrieve (`retrieve.py`) (or perform every step with `all.py`) SPLADE models. * To manage experiments, we rely on [hydra](https://github.com/facebookresearch/hydra). Please refer to [conf/README.md](conf/README.md) for a complete guide on how we configured experiments. ### Data * To train models, we rely on [MS MARCO](https://github.com/microsoft/MSMARCO-Passage-Ranking) data. * We also further rely on distillation and hard negative mining, from available datasets ([Margin MSE Distillation](https://github.com/sebastian-hofstaetter/neural-ranking-kd) , [Sentence Transformers Hard Negatives](https://huggingface.co/datasets/sentence-transformers/msmarco-hard-negatives)) or datasets we built ourselves (e.g. negatives mined from SPLADE). * Most of the data formats are pretty standard; for validation, we rely on an approximate validation set, following a setting similar to [TAS-B](https://arxiv.org/abs/2104.06967). To simplify setting up, we made available all our data folders, which can be [downloaded here](https://download.europe.naverlabs.com/splade/sigir22/data.tar.gz). This link includes queries, documents and hard negative data, allowing for training under the `EnsembleDistil` setting (see v2bis paper). For other settings (`Simple`, `DistilMSE`, `SelfDistil`), you also have to download: * [(`Simple`) standard BM25 Triplets](https://download.europe.naverlabs.com/splade/sigir22/triplets.tar.gz) * [(`DistilMSE`) "Vienna" triplets for MarginMSE distillation](https://www.dropbox.com/s/sl07yvse3rlowxg/vienna_triplets.tar.gz?dl=0) * [(`SelfDistil`) triplets mined from SPLADE](https://download.europe.naverlabs.com/splade/sigir22/splade_triplets.tar.gz) After downloading, you can just untar in the root directory, and it will be placed in the right folder. ``` tar -xzvf file.tar.gz ``` ### Quick start In order to perform all steps (here on toy data, i.e. `config_default.yaml`), go on the root directory and run: ```bash conda activate splade_env export PYTHONPATH=$PYTHONPATH:$(pwd) export SPLADE_CONFIG_NAME="config_default.yaml" python3 -m splade.all \ config.checkpoint_dir=experiments/debug/checkpoint \ config.index_dir=experiments/debug/index \ config.out_dir=experiments/debug/out ``` ### Additional examples We provide additional examples that can be plugged in the above code. See [conf/README.md](conf/README.md) for details on how to change experiment settings. * you can similarly run training `python3 -m splade.train` (same for indexing or retrieval) * to create Anserini readable files (after training), run `SPLADE_CONFIG_FULLPATH=/path/to/checkpoint/dir/config.yaml python3 -m splade.create_anserini +quantization_factor_document=100 +quantization_factor_query=100` * config files for various settings (distillation etc.) are available in `/conf`. For instance, to run the `SelfDistil` setting: * change to `SPLADE_CONFIG_NAME=config_splade++_selfdistil.yaml` * to further change parameters (e.g. lambdas) *outside* the config, run: `python3 -m splade.all config.regularizer.FLOPS.lambda_q=0.06 config.regularizer.FLOPS.lambda_d=0.02` We provide several base configurations which correspond to the experiments in the v2bis and "efficiency" papers. Please note that these are suited for our hardware setting, i.e. 4 GPUs Tesla V100 with 32GB memory. In order to train models with e.g. one GPU, you need to decrease the batch size for training and evaluation. Also note that, as the range for the loss might change with a different batch size, corresponding lambdas for regularization might need to be adapted. However, we provide a mono-gpu configuration `config_splade++_cocondenser_ensembledistil_monogpu.yaml` for which we obtain 37.2 MRR@10, trained on a single 16GB GPU. ### Evaluating a pre-trained model Indexing (and retrieval) can be done either using our (numba-based) implementation of inverted index, or [Anserini](https://github.com/castorini/anserini). Let's perform these steps using an available model (`naver/splade-cocondenser-ensembledistil`). ```bash conda activate splade_env export PYTHONPATH=$PYTHONPATH:$(pwd) export SPLADE_CONFIG_NAME="config_splade++_cocondenser_ensembledistil" python3 -m splade.index \ init_dict.model_type_or_dir=naver/splade-cocondenser-ensembledistil \ config.pretrained_no_yamlconfig=true \ config.index_dir=experiments/pre-trained/index python3 -m splade.retrieve \ init_dict.model_type_or_dir=naver/splade-cocondenser-ensembledistil \ config.pretrained_no_yamlconfig=true \ config.index_dir=experiments/pre-trained/index \ config.out_dir=experiments/pre-trained/out # pretrained_no_yamlconfig indicates that we solely rely on a HF-valid model path ``` * To change the data, simply override the hydra retrieve_evaluate package, e.g. add `retrieve_evaluate=msmarco` as argument of `splade.retrieve`. You can similarly build the files that will be ingested by Anserini: ```bash python3 -m splade.create_anserini \ init_dict.model_type_or_dir=naver/splade-cocondenser-ensembledistil \ config.pretrained_no_yamlconfig=true \ config.index_dir=experiments/pre-trained/index \ +quantization_factor_document=100 \ +quantization_factor_query=100 ``` It will create the json collection (`docs_anserini.jsonl`) as well as the queries (`queries_anserini.tsv`) that are needed for Anserini. You then just need to follow the regression for SPLADE [here](https://github.com/castorini/anserini/blob/master/docs/regressions-msmarco-passage-distill-splade-max.md) in order to index and retrieve. ### BEIR eval You can also run evaluation on BEIR, for instance: ```bash conda activate splade_env export PYTHONPATH=$PYTHONPATH:$(pwd) export SPLADE_CONFIG_FULLPATH="/path/to/checkpoint/dir/config.yaml" for dataset in arguana fiqa nfcorpus quora scidocs scifact trec-covid webis-touche2020 climate-fever dbpedia-entity fever hotpotqa nq do python3 -m splade.beir_eval \ +beir.dataset=$dataset \ +beir.dataset_path=data/beir \ config.index_retrieve_batch_size=100 done ``` ### PISA evaluation We provide in `efficient_splade_pisa/README.md` the steps to evaluate efficient SPLADE models with PISA. *** # Cite :scroll: Please cite our work as: * (v1) SIGIR21 short paper ``` @inbook{10.1145/3404835.3463098, author = {Formal, Thibault and Piwowarski, Benjamin and Clinchant, St\'{e}phane}, title = {SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking}, year = {2021}, isbn = {9781450380379}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, url = {https://doi.org/10.1145/3404835.3463098}, booktitle = {Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval}, pages = {2288–2292}, numpages = {5} } ``` * (v2) arxiv ``` @misc{https://doi.org/10.48550/arxiv.2109.10086, doi = {10.48550/ARXIV.2109.10086}, url = {https://arxiv.org/abs/2109.10086}, author = {Formal, Thibault and Lassance, Carlos and Piwowarski, Benjamin and Clinchant, Stéphane}, keywords = {Information Retrieval (cs.IR), Artificial Intelligence (cs.AI), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences}, title = {SPLADE v2: Sparse Lexical and Expansion Model for Information Retrieval}, publisher = {arXiv}, year = {2021}, copyright = {Creative Commons Attribution Non Commercial Share Alike 4.0 International} } ``` * (v2bis) SPLADE++, SIGIR22 short paper ``` @inproceedings{10.1145/3477495.3531857, author = {Formal, Thibault and Lassance, Carlos and Piwowarski, Benjamin and Clinchant, St\'{e}phane}, title = {From Distillation to Hard Negative Sampling: Making Sparse Neural IR Models More Effective}, year = {2022}, isbn = {9781450387323}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, url = {https://doi.org/10.1145/3477495.3531857}, doi = {10.1145/3477495.3531857}, abstract = {Neural retrievers based on dense representations combined with Approximate Nearest Neighbors search have recently received a lot of attention, owing their success to distillation and/or better sampling of examples for training -- while still relying on the same backbone architecture. In the meantime, sparse representation learning fueled by traditional inverted indexing techniques has seen a growing interest, inheriting from desirable IR priors such as explicit lexical matching. While some architectural variants have been proposed, a lesser effort has been put in the training of such models. In this work, we build on SPLADE -- a sparse expansion-based retriever -- and show to which extent it is able to benefit from the same training improvements as dense models, by studying the effect of distillation, hard-negative mining as well as the Pre-trained Language Model initialization. We furthermore study the link between effectiveness and efficiency, on in-domain and zero-shot settings, leading to state-of-the-art results in both scenarios for sufficiently expressive models.}, booktitle = {Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval}, pages = {2353–2359}, numpages = {7}, keywords = {neural networks, indexing, sparse representations, regularization}, location = {Madrid, Spain}, series = {SIGIR '22} } ``` * efficient SPLADE, SIGIR22 short paper ``` @inproceedings{10.1145/3477495.3531833, author = {Lassance, Carlos and Clinchant, St\'{e}phane}, title = {An Efficiency Study for SPLADE Models}, year = {2022}, isbn = {9781450387323}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, url = {https://doi.org/10.1145/3477495.3531833}, doi = {10.1145/3477495.3531833}, abstract = {Latency and efficiency issues are often overlooked when evaluating IR models based on Pretrained Language Models (PLMs) in reason of multiple hardware and software testing scenarios. Nevertheless, efficiency is an important part of such systems and should not be overlooked. In this paper, we focus on improving the efficiency of the SPLADE model since it has achieved state-of-the-art zero-shot performance and competitive results on TREC collections. SPLADE efficiency can be controlled via a regularization factor, but solely controlling this regularization has been shown to not be efficient enough. In order to reduce the latency gap between SPLADE and traditional retrieval systems, we propose several techniques including L1 regularization for queries, a separation of document/query encoders, a FLOPS-regularized middle-training, and the use of faster query encoders. Our benchmark demonstrates that we can drastically improve the efficiency of these models while increasing the performance metrics on in-domain data. To our knowledge, we propose the first neural models that, under the same computing constraints, achieve similar latency (less than 4ms difference) as traditional BM25, while having similar performance (less than 10% MRR@10 reduction) as the state-of-the-art single-stage neural rankers on in-domain data.}, booktitle = {Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval}, pages = {2220–2226}, numpages = {7}, keywords = {splade, sparse representations, latency, information retrieval}, location = {Madrid, Spain}, series = {SIGIR '22} } ``` *** # Contact :mailbox_with_no_mail: Feel free to contact us via [Twitter](https://twitter.com/thibault_formal) or by mail @ [email protected] ! # License SPLADE Copyright (c) 2021-present NAVER Corp. SPLADE is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. (see [license](license.txt)) You should have received a copy of the license along with this work. If not, see http://creativecommons.org/licenses/by-nc-sa/4.0/ .

ML Frameworks
995 Github Stars