Coder Social home page Coder Social logo

on [PAD] as an actual token about colbert HOT 7 CLOSED

cmacdonald avatar cmacdonald commented on July 23, 2024
on [PAD] as an actual token

from colbert.

Comments (7)

okhat avatar okhat commented on July 23, 2024 1

Hi Craig! I just saw this ECIR'21 preprint that seems to do some analysis about alignment. https://arxiv.org/abs/2012.09650

Not much about [MASK]s though.

from colbert.

okhat avatar okhat commented on July 23, 2024

That's interesting and, in hindsight, is to be expected with other special tokens in any large collection (e.g., there's probably [SEP] too).

I guess the right thing is to tokenize them into three tokens including the square brackets?

But I don't think this has any significant impact, unless someone is searching for special tokens?

from colbert.

cmacdonald avatar cmacdonald commented on July 23, 2024

I've been adapting code looking at alignments, and this tripped me up. I wondered if the x!=0 is really needed in colbert.mask(), as special tokens are removed using the normal attention masking?

from colbert.

okhat avatar okhat commented on July 23, 2024

Surprisingly, it actually matters with HuggingFace. The attention mask doesn't prevent non-zero outputs. It just makes sure other tokens don't attend to the masked positions.

from colbert.

okhat avatar okhat commented on July 23, 2024

The other thing is that the masks remove pad tokens before saving documents to disk in indexing. This probably saves some space.

from colbert.

cmacdonald avatar cmacdonald commented on July 23, 2024

Interesting. I was surprised that the BERT tokeniser would accept [PAD] as a token - I though special tokens had to be appended to the generated ids; I guess the impact is for queries involving something abbreviated as PAD, SEP etc.

Sure, trailing PADs need to continue to be removed. Anyway, its an observation rather than a bug.

from colbert.

okhat avatar okhat commented on July 23, 2024

I agree it's worth addressing, especially in a production system. The easiest way is to surround all square brackets with spaces in the original text (i.e., via an all replace).

from colbert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.