Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

50%
+0 −0
Q&A Why would the tokenizer for encoder-decoder model for machine translation use bos_token_id == eos_token_id? How does it know when a sequence ends?

Not sure if this is really a coding question (maybe the ML or AI Tech proposals might be better suited). Not having distinct begin and end tokens is not that extraordinary. E.g. the GPT-2 tokeniz...

posted 17d ago by mr Tsjolder‭

Answer
#1: Initial revision by user avatar mr Tsjolder‭ · 2025-04-22T20:33:38Z (17 days ago)
Not sure if this is really a coding question (maybe the [ML](https://proposals.codidact.com/posts/289179) or [AI Tech](https://proposals.codidact.com/posts/289124) proposals might be better suited).

Not having distinct begin and end tokens is not that extraordinary. 
E.g. the [GPT-2 tokenizer](https://github.com/openai/tiktoken/blob/main/tiktoken_ext/openai_public.py#L17C1-L30C6) also uses only a single special token (rather than multiple distinct tokens). 
It is simply a design choice that needs to be made at the beginning of training.
Once the model has been trained, you just have to stick with the tokenisation that the model has been trained with.

When you have multiple sequences in one input string, the end of the previous sequence is likely going to be the beginning of the next one anyway. Therefore, I suspect that it does not have that much benefit in general for regular auto-regressive models. I expect it might be more advantageous for bi-directional models, where distinguishing between the end of the forward direction and the end of the reversed direction (i.e. the beginning of the forward sequence) might be helpful.