IP Library Granted Patent US 12,242,829
Granted Patent B2
US 12,242,829 · App. 18/055,182 · Granted Mar 4, 2025

Systems and methods for source code understanding using spatial representations

Inventors: Ruibo Shi (London, GB); Sean Moran (London, GB); Lili Tao (Bristol, GB); Fanny Silavong (London, GB); Rohan Saphal (Glasgow, GB)
Assignee: JPMORGAN CHASE BANK, N.A.
G06F8/41G06N20/00
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,242,829
App. No.
18/055,182
Granted
Mar 4, 2025
Kind
B2
Abstract

Systems and methods for source code understanding using spatial representations are disclosed. In one embodiment, a method may include: (1) receiving, by a source code understanding computer program, a source code snippet; (2) converting, by the source code understanding computer program, the source code snippet to a two-dimensional image representation using an encoding technique; (3) mapping, by the source code understanding computer program, the two-dimensional image representation into a three-dimensional image representation; (4) determining, by the source code understanding computer program, a classification for the source code snippet using a deep learning network; and (5) providing, by the source code understanding computer program, the classification for the source code snippet to a downstream system.

Claims (30)

1. A method for source code understanding using spatial representations, comprising:

receiving, by a source code understanding computer program, a source code snippet;

converting, by the source code understanding computer program, the source code snippet to a matrix representation using an encoding technique, wherein the matrix representation encodes structural and contextual information of the source code snippet;

encoding, by the source code understanding computer program, the matrix representation into a three-dimensional image representation using one hot encoding or trainable embeddings;

determining, by the source code understanding computer program, a discriminative task for the source code snippet using a deep learning network; and

providing, by the source code understanding computer program, the discriminative task for the source code snippet to a downstream system.

2. The method of claim 1 , wherein the source code snippet is in a text format.

3. The method of claim 1 , wherein the encoding technique comprises American Standard Code for Information Interchange (ASCII) encoding.

4. The method of claim 1 , wherein the encoding technique comprises red-green-blue (RGB) formatting.

5. The method of claim 1 , wherein the source code understanding computer program uses one-hot encoding to encode the matrix representation into the three-dimensional image representation.

6. The method of claim 1 , wherein the source code understanding computer program uses trainable embedding of arbitrary dimension to encode the matrix representation into the three-dimensional image representation.

7. The method of claim 1 , wherein the discriminative task is learning a problem that the source code snippet is trying to solve.

8. The method of claim 1 , wherein the discriminative task is learning whether the source code snippet compiles.

9. The method of claim 1 , wherein the discriminative task is learning a memory footprint for the source code snippet.

10. The method of claim 1 , wherein the deep learning network comprises a deep convolutional neural network or a vision transformer.

11. A non-transitory computer readable storage medium, including instructions stored thereon, which when read and executed by one or more computer processors, cause the one or more computer processors to perform steps comprising:

receiving a source code snippet;

converting the source code snippet to a matrix representation using an encoding technique;

encoding the matrix representation into a three-dimensional image representation;

determining a discriminative task for the source code snippet using a deep learning network; and

providing the discriminative task for the source code snippet to a downstream system.

12. The non-transitory computer readable storage medium of claim 11 , wherein the source code snippet is in a text format.

13. The non-transitory computer readable storage medium of claim 11 , wherein the encoding technique comprises American Standard Code for Information Interchange (ASCII) encoding.

14. The non-transitory computer readable storage medium of claim 11 , wherein the encoding technique comprises red-green-blue (RGB) formatting.

15. The non-transitory computer readable storage medium of claim 11 , wherein the matrix representation is encoded into the three-dimensional image representation using one-hot encoding.

16. The non-transitory computer readable storage medium of claim 11 , wherein the matrix representation is encoded into the three-dimensional image representation using trainable embedding of arbitrary dimension.

17. The non-transitory computer readable storage medium of claim 11 , wherein the discriminative task is learning a problem that the source code snippet is trying to solve.

18. The non-transitory computer readable storage medium of claim 11 , wherein the discriminative task is learning whether the source code snippet compiles.

19. The non-transitory computer readable storage medium of claim 11 , wherein the discriminative task is learning a memory footprint for the source code snippet.

20. The non-transitory computer readable storage medium of claim 11 , wherein the deep learning network comprises a deep convolutional neural network or a vision transformer.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 11, 2024
From: SHI, RUIBO; MORAN, SEAN; SILAVONG, FANNY; TAO, LILI; SAPHAL, ROHAN
To: JPMORGAN CHASE BANK, N.A.
Reel/Frame 069198/0001 →
Continuity (2)
Provisional Application 63279562 · Nov 15, 2021
Related Publication 20230153085A1 · May 18, 2023
References Cited (12)
US 6421680B1 · Kumhyr · 2002 [cited by examiner]
US 11461081B2 · Zhang · 2022 [cited by examiner]
US 11573885B1 · Eizenman · 2023 [cited by examiner]
US 20190387259A1 · Coban · 2019 [cited by examiner]
US 20210026605A1 · Evangelopoulos · 2021 [cited by examiner]
US 20210240453A1 · Badlani · 2021 [cited by examiner]
US 20210248367A1 · Gal · 2021 [cited by examiner]
International Search Report and Written Opinion of the International Searching Authority dated Mar. 20, 2023, from corresponding International Application No. PCT/US2022/079886. [cited by applicant]
Keller, Patrick, et al; “What You See is What it Means! Semantic Representation Learning of Code based on Visualization and Transfer Learning”, arxiv.org, Cornell University Library, 201 Olin Library Cornell University … [cited by applicant]
Puja, Amnot Saloni Alias, et al; “SnapCode—A Snapshot Based Approach to Code Stylometry”,2019 International Conference on Information Technology (ICIT), IEEE, Dec. 19, 2019 (Dec. 19, 2019), pp. 337-341. [cited by applicant]
Rabin, MD Rafiqul Islam, et al; “Encoding Program as Image: Evaluating Visual Representation of Source Code”, arxiv.org, Cornell University Library, 201 Olin Library Cornell University Ithaca, NY 14853, Nov. 1, 2021 (No… [cited by applicant]
Shi, Rubio, et al; “CV4Code: Sourcecode Understanding via Visual Code Representations”, arxiv.org, Cornell University Library, 201 Olin Library Cornell University Ithaca, NY 14853, May 11, 2022. [cited by applicant]