Beam search optimization method for non-completely independent break points

By judging the type of segmented points in the network diagram, using memory information of non-completely independent segmented points to split the network diagram, the problem of difficult reduction in beam search width and problem scale is solved, and the spatial complexity and memory peak optimization of constant level is achieved .

CN119494363AActive Publication Date: 2025-02-21HEFEI JUNZHENG TECH CO LTD

Patent Information

Application Number
CN202311034599.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-16
Publication Date
2025-02-21
Estimated Expiration
2043-08-16

AI Technical Summary

Technical Problem

When the prior art deals with non-completely independent segmentation points, the width and problem scale of beam search are difficult to effectively reduce, resulting in difficult to optimize memory peaks.

Method used

By judging the completely independent segmentation point and the non-complete independent segmentation point, the memory information of the non-complete independent segmentation point is used to segment the network diagram, and the scheduling information of the remaining subgraphs is determined, thereby optimizing the width and memory peak of beam search.

Benefits of technology

It is realized that in the case of non-completely independent segmentation points, the width of beam search is 0, and only a limited number of nodes that have not consumed memory are required to enter the remaining subgraph to re-calculate, reaching the constant level of space complexity, effectively reducing the memory peak value. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494363A_ABST
    Figure CN119494363A_ABST
Patent Text Reader

Abstract

The invention provides an optimization method for beam search for non-completely independent break points. The optimization method comprises the following steps: S1, judging completely independent break points and non-completely independent break points; s2, if a non-completely independent segmentation point exists, namely, an unconsumed ancestor node exists, the node needs to be reserved for the remaining sub-graphs, network memory peak information is obtained, at the moment, a scheduling scheme of nodes in front of the non-completely independent segmentation point is determined, the beam width is 0, and only a limited number of nodes without completely consuming the memory enter the remaining sub-graphs for recalculation; according to the non-completely-independent segmentation points, the whole network graph is segmented into independent sub-graphs, but the non-completely-independent segmentation points need to be reserved for the remaining sub-graphs, that is, the last independent sub-graph has N schemes, the optimal scheme is selected, and serial numbers from the current moment 1 to the moment t are recorded; independently analyzing serial numbers at the (t + 1) th moment and after the (t + 1) th moment, reserving serial numbers of completely independent segmentation points, and respectively performing beam search on the remaining sub-graphs to sort; and S3, finally, sorting and splicing the sub-graphs to form sorting information of the whole network graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and in particular relates to an optimization method for beam search of non-completely independent segmentation points. Background Art

[0002] With the development of the Internet, artificial intelligence (AI) has developed rapidly, and AI models have been applied to various products and services. Generally, AI models are constructed using deep neural networks or convolutional neural networks, and then the constructed models are trained using training samples to obtain AI models that can be used for reasoning in application scenarios.

[0003] The network graph will have multiple operators and multiple edges. Each edge will be associated with two operators. The edge is also used to represent the input / output relationship between the two associated operators. During the AI ​​reasoning process, the terminal side needs to calculate one by one according to the execution order of each operator in the network. Each operator has input data and output data. For example, the convolution operator performs convolution calculation on the input data and then outputs it. Therefore, at least one block of memory is required for each operator to store the corresponding output data, and this output data is used as the input data of the next operator associated with it. In actual applications, some special operators such as GRU and LSTM will have multiple output tensors. If the memory of these operators is not managed, the executing operator cannot know where to schedule the input data, nor can it determine the location where the output data should be stored in the memory, resulting in data confusion and inability to complete reasoning.

[0004] If a piece of memory is allocated to each operator in the computation graph, it will cause a waste of memory resources. Because the operators in the network are executed in sequence, when the subsequent operator is executed, the memory of the previous operator in the previous execution order may have been cleared. In this way, the subsequent operator can use all or part of the memory of the previous operator. When pre-allocating memory, multiple operators with non-overlapping life cycles can share memory. The industry has explored a variety of solutions to reduce the actual deployment memory peak of the computation graph.

[0005] However, in all current solutions, in practical applications, it is assumed that a certain sorting has been determined, and how to pre-allocate memory. In theoretical research, a lot of resources are spent on learning solutions to study sorting, but there are difficulties in application implementation, and learning solutions may fall into local optimality.

[0006] Technical problems existing in existing technologies:

[0007] The independent split point can obviously cut the entire network into multiple independent subgraphs, and the order of each independent subgraph does not affect each other. However, in practical applications, there is also a non-completely independent split point.

[0008] Since the width of the beam search is limited due to the constraints of server resources, using completely independent split points for segmentation is sometimes not enough. Therefore, further considering non-completely independent split points will further reduce the width of the beam search and reduce the scale of the problem.

[0009] Commonly used terms in the prior art include:

[0010] 1) Node, operator, operator: In the embodiments of the present application, the node in the neural network can also be called an operator, operator, etc., which is the smallest unit of the network structure. In the embodiments of the present application, the operator is used as an example for description.

[0011] 2)Tensor, tensor:

[0012] The output data results of the operator must be saved in a tensor. An operator is generally an output result, and only one tensor is needed to save the output result. In practical applications, an operator may output multiple tensors, such as LSTM operators and GRU operators. The life cycles of various tensors may be different. For example, the patent WO2022105187A1 "A method, device and system for memory management" states that "each node requires at least one piece of memory to store the corresponding output data, and this output data serves as the input data of the next node associated with it." This application only discusses general cases.

[0013] 3) Computational graphs, AI models, neural networks, deep learning networks, directed acyclic graphs: all belong to the same concept, and are directed acyclic graph structures composed of multiple nodes.

[0014] 4) Operator memory:

[0015] When an operator has one output tensor, the memory occupied by the tensor is the memory of the operator.

[0016] When an operator has multiple output tensors, the sum of the memory occupied by the multiple tensors is the memory of the operator.

[0017] This application only discusses one operator with one output tensor.

[0018] 5) Network memory at time t:

[0019] The execution order of the network has calculated the memory required for the operator executed at time t:

[0020] First: input tensor memory,

[0021] Second: the memory of this operator,

[0022] Third: The memory of the tensors in the network that have not been consumed.

[0023] 6) The maximum memory peak of the network, the first memory peak of the network, the second memory peak of the network, the third memory peak of the network, and the tth memory peak:

[0024] The execution order of the network has been calculated at the tth moment,

[0025] Calculate the network memory at the 1st moment, the 2nd moment, the 3rd moment, ..., the tth moment, and sort them in descending order, so as to know the first memory peak value of the network, the second memory peak value of the network, ..., the tth memory peak value of the network.

[0026] 7) Scheduling, sorting, and execution order:

[0027] Common network sorting schemes are depth-first sorting and breadth-first sorting, but the actual number of network sorting schemes is very large. When calculating offline on the PC side, it is even impossible to store all the scheduling schemes.

[0028] 8) Completely independent split points:

[0029] The entire network can be divided into 2 by this point, and the upper and lower graphs are completely unrelated. In other words, if this point is removed, the entire network graph is disconnected. Figure 1 , Figure 2 As shown, the Figure 1 The completely independent split points are 1,6,7,10. Figure 2 The completely independent split points in are 1 and 10.

[0030] 9) Non-completely independent split points:

[0031] In the network graph, there are removable dependencies between sibling nodes and descendant nodes. The connection relationship can be removed, and the dominant point judgment algorithm of the data structure can be used to form an independent partition point, which is called a non-completely independent partition point. Figure 2 In the example, 7 nodes are not completely independent nodes, so the entire network graph cannot be divided into {1, 2, 3, 4, 5, 6} and {7, 8, 9, 10} nodes by 7 nodes. Obviously, {7, 8, 9, 10} nodes still need the information of 4 nodes. It is only necessary to give the memory information of 4 nodes to {6, 7, 8, 9}. That is, the entire network can be divided into {1, 2, 3, 3, 4, 5, 6} and {7, 8, 9, 10, and the memory information of 4 nodes}.

[0032] Figure 2In the example, the outputs of node 4 are node 6 and node 8, that is, node 6 and node 8 are sibling nodes. However, node 8 is obviously also a descendant node of node 6, so the sorting number of node 8 must be after 6. At this time, the connection between node 4 and node 8 can be removed, forming Figure 1 . Figure 1 In the example, node 7 is a completely independent split point, so the original Figure 2 In the example, node 7 is a non-completely independent partition point. Figure 1 The second subgraph only needs the fixed memory information of the first subgraph, and no additional numbering is required. That is, it is divided into {1,2,3,3,4,5,6} and {7,8,9,10, and the memory information of 4 nodes}. In the second subgraph {7,8,9,10}, there is no need to number the 4 nodes, and in fact, it has been numbered before the subgraph, and its memory information is only used. Summary of the invention

[0033] In order to solve the above problems, the purpose of this application is to:

[0034] This paper focuses on the heuristic solution, which does not require a large amount of training data. It uses beam search to search the global search solution, which guarantees the global optimal solution as much as possible and finds the scheduling solution with the smallest memory peak. Among the current researchers, it is the only and best method in heuristic case-solving when the offline server space is limited.

[0035] Non-completely independent split points can also cut the network into multiple subgraphs. The direct impact of the ordering of each independent subgraph is certain. By using the determined relationship, the subgraphs can be further cut.

[0036] Specifically, the present invention provides an optimization method for beam search of non-completely independent segmentation points, the method comprising:

[0037] S1, determine completely independent segmentation points and non-completely independent segmentation points:

[0038] When the beam searches for the completely independent split point and the non-completely independent split point, the last numbered nodes of all beam schemes at the current moment are the same;

[0039] When the points are completely independent of each other, there are no unconsumed descendant nodes, so the numbered descendant nodes are completely irrelevant to the unnumbered nodes, and the numbered nodes can be removed, and the remaining subgraphs can be numbered completely independently;

[0040] When the split point is not completely independent, the ancestor nodes have been numbered, and the impact on the remaining subgraphs is certain. It is only necessary to provide the memory information of the unconsumed ancestor nodes to the remaining subgraphs, and the consumed nodes can be removed from the graph, so that the scheduling information of the remaining subgraphs can be determined;

[0041] S2: If there is a non-completely independent split point, that is, there is an unconsumed ancestor node, which needs to be reserved for the remaining subgraph to obtain the network memory peak information. At this time, multiple scheduling schemes for the nodes before the non-completely independent split point can be determined, the beam width is 0, and only a limited number of nodes that have not consumed all the memory enter the remaining subgraph for recalculation. The formula can be expressed in O(1), which represents a constant level of space complexity.

[0042] According to the non-completely independent split point, the entire network graph is divided into independent subgraphs, but the non-completely independent split point needs to be reserved for the remaining subgraphs, that is, the previous independent subgraph has N solutions, and the N solutions can select the best one, and record the numbers from the current time 1 to time t; next, independently analyze the numbers at time t+1 and later, retain the numbers of the non-completely independent split points, and the remaining subgraphs enter the beam search for sorting;

[0043] S3, finally stitching together the rankings of each subgraph to form the ranking information of the entire network graph. Assuming that there are AJ nodes to be ranked, the step S1 further includes:

[0044] S1.1, T=1: A is numbered 1;

[0045] Assuming that the current beam scheme has only one numbered node, the maximum numbered name is consistent, and there are no unconsumed descendant nodes, then A is judged to be a completely independent split point;

[0046] The ordering before and after the completely independent split point does not affect each other. The completely independent split point itself needs to participate in the calculation of the memory peak value at the next moment. There is no node before node A, so it does not need to be split.

[0047] S1.2, at time T = 2, the node A is numbered 1, so the node numbered 2 should be selected at this time; assuming that the optional nodes numbered 2 are B and D, and the beam width is 2,

[0048] {A=1,B=2,{C,D,E,F,G,H,I,J}},

[0049] {A=1,D=2,{B,C,E,F,G,H,I,J}};

[0050] The maximum numbered names B and D of the two beam schemes are inconsistent, so there is no independent split point at t = 2;

[0051] S1.3, T = 3, assuming that the next number of the {B = 2} solution can be C and D; the next number of the {D = 2} solution can be B and E; therefore, at T = 3, the beam width is 4, and there are 4 solutions:

[0052] {{A=1,B=2,C=3,{D,E,F,G,H,I,J}},

[0053] {A=1,B=2,D=3,{C,E,F,G,H,I,J}},

[0054] {A=1,D=2,B=3,{C,E,F,G,H,I,J}},

[0055] {A=1,D=2,E=3,{B,E,F,G,H,I,J}};

[0056] Among them, the names of the largest numbered nodes in the first and second schemes are C and D respectively, and the names are inconsistent, so there is no independent split point;

[0057] And so on.

[0058] S1.4, T = 4, the beam solution has

[0059] {A=1, B=2, C=3, D=4, {E, F, G, H, I, J}},

[0060] {A=1,B=2,D=3,C=4,{E,F,G,H,I,J}},

[0061] {A=1,B=2,D=3,E=4,{C,F,G,H,I,J}},

[0062] {A=1,D=2,B=3,C=4,{E,F,G,H,I,J}},

[0063] {A=1,D=2,B=3,E=4,{C,F,G,H,I,J}},

[0064] {A=1,D=2,E=3,B=4,{C,F,G,H,I,J}};

[0065] Among them, the names of the largest numbered nodes in the first and second schemes are D and C respectively. The names are inconsistent, so there is no independent split point;

[0066] S1.5, T = 5, the beam solution is

[0067] {A=1,B=2,C=3,D=4,E=5,{F,G,H,I,J}},

[0068] {A=1,B=2,D=3,C=4,E=5,{F,G,H,I,J}},

[0069] {A=1,B=2,D=3,E=4,C=5,{F,G,H,I,J}},

[0070] {A=1,D=2,B=3,C=4,E=5,{F,G,H,I,J}},

[0071] {A=1,D=2,B=3,E=4,C=5,{F,G,H,I,J}},

[0072] {A=1,D=2,E=3,B=4,C=5,{F,G,H,I,J}};

[0073] Among them, the names of the largest numbered nodes in the first, second, and third schemes are E, E, and C respectively. The names are inconsistent, so there is no independent split point;

[0074] S1.6, T = 6, the beam solution has

[0075] {A=1,B=2,C=3,D=4,E=5,F=6,{G,H,I,J}},

[0076] {A=1,B=2,D=3,C=4,E=5,F=6,{G,H,I,J}},

[0077] {A=1,B=2,D=3,E=4,C=5,F=6,{G,H,I,J}},

[0078] {A=1,D=2,B=3,C=4,E=5,F=6,{G,H,I,J}},

[0079] {A=1,D=2,B=3,E=4,C=5,F=6,{G,H,I,J}},

[0080] {A=1,D=2,E=3,B=4,C=5,F=6,{G,H,I,J}}

[0081] The name of the highest numbered node in all solutions is F, which is consistent. If there is an unconsumed ancestor node C, there is a non-completely independent split point F. The connectivity judgment of the ordinary directed acyclic graph is that F is not the only connecting point between the upper and lower graphs in the topological space. The upper and lower subgraphs of F are related. The F node is not a dominant point, that is, it is not a completely independent split point. Keeping the sorting information of the nodes before the dominant point is still an NP-hard problem. Here are 6 solutions to continue sorting;

[0082] However, the order before F is fixed, and there is no need to retain all nodes before F. The network length is reduced and memory is saved. Only the C node and the F node itself that have not consumed all the memory need to be retained. The width will be 0 and will be recalculated later.

[0083] The step S1 further comprises:

[0084] S1.7, at time T = 7, the remaining subgraphs can be recalculated from a width of 0, rather than continuing from the 6 solutions at time T = 6;

[0085] At this time, the number of the largest node F is 6, so the next step is to determine the node numbered 7; the node numbered 7 can currently be selected as G, and the beam width is 1: {C = 4, F = 6, G = 7, {H, I, J}};

[0086] Unlike completely independent split points, multiple scheduling plans for nodes before non-completely independent split points can be determined at this time, without having to continue to enter beam search from width 6. Once the plan is determined, the beam width is 0, and only a limited number of nodes that have not consumed all the memory enter the remaining subgraph for recalculation. The numbered F nodes are consumed, and C and are not consumed. The limited number of nodes can be represented by a constant level of space complexity using O(1);

[0087] Similarly,

[0088] S1.8, beam solution at T=8:

[0089] {C=4,G=7,H=8,{I,J}},

[0090] {C=4,G=7,I=8,{H,J}};

[0091] S1.9, beam solution at T=9:

[0092] {C=4,G=7,H=8,I=9,{J}},

[0093] {C=4,G=7,I=8,H=9,{J}};

[0094] S1.10, beam solution at T=10:

[0095] {C=4,G=7,H=8,I=9,J=10},

[0096] {C=4, G=7, I=8, H=9, J=10}.

[0097] The step S2 further comprises:

[0098] S2.1, therefore, for all the solutions at the current time T=6, determine the first memory peak to the t=6th memory peak, and select the best solution. Assuming the numbering is {A=1, B=2, D=3, C=4, E=5, F=6}, the numbering of ABDCEF can be determined, and then the order of the subsequent nodes can be re-determined. The entire graph is divided into numbered {ABDF} and unnumbered remaining subgraphs {C=4, F=6 and GHIJ}, and the C and F nodes are retained for the calculation of memory peaks at subsequent moments.

[0099] The S2 further comprises:

[0100] S2.2, finally select the one with the smallest memory peak from the two solutions with T=10 as the final solution, assuming {C=4, F=6, G=7, H=8, I=9, J=10}.

[0101] The step S3 further comprises:

[0102] {C=4,F=6,G=7,H=8,I=9,J=10} is then concatenated with the previously stored {A=1,B=2,D=3,E=5} to form the sorting information of the entire network graph {A=1,B=2,D=3,C=4,E=5,F=6,G=7,H=8,I=9,J=10}.

[0103] For the convenience of description in the method, in actual implementation, it is also necessary to retain C and F that have not consumed all the memory, which needs to be reserved for the remaining subgraphs to obtain the network memory peak information. F stores the current number information. Of course, other means can also be used to record the current number and memory information.

[0104] In step S2, if it is a completely independent split point, the entire network diagram is divided into independent sub-graphs according to the completely independent split point. The previous independent sub-graph has N solutions, and the current N solutions do not affect the sorting at the next moment, so the N solutions can select the best one, and record the numbers from the current 1 to t moment; next, independently analyze the t+1th moment and the subsequent numbers, and each independent sub-graph can also be processed separately, and each independent sub-graph enters the beam search for sorting.

[0105] Therefore, the advantage of the present application is that when there is a non-completely independent split point, multiple scheduling schemes for the nodes before the non-completely independent split point can be determined without continuing to enter the beam search from width 6. After the scheme is determined, the beam width is 0, and only a limited number of nodes that have not consumed all the memory enter the remaining subgraph for recalculation, and the formula expression can be expressed by O(1) with a constant level of space complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0106] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.

[0107] Figure 1 This is a schematic diagram of the existence of completely independent segmentation points in the graph.

[0108] Figure 2 This is a schematic diagram of the presence of non-completely independent segmentation points in the figure.

[0109] Figure 3 It is a schematic diagram of the AJ node structure in the embodiment of the method.

[0110] Figure 4 is a schematic diagram of the remaining sub-graph after F is determined to be a non-completely independent segmentation point in the embodiment of the method.

[0111] Figure 5 is a schematic diagram of the remaining subgraph after G is determined to be a non-completely independent segmentation point in the embodiment of the method.

[0112] Figure 6 It is a schematic diagram of the process of this method. DETAILED DESCRIPTION

[0113] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail in conjunction with the accompanying drawings.

[0114] The embodiment of the present application relates to an optimization method for beam search of non-completely independent segmentation points.

[0115] When beam searches for a completely independent split point and a non-completely independent split point, the last numbered node of all beam solutions at the current moment is the same. The difference is that when a completely independent split point is found, there are no unconsumed descendant nodes, so the numbered descendant nodes are completely irrelevant to the unnumbered nodes, and the numbered nodes can be removed very cleanly, and the remaining subgraphs can be numbered completely independently;

[0116] When the split point is not completely independent, the ancestor nodes have been numbered, and the impact on the remaining subgraphs is certain. We only need to provide the memory information of the unconsumed ancestor nodes to the remaining subgraphs, and the consumed nodes can be removed from the graph, then the scheduling information of the remaining subgraphs can be determined.

[0117] Specifically, the steps of this method include: Figure 6 As shown,

[0118] S1, determine completely independent segmentation points and non-completely independent segmentation points:

[0119] When the beam searches for the completely independent split point and the non-completely independent split point, the last numbered nodes of all beam schemes at the current moment are the same;

[0120] When the split point is not completely independent, the ancestor nodes have been numbered, and the impact on the remaining subgraphs is certain. It is only necessary to provide the memory information of the unconsumed ancestor nodes to the remaining subgraphs, and the consumed nodes can be removed from the graph, so that the scheduling information of the remaining subgraphs can be determined;

[0121] S2, if there is a non-completely independent split point, that is, there is an unconsumed ancestor node, which needs to be reserved for the remaining subgraphs to obtain the network memory peak information. At this time, the length of the beam plan is more than the length of the completely independent split point by a finite number of unconsumed memory nodes. At this time, multiple scheduling plans for the nodes in front of the non-completely independent split point can be determined, and the beam width is 0. Only a finite number of nodes that have not consumed all memory enter the remaining subgraphs for recalculation. The formula expression can be expressed by O(1), and O(1) represents a constant-level space complexity. It belongs to the big O representation of data structures; according to the non-completely independent split point, the entire network graph is divided into independent subgraphs, but the non-completely independent split point needs to be reserved for the remaining subgraphs, that is, the previous independent subgraph has N plans, and the N plans can select the best one, and record the current number from 1 to t; next, independently analyze the numbering of the t+1th time and later, retain the numbering of the completely independent split point, and the remaining subgraphs enter the beam search for sorting;

[0122] S3, finally, the sorting information of each subgraph is spliced ​​together to form the sorting information of the entire network graph.

[0123] In particular, assuming that the AJ node Figure 3 To sort:

[0124] S1.1, T=1: A is numbered 1;

[0125] The current beam scheme has only one numbered node, the maximum numbered name is the same, and there are no unconsumed descendant nodes. A is a completely independent split point. The numbering before A node does not affect the numbering at subsequent moments.

[0126] The ordering before and after the completely independent split point does not affect each other. The completely independent split point itself needs to participate in the calculation of the memory peak value at the next moment. There is no node before node A, so it does not need to be split. S1.2, at time T = 2, the number of the numbered node A is 1, then the node number 2 should be selected at this time. The optional number of number 2 is two nodes B and D, and the beam width is 2:

[0127] {A=1,B=2,{C,D,E,F,G,H,I,J}},

[0128] {A=1,D=2,{B,C,E,F,G,H,I,J}};

[0129] The maximum numbered names B and D of the two beam schemes are inconsistent, so there is no independent split point at time t=2.

[0130] S1.3, at T = 3, the next number of the solution {A = 1, B = 2, {C, D, E, F, G, H, I, J}} can be C or D; the next number of the solution {A = 1, D = 2, {B, C, E, F, G, H, I, J}} can be B or E. Therefore, at T = 3, the beam width is 4, and there are 4 solutions:

[0131] {A=1,B=2,C=3,{D,E,F,G,H,I,J}},

[0132] {A=1,B=2,D=3,{C,E,F,G,H,I,J}},

[0133] {A=1,D=2,B=3,{C,E,F,G,H,I,J}},

[0134] {A=1,D=2,E=3,{B,E,F,G,H,I,J}};

[0135] The names of the nodes with the largest number in the first and second solutions are C and D respectively. The names are inconsistent, so there is no independent split point.

[0136] S1.4, T = 4, the beam solution has

[0137] {A=1, B=2, C=3, D=4, {E, F, G, H, I, J}},

[0138] {A=1,B=2,D=3,C=4,{E,F,G,H,I,J}},

[0139] {A=1,B=2,D=3,E=4,{C,F,G,H,I,J}},

[0140] {A=1,D=2,B=3,C=4,{E,F,G,H,I,J}},

[0141] {A=1,D=2,B=3,E=4,{C,F,G,H,I,J}},

[0142] {A=1,D=2,E=3,B=4,{C,F,G,H,I,J}};

[0143] The names of the nodes with the largest number in the first and second solutions are D and C respectively. The names are inconsistent, so there is no independent split point.

[0144] S1.5, T = 5, the beam solution is

[0145] {A=1,B=2,C=3,D=4,E=5,{F,G,H,I,J}},

[0146] {A=1,B=2,D=3,C=4,E=5,{F,G,H,I,J}},

[0147] {A=1,B=2,D=3,E=4,C=5,{F,G,H,I,J}},

[0148] {A=1,D=2,B=3,C=4,E=5,{F,G,H,I,J}},

[0149] {A=1,D=2,B=3,E=4,C=5,{F,G,H,I,J}},

[0150] {A=1,D=2,E=3,B=4,C=5,{F,G,H,I,J}};

[0151] The names of the nodes with the largest number in the first, second, and third schemes are E, E, and C respectively. The names are inconsistent, so there is no independent split point.

[0152] S1.6, T = 6, the beam solution has

[0153] {A=1,B=2,C=3,D=4,E=5,F=6,{G,H,I,J}},

[0154] {A=1,B=2,D=3,C=4,E=5,F=6,{G,H,I,J}},

[0155] {A=1,B=2,D=3,E=4,C=5,F=6,{G,H,I,J}},

[0156] {A=1,D=2,B=3,C=4,E=5,F=6,{G,H,I,J}},

[0157] {A=1,D=2,B=3,E=4,C=5,F=6,{G,H,I,J}},

[0158] {A=1,D=2,E=3,B=4,C=5,F=6,{G,H,I,J}}

[0159] The name of the node with the highest number in all schemes is F, which is consistent. If there is an unconsumed ancestor node C, there is a non-completely independent partition point F. For the connectivity judgment of ordinary directed acyclic graphs, F is not the only connecting point between the upper and lower graphs in the topological space. The upper and lower subgraphs of F are associated. The F node is not a dominant point, that is, it is not a completely independent partition point. Retaining the sorting information of the nodes before the dominant point is still an NP-hard problem. Here are 6 schemes to continue sorting.

[0160] However, the order before F is fixed, and it is not necessary to keep all the nodes before F. The network length is reduced and memory is saved. Only the C node and F node itself that have not consumed all the memory need to be kept. The width will be 0 and will be recalculated later. The remaining subgraphs are as follows Figure 4 express.

[0161] Therefore, for all current solutions, we can judge the first memory peak to the t=6th memory peak and select the best solution. Assuming the numbering is {A=1, B=2, D=3, C=4, E=5, F=6}, we can determine the numbering of ABDCEF and then re-determine the order of the following nodes. The whole graph is divided into the numbered {ABDE} and the unnumbered remaining subgraphs {C=4, F=6, {GHIJ}}.

[0162] For the convenience of description, in actual implementation, it is also necessary to retain the last numbered node F=6 to store the current numbering information. Of course, other means can be used to record the current numbering information to facilitate obtaining the number at the next moment. The C=4 node is an unused node and needs to be retained for the remaining subgraph to obtain the network memory peak information. Figure 5 shown.

[0163] S1.7, at time T=7, the order of the remaining subgraphs can be recalculated from a width of 0, rather than continuing the calculation from the 6 options at time T=6.

[0164] At this time, the number of the largest node F is 6, so the next step is to determine the node numbered 7. The node numbered 7 can currently be G.

[0165] At this time, the beam scheme is {C=4, G=7, {H, I, J}}.

[0166] Unlike completely independent split points, multiple scheduling schemes for nodes before non-completely independent split points can be determined at this time, without having to continue to enter beam search from width 6. After the scheme is determined, the beam width is 0, and only a limited number of nodes that have not consumed all the memory enter the remaining subgraph for recalculation. The numbered F nodes are consumed, and C and are not consumed. The remaining subgraph is as follows Figure 5, the formula expression can be expressed by O(1), O(1) represents the space complexity of constant level, which belongs to the knowledge of Big O representation of data structure;

[0167] Similarly,

[0168] S1.8, beam solution at T=8:

[0169] {C=4,G=7,H=8,{I,J}},

[0170] {C=4,G=7,I=8,{H,J}};

[0171] S1.9, beam solution at T=9:

[0172] {C=4,G=7,H=8,I=9,{J}},

[0173] {C=4,G=7,I=8,H=9,{J}};

[0174] S1.10, beam solution at T=10:

[0175] {C=4,G=7,H=8,I=9,J=10},

[0176] {C=4, G=7, I=8, H=9, J=10}.

[0177] Therefore, in summary, the step S2 further includes:

[0178] S2.1, therefore, for all the solutions at the current time T=6, determine the first memory peak to the t=6th memory peak, and select the best solution. Assuming the numbering is {A=1, B=2, D=3, C=4, E=5, F=6}, the numbering of ABDCEF can be determined, and then the order of the following nodes can be re-determined. The whole graph is divided into the numbered {ABDE} and the unnumbered remaining subgraphs {C=4, F=6, {GHIJ}};

[0179] S2.2, finally, the one with the smallest memory peak value is selected from the two solutions with T=10 as the final solution, assuming that {C=4, F=6, G=7, H=8, I=9, J=10}.

[0180] The step S3 further comprises:

[0181] S3, {C=4, F=6, G=7, H=8, I=9, J=10} is then concatenated with the previously stored {A=1, B=2, D=3, C=4, E=5, F=6} to form the sorting information of the entire network graph {A=1, B=2, D=3, C=4, E=5, F=6,G=7, H=8,I=9,J=10}.

[0182] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A beam search optimization method for non-completely independent segmentation points, characterized in that: The method comprises: S1, determine completely independent segmentation points and non-completely independent segmentation points: When the beam searches for the completely independent split point and the non-completely independent split point, the last numbered nodes of all beam schemes at the current moment are the same; When the points are completely independent of each other, there are no unconsumed descendant nodes, so the numbered descendant nodes are completely irrelevant to the unnumbered nodes, and the numbered nodes can be removed, and the remaining subgraphs can be numbered completely independently; When the split point is not completely independent, the ancestor nodes have been numbered, and the impact on the remaining subgraphs is certain. It is only necessary to provide the memory information of the unconsumed ancestor nodes to the remaining subgraphs, and the consumed nodes can be removed from the graph, so that the scheduling information of the remaining subgraphs can be determined; S2: If there is a non-completely independent split point, that is, there is an unconsumed ancestor node, which needs to be reserved for the remaining subgraph to obtain the network memory peak information. At this time, multiple scheduling schemes for the nodes before the non-completely independent split point can be determined, the beam width is 0, and only a limited number of nodes that have not consumed all the memory enter the remaining subgraph for recalculation. The formula expression can be expressed by O(1) to represent the space complexity of the constant level, which belongs to the big O representation of the data structure; According to the non-completely independent split point, the entire network graph is divided into independent subgraphs, but the non-completely independent split point needs to be reserved for the remaining subgraphs, that is, the previous independent subgraph has N solutions, and the N solutions can select the best one, and record the numbers from the current time 1 to time t; next, independently analyze the numbers at time t+1 and later, retain the numbers of the non-completely independent split points, and the remaining subgraphs enter the beam search for sorting; S3, finally, the sorting information of each subgraph is spliced ​​together to form the sorting information of the entire network graph.

2. The optimization method for beam search for non-completely independent segmentation points according to claim 1, characterized in that: Assuming that there are AJ nodes to be sorted, the step S1 further includes: S1.1, T=1: A is numbered 1; Assuming that the current beam scheme has only one numbered node, the maximum numbered name is consistent, and there are no unconsumed descendant nodes, then A is judged to be a completely independent split point; The ordering before and after the completely independent split point does not affect each other. The completely independent split point itself needs to participate in the calculation of the memory peak value at the next moment. There is no node before node A, so it does not need to be split. S1.2, at time T = 2, the node A is numbered 1, so the node numbered 2 should be selected at this time; assuming that the optional nodes numbered 2 are B and D, and the beam width is 2, {A=1,B=2,{C,D,E,F,G,H,I,J}}, {A=1,D=2,{B,C,E,F,G,H,I,J}}; The maximum numbered names B and D of the two beam schemes are inconsistent, so there is no independent split point at t = 2; S1.3, T = 3, assuming that the next number of the {B = 2} solution can be C and D; the next number of the {D = 2} solution can be B and E; therefore, at T = 3, the beam width is 4, and there are 4 solutions: {{A=1,B=2,C=3,{D,E,F,G,H,I,J}}, {A=1,B=2,D=3,{C,E,F,G,H,I,J}}, {A=1,D=2,B=3,{C,E,F,G,H,I,J}}, {A=1,D=2,E=3,{B,E,F,G,H,I,J}}; Among them, the names of the largest numbered nodes in the first and second schemes are C and D respectively, and the names are inconsistent, so there is no independent split point; And so on. S1.4, T = 4, the beam solution has {A=1, B=2, C=3, D=4, {E, F, G, H, I, J}}, {A=1,B=2,D=3,C=4,{E,F,G,H,I,J}}, {A=1,B=2,D=3,E=4,{C,F,G,H,I,J}}, {A=1,D=2,B=3,C=4,{E,F,G,H,I,J}}, {A=1,D=2,B=3,E=4,{C,F,G,H,I,J}}, {A=1,D=2,E=3,B=4,{C,F,G,H,I,J}}; Among them, the names of the largest numbered nodes in the first and second schemes are D and C respectively. The names are inconsistent, so there is no independent split point; S1.5, T = 5, the beam solution is {A=1,B=2,C=3,D=4,E=5,{F,G,H,I,J}}, {A=1,B=2,D=3,C=4,E=5,{F,G,H,I,J}}, {A=1,B=2,D=3,E=4,C=5,{F,G,H,I,J}}, {A=1,D=2,B=3,C=4,E=5,{F,G,H,I,J}}, {A=1,D=2,B=3,E=4,C=5,{F,G,H,I,J}}, {A=1,D=2,E=3,B=4,C=5,{F,G,H,I,J}}; Among them, the names of the largest numbered nodes in the first, second, and third schemes are E, E, and C respectively. The names are inconsistent, so there is no independent split point; S1.6, T = 6, the beam solution has {A=1,B=2,C=3,D=4,E=5,F=6,{G,H,I,J}}, {A=1,B=2,D=3,C=4,E=5,F=6,{G,H,I,J}}, {A=1,B=2,D=3,E=4,C=5,F=6,{G,H,I,J}}, {A=1,D=2,B=3,C=4,E=5,F=6,{G,H,I,J}}, {A=1,D=2,B=3,E=4,C=5,F=6,{G,H,I,J}}, {A=1,D=2,E=3,B=4,C=5,F=6,{G,H,I,J}} The name of the highest numbered node in all solutions is F, which is consistent. If there is an unconsumed ancestor node C, there is a non-completely independent split point F. The connectivity judgment of the ordinary directed acyclic graph is that F is not the only connecting point between the upper and lower graphs in the topological space. The upper and lower subgraphs of F are related. The F node is not a dominant point, that is, it is not a completely independent split point. Keeping the sorting information of the nodes before the dominant point is still an NP-hard problem. Here are 6 solutions to continue sorting; However, the order before F is fixed, and there is no need to retain all nodes before F. The network length is reduced and memory is saved. Only the C node and the F node itself that have not consumed all the memory need to be retained. The width will be 0 and will be recalculated later.

3. The optimization method for beam search for non-completely independent segmentation points according to claim 2, characterized in that: The step S1 further comprises: S1.7, at time T = 7, the remaining subgraphs can be recalculated from a width of 0, rather than continuing from the 6 solutions at time T = 6; At this time, the number of the largest node F is 6, so the next step is to determine the node number 7; the node number 7 can currently be G, and the beam width is 1: {C=4,F=6,G=7,{H,I,J}}; Unlike completely independent split points, multiple scheduling schemes for nodes before non-completely independent split points can be determined without continuing to enter beam search from width 6. Once the scheme is determined, the beam width is 0. Only a limited number of nodes that have not consumed all memory enter the remaining subgraph for recalculation. The numbered F nodes are consumed, and C and are not consumed. The formula expression can be expressed by O(1). Here O(1) represents the space complexity of the constant level, which belongs to the big O representation of data structure. Similarly, S1.8, beam solution at T=8: {C=4,G=7,H=8,{I,J}}, {C=4,G=7,I=8,{H,J}}; S1.9, beam solution at T=9: {C=4,G=7,H=8,I=9,{J}}, {C=4,G=7,I=8,H=9,{J}}; S1.10, beam solution at T=10: {C=4,G=7,H=8,I=9,J=10}, {C=4, G=7, I=8, H=9, J=10}.

4. The optimization method for beam search for non-completely independent segmentation points according to claim 2, characterized in that: The step S2 further comprises: S2.1, therefore, for all the solutions at the current time T=6, determine the first memory peak to the t=6th memory peak, and select the best solution. Assuming the numbering is {A=1, B=2, D=3, C=4, E=5, F=6}, the numbering of ABDCEF can be determined, and then the order of the subsequent nodes can be re-determined. The entire graph is divided into numbered {ABDF} and unnumbered remaining subgraphs {C=4, F=6 and GHIJ}, and the C and F nodes are retained for the calculation of memory peaks at subsequent moments.

5. The optimization method for beam search for non-completely independent segmentation points according to claim 4, characterized in that: The S2 further comprises: S2.2, finally select the one with the smallest memory peak from the two solutions with T=10 as the final solution, assuming {C=4, G=7, H=8, I=9, J=10}.

6. The optimization method for beam search for non-completely independent segmentation points according to claim 5, characterized in that: The step S3 further comprises: {C=4,F=6,G=7,H=8,I=9,J=10} is then concatenated with the previously stored {A=1,B=2,D=3,E=5} to form the sorting information of the entire network graph {A=1,B=2,D=3,C=4,E=5,F=6,G=7,H=8,I=9,J=10}.

7. The optimization method for beam search for non-completely independent segmentation points according to claim 2, characterized in that: For the convenience of description in the method, in actual implementation, it is also necessary to retain C and F that have not consumed all the memory, which needs to be reserved for the remaining subgraphs to obtain the network memory peak information. F stores the current number information. Of course, other means can also be used to record the current number and memory information.

8. The optimization method for beam search for non-completely independent segmentation points according to claim 1, characterized in that: In step S2, if it is a completely independent split point, the entire network graph is divided into independent subgraphs according to the completely independent split point. The previous independent subgraph has N solutions, and the current N solutions do not affect the sorting at the next moment, so the N solutions can select the best one, and record the numbers from the current 1 to t moment; next, independently analyze the numbers at the t+1th moment and thereafter, and each independent subgraph can also be processed separately, and each independent subgraph enters the beam search for sorting.

Citation Information

Patent Citations

  • Memory management method, device, and system

    WO2022105187A1

  • Method and device for mining frequent sub-graphs of single graph

    CN114490799A

  • Automatic scheduling generation method based on polyhedral model

    CN115469879A

  • Deep learning reasoning acceleration method based on graph segmentation

    CN115796265A

  • Method for searching for data, apparatus, and device

    WO2022247869A1

Cited By

  • Neural network optimization method, computer equipment and storage medium

    CN121615697A