# Understanding Encoder-Decoder Transformer Architecture in Image Captioning

**URL:** <https://discuss.huggingface.co/t/understanding-encoder-decoder-transformer-architecture-in-image-captioning/135495>\
**Category:** Beginners\
**Created:** [January 13, 2025, 11:20am UTC](https://discuss.huggingface.co/t/understanding-encoder-decoder-transformer-architecture-in-image-captioning/135495 "2025-01-13T11:20:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sriramgs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sriramgs/32/32848_2.png) [@sriramgs](https://discuss.huggingface.co/u/sriramgs)\
**Post date:** [January 13, 2025, 11:20am UTC](https://discuss.huggingface.co/t/understanding-encoder-decoder-transformer-architecture-in-image-captioning/135495/1 "2025-01-13T11:20:39Z")

</div>

Hello all,

I am a beginner in using transformer architecture and am trying to implement image captioning model. For this, I am using Encoder-Decoder architecture using transformer architecture. I am using 6 heads in both encoder and decoder blocks. I have a doubt in this regard.

Please tell whether my understanding is correct or not: "We need to use the encoder’s self-attention output from the 6th head for processing in decoder’s cross-attention? So that the same key, value will be used 6 times with different query (query generated by decoder’s self-attention) in decoder’s cross-attention.
