PhilipQuirke / quanta_maths

Tool used to verify accuracy of transformer model
Apache License 2.0
1 stars 1 forks source link

MATH: For ADD, SUB, NEG how is SA, MD and ND sub-task output structured #28

Open PhilipQuirke opened 7 months ago

PhilipQuirke commented 7 months ago

Read https://github.com/PhilipQuirke/verified_transformers/blob/main/mixed_model.md. This follows on from Issue #29

In the ins1_mix_d6_l3_h4_t40K model, the attention head P18L0H1 and H2 perform the SA, MD and ND sub-tasks depending on the input question type. That is, the output is poly-semantic. How is the output structured so that later nodes can select either SA output or the MD output or the ND output? Investigate

PCA the output of P18L0H0 for ADD, SUB, NEG questions. Do this for ADD, SUB, NEG separately and then for a batch of questions with all three question types. Compare the PCAs. What can we say about how the output of this node pair (especially as it relates to later nodes selecting either SA output or the MD output or the ND output)?

Do the same results hold for each token position in P15 to P20?

(The Colab VerifiedArithmeticAnalyse.ipynb part 19B has a clause for the ins1_mix_d6_l3_h4_t40K model listing the interesting nodes for the ADD case in terms of their PCA results. It is an example of running PCA against groups of questions. But it runs against a single node rather than a node pair.)

Useful diagrams related to this are:

amirabdullah19852020 commented 6 months ago

Making a hard push on it this weekend - this is similar enough to Issue 29, that I think it'll be better to take both of these rather than one.

amirabdullah19852020 commented 6 months ago

ADD, SUB and NEG are addition, subtraction(positive answer) and subtraction(negative answer) SA: DN + DN' mod 10 (real valued operation) MD: Dn- D′n%10, answer is positive ND: Dn-D'n%10, answer is negative

PhilipQuirke commented 6 months ago

Yes, SA, MN, ND must each implement a map from 100 (10x10) input pairs Dn, D'n to 10 outputs states (0 to 9).

amir-in-a-cynch commented 6 months ago

What do you mean here by a "node pair"?

amirabdullah19852020 commented 1 month ago

I've been able to clearout other responsibilities, and I intend to finish this in the coming fortnight for completeness.

PhilipQuirke commented 1 month ago

That's great news! PQ

On Tue, Sep 24, 2024 at 4:44 AM amirabdullah19852020 < @.***> wrote:

I've been able to clearout other responsibilities, and I intend to finish this in the coming fortnight for completeness.

— Reply to this email directly, view it on GitHub https://github.com/PhilipQuirke/verified_transformers/issues/28#issuecomment-2368820716, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPBMHJ6ASIPOL3OOBGWSDLZYBAN3AVCNFSM6AAAAABGQGBLJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRYHAZDANZRGY . You are receiving this because you authored the thread.Message ID: @.***>